[STATEMENT]
theorem erfc_unroll:
  assumes "x > 0"
  shows   "erfc x = exp (-x\<^sup>2) / sqrt pi *
             (\<Sum>i<n. (-1)^i * fact (2*i) / (4^i*fact i) / x^(2*i+1)) + erf_remainder n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
 2. \<And>n. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x \<Longrightarrow> erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x

goal (2 subgoals):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
 2. \<And>n. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x \<Longrightarrow> erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
note Suc.IH
[PROOF STATE]
proof (state)
this:
erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x

goal (2 subgoals):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
 2. \<And>n. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x \<Longrightarrow> erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x

goal (2 subgoals):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
 2. \<And>n. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x \<Longrightarrow> erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
note erf_remainder_conv_Suc[OF assms, of n]
[PROOF STATE]
proof (state)
this:
erf_remainder n x = (- 1) ^ n * fact (2 * n) / (sqrt pi * 4 ^ n * fact n) * exp (- x\<^sup>2) / x ^ (2 * n + 1) + erf_remainder (Suc n) x

goal (2 subgoals):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
 2. \<And>n. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x \<Longrightarrow> erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
erf_remainder n x = (- 1) ^ n * fact (2 * n) / (sqrt pi * 4 ^ n * fact n) * exp (- x\<^sup>2) / x ^ (2 * n + 1) + erf_remainder (Suc n) x

goal (2 subgoals):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
 2. \<And>n. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x \<Longrightarrow> erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
have "exp (- x\<^sup>2) / sqrt pi *
               (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2*i+1)) +
                 ((- 1) ^ n * fact (2*n) / (sqrt pi * 4 ^ n * fact n) * exp (- x\<^sup>2) / x^(2*n+1) +
                 erf_remainder (Suc n) x) =
               exp (- x\<^sup>2) / sqrt pi *
                 (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) +
                 erf_remainder (Suc n) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + ((- 1) ^ n * fact (2 * n) / (sqrt pi * 4 ^ n * fact n) * exp (- x\<^sup>2) / x ^ (2 * n + 1) + erf_remainder (Suc n) x) = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
by (subst sum.lessThan_Suc) (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + ((- 1) ^ n * fact (2 * n) / (sqrt pi * 4 ^ n * fact n) * exp (- x\<^sup>2) / x ^ (2 * n + 1) + erf_remainder (Suc n) x) = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x

goal (2 subgoals):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
 2. \<And>n. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder n x \<Longrightarrow> erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x

goal (1 subgoal):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<Suc n. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder (Suc n) x

goal (1 subgoal):
 1. erfc x = exp (- x\<^sup>2) / sqrt pi * (\<Sum>i<0. (- 1) ^ i * fact (2 * i) / (4 ^ i * fact i) / x ^ (2 * i + 1)) + erf_remainder 0 x
[PROOF STEP]
qed (auto simp: assms erf_remainder_0_conv_erfc)


[STATEMENT]
lemma mult_le_cancel_iff1: "0 < z \<Longrightarrow> x * z \<le> y * z \<longleftrightarrow> x \<le> y"
  for x y z :: "'a::linordered_idom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < z \<Longrightarrow> (x * z \<le> y * z) = (x \<le> y)
[PROOF STEP]
by simp


[STATEMENT]
lemma norm_power: "norm (x ^ n) = norm x ^ n"
  for x :: "'a::real_normed_div_algebra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (x ^ n) = norm x ^ n
[PROOF STEP]
by (induct n) (simp_all add: norm_mult)


[STATEMENT]
lemma fds_left_inverse:
  "fds_nth f 1 \<noteq> (0 :: 'a :: field) \<Longrightarrow> inverse f * f = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth f 1 \<noteq> (0::'a) \<Longrightarrow> inverse f * f = 1
[PROOF STEP]
by (auto simp: fds_eq_iff fds_nth_mult fds_nth_inverse dirichlet_prod_inverse' fds_nth_one)


[STATEMENT]
lemma const_0_sum_mod_2:
  assumes "const 0"
  shows "(f 0 + f 1) mod 2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f 0 + f 1) mod 2 = 0
[PROOF STEP]
using assms const_def
[PROOF STATE]
proof (prove)
using this:
const 0
const ?n = (\<forall>x\<in>{0, 1}. f x = ?n)

goal (1 subgoal):
 1. (f 0 + f 1) mod 2 = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma numeral_le_real_of_nat_iff [simp]: "numeral n \<le> real m \<longleftrightarrow> numeral n \<le> m"
  for m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numeral n \<le> real m) = (numeral n \<le> m)
[PROOF STEP]
by (metis not_le real_of_nat_less_numeral_iff)


[STATEMENT]
lemma local_time_Suc:
  "local_time A (n+1) x = local_time A n x + indicator A ((T^^n)x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_time A (n + 1) x = local_time A n x + indicator A ((T ^^ n) x)
[PROOF STEP]
by (metis local_time_birkhoff birkhoff_sum_cocycle birkhoff_sum_1(2))


[STATEMENT]
lemma SUP_iadd_le_iff: "(SUP x\<in>A. f x :: enat) + n \<le> y \<longleftrightarrow> (if A = {} then n \<le> y else \<forall>x\<in>A. f x + n \<le> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> (f ` A) + n \<le> y) = (if A = {} then n \<le> y else \<forall>x\<in>A. f x + n \<le> y)
[PROOF STEP]
using iadd_SUP_le_iff[of n f A y]
[PROOF STATE]
proof (prove)
using this:
(n + \<Squnion> (f ` A) \<le> y) = (if A = {} then n \<le> y else \<forall>x\<in>A. n + f x \<le> y)

goal (1 subgoal):
 1. (\<Squnion> (f ` A) + n \<le> y) = (if A = {} then n \<le> y else \<forall>x\<in>A. f x + n \<le> y)
[PROOF STEP]
by(simp add: add.commute)


[STATEMENT]
lemma mat_mod_vec_mod_col:  "j < dim_col A \<Longrightarrow> col (mat_mod A) j = vec_mod (col A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < dim_col A \<Longrightarrow> col (local.mat_mod A) j = vec_mod (col A j)
[PROOF STEP]
unfolding mat_mod_def vec_mod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < dim_col A \<Longrightarrow> col (map_mat (\<lambda>x. x mod m) A) j = map_vec (\<lambda>x. x mod m) (col A j)
[PROOF STEP]
by (simp)


[STATEMENT]
lemma Rats_infinite: "\<not> finite \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite \<rat>
[PROOF STEP]
by (auto dest!: finite_imageD simp: inj_on_def infinite_UNIV_char_0 Rats_def)


[STATEMENT]
theorem univ_is_complete: "one_complete univ_ce"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_complete univ_ce
[PROOF STEP]
proof (unfold one_complete_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. univ_ce \<in> ce_sets \<and> (\<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce)
[PROOF STEP]
show "univ_ce \<in> ce_sets \<and> (\<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ_ce \<in> ce_sets \<and> (\<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. univ_ce \<in> ce_sets
 2. \<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce
[PROOF STEP]
show "univ_ce \<in> ce_sets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. univ_ce \<in> ce_sets
[PROOF STEP]
by (rule univ_is_ce)
[PROOF STATE]
proof (state)
this:
univ_ce \<in> ce_sets

goal (1 subgoal):
 1. \<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce
[PROOF STEP]
show "\<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce
[PROOF STEP]
proof (rule allI, rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>B. B \<in> ce_sets \<Longrightarrow> one_reducible_to B univ_ce
[PROOF STEP]
fix B
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>B. B \<in> ce_sets \<Longrightarrow> one_reducible_to B univ_ce
[PROOF STEP]
assume "B \<in> ce_sets"
[PROOF STATE]
proof (state)
this:
B \<in> ce_sets

goal (1 subgoal):
 1. \<And>B. B \<in> ce_sets \<Longrightarrow> one_reducible_to B univ_ce
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<in> ce_sets
[PROOF STEP]
show "one_reducible_to B univ_ce"
[PROOF STATE]
proof (prove)
using this:
B \<in> ce_sets

goal (1 subgoal):
 1. one_reducible_to B univ_ce
[PROOF STEP]
by (rule one_reducible_lm_4)
[PROOF STATE]
proof (state)
this:
one_reducible_to B univ_ce

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
univ_ce \<in> ce_sets \<and> (\<forall>B. B \<in> ce_sets \<longrightarrow> one_reducible_to B univ_ce)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma module_hom_iff_linear: "module_hom s1 s2 f \<longleftrightarrow> linear s1 s2 f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. module_hom s1 s2 f = linear s1 s2 f
[PROOF STEP]
unfolding module_hom_def linear_def module_iff_vector_space
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vector_space s1 \<and> vector_space s2 \<and> module_hom_axioms s1 s2 f) = (vector_space s1 \<and> vector_space s2 \<and> vector_space s1 \<and> vector_space s2 \<and> module_hom_axioms s1 s2 f)
[PROOF STEP]
by auto


[STATEMENT]
lemma adjoint_adjoint:
  fixes A :: "'a::conjugatable_field mat"
  shows "adjoint (adjoint A) = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint (adjoint A) = A
[PROOF STEP]
by (rule eq_matI, auto simp add: adjoint_eval)


[STATEMENT]
lemma mult_scalar_monomial_monomial: "(monomial c t) \<odot> (monomial d v) = monomial (c * d) (t \<oplus> v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial c t \<odot> monomial d v = monomial (c * d) (t \<oplus> v)
[PROOF STEP]
by (rule poly_mapping_eqI_proj, simp add: proj_monomial mult_single when_def term_simps)


[STATEMENT]
lemma size_ipv4addr: "size (x::ipv4addr) = 32"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size x = 32
[PROOF STEP]
by(simp add:word_size)


[STATEMENT]
lemma opp_Point: "opp (Point x y) = Point x (- y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. opp (Point x y) = Point x (- y)
[PROOF STEP]
by (simp add: opp_def)


[STATEMENT]
lemma ang_circ_c_simp:
  assumes "E \<noteq> \<mu>1" and "E \<noteq> \<mu>2"
  shows "ang_circ_c E \<mu>1 \<mu>2 p1 p2 =
        \<bar>\<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool p1 * pi / 2 - sgn_bool p2 * pi / 2\<downharpoonleft>\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ang_circ_c E \<mu>1 \<mu>2 p1 p2 = \<bar>\<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool p1 * pi / 2 - sgn_bool p2 * pi / 2\<downharpoonleft>\<bar>
[PROOF STEP]
unfolding ang_circ_c_def ang_vec_c_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<angle> (circ_tang_vec \<mu>1 E p1) (circ_tang_vec \<mu>2 E p2)\<bar> = \<bar>\<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool p1 * pi / 2 - sgn_bool p2 * pi / 2\<downharpoonleft>\<bar>
[PROOF STEP]
using ang_circ_simp[OF assms]
[PROOF STATE]
proof (prove)
using this:
ang_circ E \<mu>1 \<mu>2 ?p1.0 ?p2.0 = \<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool ?p1.0 * pi / 2 - sgn_bool ?p2.0 * pi / 2\<downharpoonleft>

goal (1 subgoal):
 1. \<bar>\<angle> (circ_tang_vec \<mu>1 E p1) (circ_tang_vec \<mu>2 E p2)\<bar> = \<bar>\<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool p1 * pi / 2 - sgn_bool p2 * pi / 2\<downharpoonleft>\<bar>
[PROOF STEP]
unfolding ang_circ_def
[PROOF STATE]
proof (prove)
using this:
\<angle> (circ_tang_vec \<mu>1 E ?p1.0) (circ_tang_vec \<mu>2 E ?p2.0) = \<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool ?p1.0 * pi / 2 - sgn_bool ?p2.0 * pi / 2\<downharpoonleft>

goal (1 subgoal):
 1. \<bar>\<angle> (circ_tang_vec \<mu>1 E p1) (circ_tang_vec \<mu>2 E p2)\<bar> = \<bar>\<downharpoonright>Arg (E - \<mu>2) - Arg (E - \<mu>1) + sgn_bool p1 * pi / 2 - sgn_bool p2 * pi / 2\<downharpoonleft>\<bar>
[PROOF STEP]
by auto


[STATEMENT]
lemma list_slice_nth_nth_rev: "
  n < length xs div k * k \<Longrightarrow>
  (list_slice xs k) ! (n div k) ! (n mod k) = xs ! n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < length xs div k * k \<Longrightarrow> list_slice xs k ! (n div k) ! (n mod k) = xs ! n
[PROOF STEP]
apply (case_tac "k = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs div k * k; k \<noteq> 0\<rbrakk> \<Longrightarrow> list_slice xs k ! (n div k) ! (n mod k) = xs ! n
[PROOF STEP]
apply (simp add: list_slice_nth_nth div_less_conv)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma aff_dim_lt_full:
  fixes S :: "'a::euclidean_space set"
  shows "aff_dim S < DIM('a) \<longleftrightarrow> (affine hull S \<noteq> UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (aff_dim S < int DIM('a)) = (affine hull S \<noteq> UNIV)
[PROOF STEP]
by (metis (no_types) aff_dim_affine_hull aff_dim_le_DIM aff_dim_UNIV affine_hull_UNIV less_le)


[STATEMENT]
lemma choose_mult:
  "k \<le> m \<Longrightarrow> m \<le> n \<Longrightarrow> (n choose m) * (m choose k) = (n choose k) * ((n - k) choose (m - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<le> m; m \<le> n\<rbrakk> \<Longrightarrow> (n choose m) * (m choose k) = (n choose k) * (n - k choose (m - k))
[PROOF STEP]
using choose_mult_lemma [of "m-k" "n-m" k]
[PROOF STATE]
proof (prove)
using this:
(m - k + (n - m) + k choose (m - k + k)) * (m - k + k choose k) = (m - k + (n - m) + k choose k) * (m - k + (n - m) choose (m - k))

goal (1 subgoal):
 1. \<lbrakk>k \<le> m; m \<le> n\<rbrakk> \<Longrightarrow> (n choose m) * (m choose k) = (n choose k) * (n - k choose (m - k))
[PROOF STEP]
by simp


[STATEMENT]
lemma Zn_order: "order (Z n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (Z n) = n
[PROOF STEP]
by (unfold integer_mod_group_def integer_group_def order_def, auto)


[STATEMENT]
theorem infinite_nonempty: \<open>infinite A \<Longrightarrow> \<exists>x. x \<in> A\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> \<exists>x. x \<in> A
[PROOF STEP]
by (simp add: ex_in_conv infinite_imp_nonempty)


[STATEMENT]
lemma po_on_predecessors_eq_conv:
  assumes "po_on P A" and "x \<in> A" and "y \<in> A"
  shows "{z\<in>A. P\<^sup>=\<^sup>= z x} = {z\<in>A. P\<^sup>=\<^sup>= z y} \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({z \<in> A. P\<^sup>=\<^sup>= z x} = {z \<in> A. P\<^sup>=\<^sup>= z y}) = (x = y)
[PROOF STEP]
using assms(2-)
    and reflp_on_reflclp [of P A]
    and po_on_imp_antisymp_on [OF \<open>po_on P A\<close>]
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
Restricted_Predicates.reflp_on P\<^sup>=\<^sup>= A
antisymp_on P A

goal (1 subgoal):
 1. ({z \<in> A. P\<^sup>=\<^sup>= z x} = {z \<in> A. P\<^sup>=\<^sup>= z y}) = (x = y)
[PROOF STEP]
unfolding antisymp_on_def reflp_on_def
[PROOF STATE]
proof (prove)
using this:
x \<in> A
y \<in> A
\<forall>a\<in>A. P\<^sup>=\<^sup>= a a
\<forall>a\<in>A. \<forall>b\<in>A. P a b \<and> P b a \<longrightarrow> a = b

goal (1 subgoal):
 1. ({z \<in> A. P\<^sup>=\<^sup>= z x} = {z \<in> A. P\<^sup>=\<^sup>= z y}) = (x = y)
[PROOF STEP]
by blast


[STATEMENT]
lemma HMA_transpose_matrix [transfer_rule]:
  "(HMA_M ===> HMA_M) transpose_mat transpose"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Mod_Type_Connect.HMA_M ===> Mod_Type_Connect.HMA_M) transpose_mat Finite_Cartesian_Product.transpose
[PROOF STEP]
unfolding transpose_mat_def transpose_def HMA_M_def from_hma\<^sub>m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>a b. a = Matrix.mat CARD('c) CARD('b) (\<lambda>(i, j). b $h mod_type_class.from_nat i $h mod_type_class.from_nat j)) ===> (\<lambda>a b. a = Matrix.mat CARD('b) CARD('c) (\<lambda>(i, j). b $h mod_type_class.from_nat i $h mod_type_class.from_nat j))) (\<lambda>A. Matrix.mat (dim_col A) (dim_row A) (\<lambda>(i, j). A $$ (j, i))) (\<lambda>A. \<chi>i j. A $h j $h i)
[PROOF STEP]
by auto


[STATEMENT]
lemma cong_iff_lin_nat: "[a = b] (mod m) \<longleftrightarrow> (\<exists>k1 k2. b + k1 * m = a + k2 * m)"
  for a b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a = b] (mod m) = (\<exists>k1 k2. b + k1 * m = a + k2 * m)
[PROOF STEP]
apply (auto simp add: cong_def nat_mod_eq_iff)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>q1 q2. a + m * q1 = b + m * q2 \<Longrightarrow> \<exists>k1 k2. b + k1 * m = a + k2 * m
 2. \<And>k1 k2. b + k1 * m = a + k2 * m \<Longrightarrow> \<exists>q1 q2. a + m * q1 = b + m * q2
[PROOF STEP]
apply (metis mult.commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k1 k2. b + k1 * m = a + k2 * m \<Longrightarrow> \<exists>q1 q2. a + m * q1 = b + m * q2
[PROOF STEP]
apply (metis mult.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma card_all_edges: "finite A \<Longrightarrow> card (all_edges A) = card A choose 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> card (all_edges A) = card A choose 2
[PROOF STEP]
using all_edges_def
[PROOF STATE]
proof (prove)
using this:
all_edges ?S \<equiv> {e. e \<subseteq> ?S \<and> card e = 2}

goal (1 subgoal):
 1. finite A \<Longrightarrow> card (all_edges A) = card A choose 2
[PROOF STEP]
by (metis (full_types) n_subsets)


[STATEMENT]
lemma cindependent_tensor_op: \<open>cindependent {tensor_op (butterket i j) (butterket k l)| i (j::_::finite) k (l::_::finite). True}\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindependent {butterket i j \<otimes>\<^sub>o butterket k l |i j k l. True}
[PROOF STEP]
unfolding tensor_butter
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindependent {butterket (i, k) (j, l) |i j k l. True}
[PROOF STEP]
using cindependent_butterfly_ket
[PROOF STATE]
proof (prove)
using this:
cindependent {butterket i j |i j. True}

goal (1 subgoal):
 1. cindependent {butterket (i, k) (j, l) |i j k l. True}
[PROOF STEP]
by (smt (z3) Collect_mono_iff complex_vector.independent_mono)


[STATEMENT]
lemma suminf_eq_lim: "suminf f = lim (\<lambda>n. \<Sum>i<n. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. suminf f = lim (\<lambda>n. sum f {..<n})
[PROOF STEP]
by (simp add: suminf_def sums_def lim_def)


[STATEMENT]
lemma poly_pos_greater:
  "(\<forall>x::real. x > a \<longrightarrow> poly p x > 0) \<longleftrightarrow>
    poly_inf p = 1 \<and> (\<forall>x. x > a \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x>a. 0 < poly p x) = (poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0))
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x>a. 0 < poly p x \<Longrightarrow> \<forall>x>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
assume A: "\<forall>x::real. x > a \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (state)
this:
\<forall>x>a. 0 < poly p x

goal (3 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x>a. 0 < poly p x \<Longrightarrow> \<forall>x>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
have "\<And>x. poly p (x::real) > 0 \<Longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < poly p x \<Longrightarrow> poly p x \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0

goal (3 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. \<forall>x>a. 0 < poly p x \<Longrightarrow> \<forall>x>a. poly p x \<noteq> 0
 3. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x>a. 0 < poly p x
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0
[PROOF STEP]
show "\<forall>x::real. x > a \<longrightarrow> poly p x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x>a. 0 < poly p x
0 < poly p ?x \<Longrightarrow> poly p ?x \<noteq> 0

goal (1 subgoal):
 1. \<forall>x>a. poly p x \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x>a. poly p x \<noteq> 0

goal (2 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
from poly_lim_inf
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. sgn (poly ?p x) = poly_inf ?p
[PROOF STEP]
obtain x\<^sub>0 where
      "\<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. sgn (poly ?p x) = poly_inf ?p

goal (1 subgoal):
 1. (\<And>x\<^sub>0. \<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_at_top_linorder)
[PROOF STATE]
proof (state)
this:
\<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p

goal (2 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
hence "poly_inf p = sgn (poly p (max x\<^sub>0 (a + 1)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p

goal (1 subgoal):
 1. poly_inf p = sgn (poly p (max x\<^sub>0 (a + 1)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_inf p = sgn (poly p (max x\<^sub>0 (a + 1)))

goal (2 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_inf p = sgn (poly p (max x\<^sub>0 (a + 1)))

goal (2 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
\<forall>x>a. 0 < poly p x
[PROOF STEP]
have "... = 1"
[PROOF STATE]
proof (prove)
using this:
\<forall>x>a. 0 < poly p x

goal (1 subgoal):
 1. sgn (poly p (max x\<^sub>0 (a + 1))) = 1
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sgn (poly p (max x\<^sub>0 (a + 1))) = 1

goal (2 subgoals):
 1. \<forall>x>a. 0 < poly p x \<Longrightarrow> poly_inf p = 1
 2. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_inf p = 1
[PROOF STEP]
show "poly_inf p = 1"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1

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

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
assume "poly_inf p = 1 \<and> (\<forall>x. x > a \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0)

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
hence A: "poly_inf p = 1" and
        B: "(\<forall>x. x > a \<longrightarrow> poly p x \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0)

goal (1 subgoal):
 1. poly_inf p = 1 &&& \<forall>x>a. poly p x \<noteq> 0
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
poly_inf p = 1
\<forall>x>a. poly p x \<noteq> 0

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
from poly_lim_inf
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. sgn (poly ?p x) = poly_inf ?p
[PROOF STEP]
obtain x\<^sub>0 where
      C: "\<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. sgn (poly ?p x) = poly_inf ?p

goal (1 subgoal):
 1. (\<And>x\<^sub>0. \<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_at_top_linorder)
[PROOF STATE]
proof (state)
this:
\<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
hence "sgn (poly p (max x\<^sub>0 (a+1))) = poly_inf p"
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<ge>x\<^sub>0. sgn (poly p x) = poly_inf p

goal (1 subgoal):
 1. sgn (poly p (max x\<^sub>0 (a + 1))) = poly_inf p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn (poly p (max x\<^sub>0 (a + 1))) = poly_inf p

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
with A
[PROOF STATE]
proof (chain)
picking this:
poly_inf p = 1
sgn (poly p (max x\<^sub>0 (a + 1))) = poly_inf p
[PROOF STEP]
have D: "sgn (poly p (max x\<^sub>0 (a+1))) = 1"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1
sgn (poly p (max x\<^sub>0 (a + 1))) = poly_inf p

goal (1 subgoal):
 1. sgn (poly p (max x\<^sub>0 (a + 1))) = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn (poly p (max x\<^sub>0 (a + 1))) = 1

goal (1 subgoal):
 1. poly_inf p = 1 \<and> (\<forall>x>a. poly p x \<noteq> 0) \<Longrightarrow> \<forall>x>a. 0 < poly p x
[PROOF STEP]
show "\<forall>x. x > a \<longrightarrow> poly p x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x>a. 0 < poly p x
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>x>a. 0 < poly p x) \<Longrightarrow> False
[PROOF STEP]
assume "\<not>(\<forall>x. x > a \<longrightarrow> poly p x > 0)"
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>x>a. 0 < poly p x)

goal (1 subgoal):
 1. \<not> (\<forall>x>a. 0 < poly p x) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<forall>x>a. 0 < poly p x)
[PROOF STEP]
obtain x' where "x' > a" "poly p x' \<le> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>x>a. 0 < poly p x)

goal (1 subgoal):
 1. (\<And>x'. \<lbrakk>a < x'; poly p x' \<le> 0\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: not_less)
[PROOF STATE]
proof (state)
this:
a < x'
poly p x' \<le> 0

goal (1 subgoal):
 1. \<not> (\<forall>x>a. 0 < poly p x) \<Longrightarrow> False
[PROOF STEP]
with A and D
[PROOF STATE]
proof (chain)
picking this:
poly_inf p = 1
sgn (poly p (max x\<^sub>0 (a + 1))) = 1
a < x'
poly p x' \<le> 0
[PROOF STEP]
have E: "sgn (poly p x') \<noteq> sgn (poly p (max x\<^sub>0(a+1)))"
[PROOF STATE]
proof (prove)
using this:
poly_inf p = 1
sgn (poly p (max x\<^sub>0 (a + 1))) = 1
a < x'
poly p x' \<le> 0

goal (1 subgoal):
 1. sgn (poly p x') \<noteq> sgn (poly p (max x\<^sub>0 (a + 1)))
[PROOF STEP]
by (auto simp: sgn_real_def split: if_split_asm)
[PROOF STATE]
proof (state)
this:
sgn (poly p x') \<noteq> sgn (poly p (max x\<^sub>0 (a + 1)))

goal (1 subgoal):
 1. \<not> (\<forall>x>a. 0 < poly p x) \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
apply (cases x' "max x\<^sub>0 (a+1)" rule: linorder_cases)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. x' < max x\<^sub>0 (a + 1) \<Longrightarrow> False
 2. x' = max x\<^sub>0 (a + 1) \<Longrightarrow> False
 3. max x\<^sub>0 (a + 1) < x' \<Longrightarrow> False
[PROOF STEP]
using B E \<open>x' > a\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>x>a. poly p x \<noteq> 0
sgn (poly p x') \<noteq> sgn (poly p (max x\<^sub>0 (a + 1)))
a < x'

goal (3 subgoals):
 1. x' < max x\<^sub>0 (a + 1) \<Longrightarrow> False
 2. x' = max x\<^sub>0 (a + 1) \<Longrightarrow> False
 3. max x\<^sub>0 (a + 1) < x' \<Longrightarrow> False
[PROOF STEP]
apply (force dest!: poly_different_sign_imp_root[of _ _ p])+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x>a. 0 < poly p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem expected_utilty_theorem_form_vnm_utility:
  assumes fnt: "finite outcomes" and "outcomes \<noteq> {}"
  shows "rational_preference (lotteries_on outcomes) \<R> \<and>
         independent_vnm (lotteries_on outcomes) \<R> \<and>
         continuous_vnm (lotteries_on outcomes) \<R> \<longleftrightarrow>
         (\<exists>u. vNM_utility outcomes \<R> u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>) = (\<exists>u. vNM_utility outcomes \<R> u)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R> \<Longrightarrow> \<exists>u. vNM_utility outcomes \<R> u
 2. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
assume "rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>"
[PROOF STATE]
proof (state)
this:
rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>

goal (2 subgoals):
 1. rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R> \<Longrightarrow> \<exists>u. vNM_utility outcomes \<R> u
 2. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
with Von_Neumann_Morgenstern_Utility_Theorem[of outcomes \<R>, OF assms]
[PROOF STATE]
proof (chain)
picking this:
(rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>) = (\<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u))
rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
have
  "(\<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u))"
[PROOF STATE]
proof (prove)
using this:
(rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>) = (\<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u))
rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>

goal (1 subgoal):
 1. \<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>) = (\<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u))
rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
finite outcomes
outcomes \<noteq> {}

goal (1 subgoal):
 1. \<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)

goal (2 subgoals):
 1. rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R> \<Longrightarrow> \<exists>u. vNM_utility outcomes \<R> u
 2. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)
[PROOF STEP]
obtain u where
    u: "ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)"
[PROOF STATE]
proof (prove)
using this:
\<exists>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)

goal (1 subgoal):
 1. (\<And>u. ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)

goal (2 subgoals):
 1. rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R> \<Longrightarrow> \<exists>u. vNM_utility outcomes \<R> u
 2. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
have "vNM_utility outcomes \<R> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vNM_utility outcomes \<R> u
[PROOF STEP]
proof (standard, goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<R> \<subseteq> \<P> outcomes \<times> \<P> outcomes
 2. \<And>p q. \<lbrakk>p \<in> \<P> outcomes; q \<in> \<P> outcomes\<rbrakk> \<Longrightarrow> p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<R> \<subseteq> \<P> outcomes \<times> \<P> outcomes
 2. \<And>p q. \<lbrakk>p \<in> \<P> outcomes; q \<in> \<P> outcomes\<rbrakk> \<Longrightarrow> p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R> \<subseteq> \<P> outcomes \<times> \<P> outcomes
[PROOF STEP]
using u ordinal_utility.relation_subset_crossp
[PROOF STATE]
proof (prove)
using this:
ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)
ordinal_utility ?carrier ?relation ?u \<Longrightarrow> ?relation \<subseteq> ?carrier \<times> ?carrier

goal (1 subgoal):
 1. \<R> \<subseteq> \<P> outcomes \<times> \<P> outcomes
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<R> \<subseteq> \<P> outcomes \<times> \<P> outcomes

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>p \<in> \<P> outcomes; q \<in> \<P> outcomes\<rbrakk> \<Longrightarrow> p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p q. \<lbrakk>p \<in> \<P> outcomes; q \<in> \<P> outcomes\<rbrakk> \<Longrightarrow> p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
case (2 p q)
[PROOF STATE]
proof (state)
this:
p \<in> \<P> outcomes
q \<in> \<P> outcomes

goal (1 subgoal):
 1. \<And>p q. \<lbrakk>p \<in> \<P> outcomes; q \<in> \<P> outcomes\<rbrakk> \<Longrightarrow> p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> \<P> outcomes
q \<in> \<P> outcomes
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
p \<in> \<P> outcomes
q \<in> \<P> outcomes

goal (1 subgoal):
 1. p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
using assms(2) expected_value_is_utility_function fnt u
[PROOF STATE]
proof (prove)
using this:
p \<in> \<P> outcomes
q \<in> \<P> outcomes
outcomes \<noteq> {}
\<lbrakk>finite ?outcomes; ?outcomes \<noteq> {}; ?x \<in> \<P> ?outcomes; ?y \<in> \<P> ?outcomes; ordinal_utility (\<P> ?outcomes) ?\<R> (\<lambda>x. measure_pmf.expectation x ?u)\<rbrakk> \<Longrightarrow> (measure_pmf.expectation ?y ?u \<le> measure_pmf.expectation ?x ?u) = ?x \<succeq>[?\<R>] ?y
finite outcomes
ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)

goal (1 subgoal):
 1. p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
p \<succeq>[\<R>] q = (measure_pmf.expectation q u \<le> measure_pmf.expectation p u)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vNM_utility outcomes \<R> u

goal (2 subgoals):
 1. rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R> \<Longrightarrow> \<exists>u. vNM_utility outcomes \<R> u
 2. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vNM_utility outcomes \<R> u
[PROOF STEP]
show "\<exists>u. vNM_utility outcomes \<R> u"
[PROOF STATE]
proof (prove)
using this:
vNM_utility outcomes \<R> u

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>u. vNM_utility outcomes \<R> u

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
assume a: "\<exists>u. vNM_utility outcomes \<R> u"
[PROOF STATE]
proof (state)
this:
\<exists>u. vNM_utility outcomes \<R> u

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>u. vNM_utility outcomes \<R> u
[PROOF STEP]
have "rational_preference (\<P> outcomes) \<R>"
[PROOF STATE]
proof (prove)
using this:
\<exists>u. vNM_utility outcomes \<R> u

goal (1 subgoal):
 1. rational_preference (\<P> outcomes) \<R>
[PROOF STEP]
using vnm_utility_imp_reational_prefs
[PROOF STATE]
proof (prove)
using this:
\<exists>u. vNM_utility outcomes \<R> u
vNM_utility ?outcomes ?relation ?u \<Longrightarrow> rational_preference (\<P> ?outcomes) ?relation

goal (1 subgoal):
 1. rational_preference (\<P> outcomes) \<R>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rational_preference (\<P> outcomes) \<R>

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rational_preference (\<P> outcomes) \<R>

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
have "independent_vnm (\<P> outcomes) \<R>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent_vnm (\<P> outcomes) \<R>
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<exists>u. vNM_utility outcomes \<R> u

goal (1 subgoal):
 1. independent_vnm (\<P> outcomes) \<R>
[PROOF STEP]
by (meson assms(2) fnt vNM_utility_implies_independence vnm_utility_is_ordinal_utility)
[PROOF STATE]
proof (state)
this:
independent_vnm (\<P> outcomes) \<R>

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
independent_vnm (\<P> outcomes) \<R>

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
have "continuous_vnm (\<P> outcomes) \<R>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<exists>u. vNM_utility outcomes \<R> u

goal (1 subgoal):
 1. continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
by (meson assms(2) fnt vNM_utilty_implies_continuity vnm_utility_is_ordinal_utility)
[PROOF STATE]
proof (state)
this:
continuous_vnm (\<P> outcomes) \<R>

goal (1 subgoal):
 1. \<exists>u. vNM_utility outcomes \<R> u \<Longrightarrow> rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rational_preference (\<P> outcomes) \<R>
independent_vnm (\<P> outcomes) \<R>
continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
show "rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>"
[PROOF STATE]
proof (prove)
using this:
rational_preference (\<P> outcomes) \<R>
independent_vnm (\<P> outcomes) \<R>
continuous_vnm (\<P> outcomes) \<R>

goal (1 subgoal):
 1. rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rational_preference (\<P> outcomes) \<R> \<and> independent_vnm (\<P> outcomes) \<R> \<and> continuous_vnm (\<P> outcomes) \<R>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem euler_maclaurin_strong_nat:
  assumes ab: "a \<le> b"
  defines "S \<equiv> (\<Sum>k=a..b. f (real k))"
  shows "S = F (real b) + C + (\<Sum>i<N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real b)) -
               EM_remainder N (fs N) (int b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = F (real b) + C + (\<Sum>i<N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real b)) - EM_remainder N (fs N) (int b)
[PROOF STEP]
using euler_maclaurin_strong_int[of "int b"]
[PROOF STATE]
proof (prove)
using this:
int a \<le> int b \<Longrightarrow> (\<Sum>k = int a..int b. f (real_of_int k)) = F (real_of_int (int b)) + C + (\<Sum>i<N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real_of_int (int b))) - EM_remainder N (fs N) (int b)

goal (1 subgoal):
 1. S = F (real b) + C + (\<Sum>i<N. (bernoulli' (Suc i) / fact (Suc i)) *\<^sub>R fs i (real b)) - EM_remainder N (fs N) (int b)
[PROOF STEP]
by (simp add: assms sum_atLeastAtMost_of_int_nat_transfer)


[STATEMENT]
lemma fac_Suc: "Suc n! =  (Suc n) * (n!)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc n! = Suc n * n!
[PROOF STEP]
by(simp add: fac.simps)


[STATEMENT]
lemma face_of_subset: "\<lbrakk>F face_of S; F \<subseteq> T; T \<subseteq> S\<rbrakk> \<Longrightarrow> F face_of T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F face_of S; F \<subseteq> T; T \<subseteq> S\<rbrakk> \<Longrightarrow> F face_of T
[PROOF STEP]
unfolding face_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<subseteq> S \<and> convex F \<and> (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>x\<in>F. x \<in> open_segment a b \<longrightarrow> a \<in> F \<and> b \<in> F); F \<subseteq> T; T \<subseteq> S\<rbrakk> \<Longrightarrow> F \<subseteq> T \<and> convex F \<and> (\<forall>a\<in>T. \<forall>b\<in>T. \<forall>x\<in>F. x \<in> open_segment a b \<longrightarrow> a \<in> F \<and> b \<in> F)
[PROOF STEP]
by (safe; blast)


[STATEMENT]
lemma wp_actFF:
     "wp (range (\<lambda>x::int. (x, x + 1))) (atLeast k) = atLeast (k - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wp (range (\<lambda>x. (x, x + 1))) {k..} = {k - 1..}
[PROOF STEP]
by (force simp add: wp_def)


[STATEMENT]
lemma fls_deriv_lr_inverse_comm:
  fixes   x y :: "'a::comm_ring_1"
  assumes "x * f $$ fls_subdegree f = 1"
  shows   "fls_deriv (fls_left_inverse f x) = - fls_deriv f * (fls_left_inverse f x)\<^sup>2"
  and     "fls_deriv (fls_right_inverse f x) = - fls_deriv f * (fls_right_inverse f x)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv (fls_left_inverse f x) = - fls_deriv f * (fls_left_inverse f x)\<^sup>2 &&& fls_deriv (fls_right_inverse f x) = - fls_deriv f * (fls_right_inverse f x)\<^sup>2
[PROOF STEP]
using   assms fls_deriv_lr_inverse[of x f x]
[PROOF STATE]
proof (prove)
using this:
x * f $$ fls_subdegree f = (1::'a)
\<lbrakk>x * f $$ fls_subdegree f = (1::'a); f $$ fls_subdegree f * x = (1::'a)\<rbrakk> \<Longrightarrow> fls_deriv (fls_left_inverse f x) = - fls_left_inverse f x * fls_deriv f * fls_left_inverse f x
\<lbrakk>x * f $$ fls_subdegree f = (1::'a); f $$ fls_subdegree f * x = (1::'a)\<rbrakk> \<Longrightarrow> fls_deriv (fls_right_inverse f x) = - fls_right_inverse f x * fls_deriv f * fls_right_inverse f x

goal (1 subgoal):
 1. fls_deriv (fls_left_inverse f x) = - fls_deriv f * (fls_left_inverse f x)\<^sup>2 &&& fls_deriv (fls_right_inverse f x) = - fls_deriv f * (fls_right_inverse f x)\<^sup>2
[PROOF STEP]
by      (simp_all add: mult.commute power2_eq_square)


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


[STATEMENT]
lemma monoseq_le:
  "monoseq a \<Longrightarrow> a \<longlonglongrightarrow> x \<Longrightarrow>
    (\<forall>n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n) \<or>
    (\<forall>n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m)"
  for x :: "'a::linorder_topology"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>monoseq a; a \<longlonglongrightarrow> x\<rbrakk> \<Longrightarrow> (\<forall>n. a n \<le> x) \<and> (\<forall>m n. m \<le> n \<longrightarrow> a m \<le> a n) \<or> (\<forall>n. x \<le> a n) \<and> (\<forall>m n. m \<le> n \<longrightarrow> a n \<le> a m)
[PROOF STEP]
by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff)


[STATEMENT]
theorem factorization_exists: "n > 0 \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@proof
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@strong_induct n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@case "n = 1" @with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@have "n = (\<Prod>i\<in># {#}. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@end
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@case "prime n" @with
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@have "n = (\<Prod>i\<in># {#n#}. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@end
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@obtain m k where "n = m * k" "1 < m" "m < n" "1 < k" "k < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@apply_induct_hyp m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@obtain M where "(\<forall>p\<in>#M. prime p)" "m = (\<Prod>i\<in>#M. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@apply_induct_hyp k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@obtain K where "(\<forall>p\<in>#K. prime p)" "k = (\<Prod>i\<in>#K. i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@have "n = (\<Prod>i\<in>#(M+K). i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<exists>M. (\<forall>p\<in>#M. prime p) \<and> n = (\<Prod>i\<in>#M. i)
[PROOF STEP]
@qed


[STATEMENT]
lemma vector_derivative_diff_chain_within:
  assumes Df: "(f has_vector_derivative f') (at x within S)"
     and Dg: "(g has_derivative g') (at (f x) within f`S)"
  shows "((g \<circ> f) has_vector_derivative (g' f')) (at x within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g \<circ> f has_vector_derivative g' f') (at x within S)
[PROOF STEP]
using diff_chain_within[OF Df[unfolded has_vector_derivative_def] Dg]
  linear.scaleR[OF has_derivative_linear[OF Dg]]
[PROOF STATE]
proof (prove)
using this:
(g \<circ> f has_derivative g' \<circ> (\<lambda>x. x *\<^sub>R f')) (at x within S)
g' (?r *\<^sub>R ?b) = ?r *\<^sub>R g' ?b

goal (1 subgoal):
 1. (g \<circ> f has_vector_derivative g' f') (at x within S)
[PROOF STEP]
unfolding has_vector_derivative_def o_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. g (f x)) has_derivative (\<lambda>x. g' (x *\<^sub>R f'))) (at x within S)
g' (?r *\<^sub>R ?b) = ?r *\<^sub>R g' ?b

goal (1 subgoal):
 1. ((\<lambda>x. g (f x)) has_derivative (\<lambda>x. x *\<^sub>R g' f')) (at x within S)
[PROOF STEP]
by (auto simp: o_def mult.commute has_vector_derivative_def)


[STATEMENT]
lemma uminus_sum_list: "- sum_list as = sum_list (map uminus (rev as))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - sum_list as = sum_list (map uminus (rev as))
[PROOF STEP]
by (induct as) (auto simp add: minus_add)


[STATEMENT]
lemma tarski_s_implies_euclid_s_parallel_postulate:
  assumes "TarskiSParallelPostulate"
  shows "EuclidSParallelPostulate"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. EuclidSParallelPostulate
[PROOF STEP]
by (simp add: assms euclid_5__original_euclid tarski_s_euclid_implies_euclid_5)


[STATEMENT]
lemma rtranclp_mult_poly_p_mult_ideal_final:
  \<open>(mult_poly_p q)\<^sup>*\<^sup>* (p, {#}) ({#}, r) \<Longrightarrow>
    (polynomial_of_mset r) - (polynomial_of_mset p * polynomial_of_mset q)
       \<in> ideal polynomial_bool\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mult_poly_p q)\<^sup>*\<^sup>* (p, {#}) ({#}, r) \<Longrightarrow> polynomial_of_mset r - polynomial_of_mset p * polynomial_of_mset q \<in> More_Modules.ideal polynomial_bool
[PROOF STEP]
by (drule rtranclp_mult_poly_p_mult_ideal) auto


[STATEMENT]
lemma large_Gromov_product_approx:
  assumes "(M::ereal) < \<infinity>"
  shows "\<exists>e D. e > 0 \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> extended_Gromov_distance x (to_Gromov_completion basepoint) \<ge> D \<longrightarrow> extended_Gromov_product_at basepoint x y \<ge> M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
obtain M0::real where "M \<le> ereal M0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>M0. M \<le> ereal M0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
M < \<infinity>

goal (1 subgoal):
 1. (\<And>M0. M \<le> ereal M0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases M, auto)
[PROOF STATE]
proof (state)
this:
M \<le> ereal M0

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
define e::real where "e = exp(-epsilonG(TYPE('a)) * M0)/2"
[PROOF STATE]
proof (state)
this:
e = exp (- epsilonG TYPE('a) * M0) / 2

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
define D::ereal where "D = ereal M0 + 4"
[PROOF STATE]
proof (state)
this:
D = ereal M0 + 4

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
have "e > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e
[PROOF STEP]
unfolding e_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < exp (- epsilonG TYPE('a) * M0) / 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
have "D < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D < \<infinity>
[PROOF STEP]
unfolding D_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal M0 + 4 < \<infinity>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
D < \<infinity>

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
D < \<infinity>

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
have "extended_Gromov_product_at basepoint x y \<ge> M0"
    if "dist x y \<le> e" "extended_Gromov_distance x (to_Gromov_completion basepoint) \<ge> D" for x y::"'a Gromov_completion"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
proof (cases "esqrt(extended_Gromov_distance x y) \<le> eexp (- epsilonG(TYPE('a)) * extended_Gromov_product_at basepoint x y)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
 2. \<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)

goal (2 subgoals):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
 2. \<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
[PROOF STEP]
have "eexp (- epsilonG(TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> 2 * ereal(dist x y)"
[PROOF STATE]
proof (prove)
using this:
\<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)

goal (1 subgoal):
 1. eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> 2 * ereal (dist x y)
[PROOF STEP]
using Gromov_completion_dist_comparison(3)[of x y]
[PROOF STATE]
proof (prove)
using this:
\<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> 2 * ereal (dist x y)
[PROOF STEP]
unfolding min_def
[PROOF STATE]
proof (prove)
using this:
\<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
(if esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) then esqrt (extended_Gromov_distance x y) else eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> 2 * ereal (dist x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> 2 * ereal (dist x y)

goal (2 subgoals):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
 2. \<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> 2 * ereal (dist x y)

goal (2 subgoals):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
 2. \<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
have "... \<le> exp(-epsilonG(TYPE('a)) * M0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * ereal (dist x y) \<le> ereal (exp (- epsilonG TYPE('a) * M0))
[PROOF STEP]
using \<open>dist x y \<le> e\<close>
[PROOF STATE]
proof (prove)
using this:
dist x y \<le> e

goal (1 subgoal):
 1. 2 * ereal (dist x y) \<le> ereal (exp (- epsilonG TYPE('a) * M0))
[PROOF STEP]
unfolding e_def
[PROOF STATE]
proof (prove)
using this:
dist x y \<le> exp (- epsilonG TYPE('a) * M0) / 2

goal (1 subgoal):
 1. 2 * ereal (dist x y) \<le> ereal (exp (- epsilonG TYPE('a) * M0))
[PROOF STEP]
by (auto simp add: numeral_mult_ennreal)
[PROOF STATE]
proof (state)
this:
2 * ereal (dist x y) \<le> ereal (exp (- epsilonG TYPE('a) * M0))

goal (2 subgoals):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
 2. \<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> ereal (exp (- epsilonG TYPE('a) * M0))
[PROOF STEP]
have "ereal M0 \<le> extended_Gromov_product_at basepoint x y"
[PROOF STATE]
proof (prove)
using this:
eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> ereal (exp (- epsilonG TYPE('a) * M0))

goal (1 subgoal):
 1. ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
unfolding eexp_ereal[symmetric]
[PROOF STATE]
proof (prove)
using this:
eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<le> eexp (ereal (- epsilonG TYPE('a) * M0))

goal (1 subgoal):
 1. ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
apply (simp only: eexp_le_eexp_iff_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y \<le> ereal (- epsilonG TYPE('a) * M0) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
unfolding times_ereal.simps(1)[symmetric] uminus_ereal.simps(1)[symmetric] ereal_mult_minus_left ereal_minus_le_minus
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (epsilonG TYPE('a)) * ereal M0 \<le> ereal (epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
using ereal_mult_le_mult_iff[of "ereal (epsilonG TYPE('a))"]
[PROOF STATE]
proof (prove)
using this:
\<bar>ereal (epsilonG TYPE('a))\<bar> \<noteq> \<infinity> \<Longrightarrow> (ereal (epsilonG TYPE('a)) * ?a \<le> ereal (epsilonG TYPE('a)) * ?b) = ((0 < ereal (epsilonG TYPE('a)) \<longrightarrow> ?a \<le> ?b) \<and> (ereal (epsilonG TYPE('a)) < 0 \<longrightarrow> ?b \<le> ?a))

goal (1 subgoal):
 1. ereal (epsilonG TYPE('a)) * ereal M0 \<le> ereal (epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ereal (epsilonG TYPE('a) * M0) \<le> ereal (epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y; \<And>a b. (ereal (epsilonG TYPE('a)) * a \<le> ereal (epsilonG TYPE('a)) * b) = (a \<le> b \<and> (epsilonG TYPE('a) < 0 \<longrightarrow> b \<le> a))\<rbrakk> \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
by (metis \<open>\<And>r p. ereal (r * p) = ereal r * ereal p\<close>)
[PROOF STATE]
proof (state)
this:
ereal M0 \<le> extended_Gromov_product_at basepoint x y

goal (2 subgoals):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
 2. \<not> esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
show "M0 \<le> extended_Gromov_product_at basepoint x y"
[PROOF STATE]
proof (prove)
using this:
ereal M0 \<le> extended_Gromov_product_at basepoint x y

goal (1 subgoal):
 1. ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ereal M0 \<le> extended_Gromov_product_at basepoint x y

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
[PROOF STEP]
have "esqrt(extended_Gromov_distance x y) \<le> 2 * ereal(dist x y)"
[PROOF STATE]
proof (prove)
using this:
esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> 2 * ereal (dist x y)
[PROOF STEP]
using Gromov_completion_dist_comparison(3)[of x y]
[PROOF STATE]
proof (prove)
using this:
esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
min (esqrt (extended_Gromov_distance x y)) (eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> 2 * ereal (dist x y)
[PROOF STEP]
unfolding min_def
[PROOF STATE]
proof (prove)
using this:
esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)
(if esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) then esqrt (extended_Gromov_distance x y) else eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y)) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> 2 * ereal (dist x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
esqrt (extended_Gromov_distance x y) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
esqrt (extended_Gromov_distance x y) \<le> 2 * ereal (dist x y)

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
have "... \<le> esqrt 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 * ereal (dist x y) \<le> esqrt 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 * ereal (dist x y) \<le> esqrt 4

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
esqrt (extended_Gromov_distance x y) \<le> esqrt 4
[PROOF STEP]
have *: "extended_Gromov_distance x y \<le> 4"
[PROOF STATE]
proof (prove)
using this:
esqrt (extended_Gromov_distance x y) \<le> esqrt 4

goal (1 subgoal):
 1. extended_Gromov_distance x y \<le> 4
[PROOF STEP]
unfolding esqrt_le
[PROOF STATE]
proof (prove)
using this:
extended_Gromov_distance x y \<le> 0 \<or> extended_Gromov_distance x y \<le> 4

goal (1 subgoal):
 1. extended_Gromov_distance x y \<le> 4
[PROOF STEP]
using antisym
[PROOF STATE]
proof (prove)
using this:
extended_Gromov_distance x y \<le> 0 \<or> extended_Gromov_distance x y \<le> 4
\<lbrakk>?a \<le> ?b; ?b \<le> ?a\<rbrakk> \<Longrightarrow> ?a = ?b

goal (1 subgoal):
 1. extended_Gromov_distance x y \<le> 4
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
extended_Gromov_distance x y \<le> 4

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
have "ereal M0+4 \<le> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal M0 + 4 \<le> D
[PROOF STEP]
unfolding D_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal M0 + 4 \<le> ereal M0 + 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ereal M0 + 4 \<le> D

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ereal M0 + 4 \<le> D

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
have "... \<le> extended_Gromov_product_at basepoint x x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D \<le> extended_Gromov_product_at basepoint x x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
dist x y \<le> e
D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint)

goal (1 subgoal):
 1. D \<le> extended_Gromov_product_at basepoint x x
[PROOF STEP]
by (auto simp add: extended_Gromov_distance_commute)
[PROOF STATE]
proof (state)
this:
D \<le> extended_Gromov_product_at basepoint x x

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
D \<le> extended_Gromov_product_at basepoint x x

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
have "... \<le> extended_Gromov_product_at basepoint x y + extended_Gromov_distance x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_Gromov_product_at basepoint x x \<le> extended_Gromov_product_at basepoint x y + extended_Gromov_distance x y
[PROOF STEP]
by (rule extended_Gromov_product_at_diff3[of basepoint x x y])
[PROOF STATE]
proof (state)
this:
extended_Gromov_product_at basepoint x x \<le> extended_Gromov_product_at basepoint x y + extended_Gromov_distance x y

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
extended_Gromov_product_at basepoint x x \<le> extended_Gromov_product_at basepoint x y + extended_Gromov_distance x y

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
have "... \<le> extended_Gromov_product_at basepoint x y + 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_Gromov_product_at basepoint x y + extended_Gromov_distance x y \<le> extended_Gromov_product_at basepoint x y + 4
[PROOF STEP]
by (intro mono_intros *)
[PROOF STATE]
proof (state)
this:
extended_Gromov_product_at basepoint x y + extended_Gromov_distance x y \<le> extended_Gromov_product_at basepoint x y + 4

goal (1 subgoal):
 1. esqrt (extended_Gromov_distance x y) \<le> eexp (ereal (- epsilonG TYPE('a)) * extended_Gromov_product_at basepoint x y) \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ereal M0 + 4 \<le> extended_Gromov_product_at basepoint x y + 4
[PROOF STEP]
show "M0 \<le> extended_Gromov_product_at basepoint x y"
[PROOF STATE]
proof (prove)
using this:
ereal M0 + 4 \<le> extended_Gromov_product_at basepoint x y + 4

goal (1 subgoal):
 1. ereal M0 \<le> extended_Gromov_product_at basepoint x y
[PROOF STEP]
by (metis (no_types, lifting) PInfty_neq_ereal(1) add.commute add_nonneg_nonneg ereal_add_strict_mono ereal_le_distrib mult_2_ereal not_le numeral_Bit0 numeral_eq_ereal one_add_one zero_less_one_ereal)
[PROOF STATE]
proof (state)
this:
ereal M0 \<le> extended_Gromov_product_at basepoint x y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>dist ?x ?y \<le> e; D \<le> extended_Gromov_distance ?x (to_Gromov_completion basepoint)\<rbrakk> \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint ?x ?y

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 < e
D < \<infinity>
\<lbrakk>dist ?x ?y \<le> e; D \<le> extended_Gromov_distance ?x (to_Gromov_completion basepoint)\<rbrakk> \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint ?x ?y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < e
D < \<infinity>
\<lbrakk>dist ?x ?y \<le> e; D \<le> extended_Gromov_distance ?x (to_Gromov_completion basepoint)\<rbrakk> \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint ?x ?y

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
using order_trans[OF \<open>M \<le> ereal M0\<close>]
[PROOF STATE]
proof (prove)
using this:
0 < e
D < \<infinity>
\<lbrakk>dist ?x ?y \<le> e; D \<le> extended_Gromov_distance ?x (to_Gromov_completion basepoint)\<rbrakk> \<Longrightarrow> ereal M0 \<le> extended_Gromov_product_at basepoint ?x ?y
ereal M0 \<le> ?z \<Longrightarrow> M \<le> ?z

goal (1 subgoal):
 1. \<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>e D. 0 < e \<and> D < \<infinity> \<and> (\<forall>x y. dist x y \<le> e \<longrightarrow> D \<le> extended_Gromov_distance x (to_Gromov_completion basepoint) \<longrightarrow> M \<le> extended_Gromov_product_at basepoint x y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cot_of_real: "of_real (cot x) = (cot (of_real x) :: 'a::{real_normed_field,banach})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_real (cot x) = cot (of_real x)
[PROOF STEP]
by (simp add: cot_def sin_of_real cos_of_real)


[STATEMENT]
lemma quad_form_bilinear_form:
  shows "quad_form v H = bilinear_form v v H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quad_form v H = bilinear_form v v H
[PROOF STEP]
by simp


[STATEMENT]
lemma MM_Rel_MV_Rel_col:  "MM_Rel A B \<Longrightarrow> j < dim_col A \<Longrightarrow> MV_Rel (col A j) (col B j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>MM_Rel A B; j < dim_col A\<rbrakk> \<Longrightarrow> MV_Rel (col A j) (col B j)
[PROOF STEP]
unfolding MM_Rel_def MV_Rel_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.mat_mod A = to_int_mat B; j < dim_col A\<rbrakk> \<Longrightarrow> vec_mod (col A j) = to_int_vec (col B j)
[PROOF STEP]
using  index_map_mat(3) mat_mod_dim(2) mat_mod_vec_mod_col col_map_mat
[PROOF STATE]
proof (prove)
using this:
dim_col (map_mat ?f ?A) = dim_col ?A
dim_col (local.mat_mod ?M) = dim_col ?M
?j < dim_col ?A \<Longrightarrow> col (local.mat_mod ?A) ?j = vec_mod (col ?A ?j)
?j < dim_col ?A \<Longrightarrow> col (map_mat ?f ?A) ?j = map_vec ?f (col ?A ?j)

goal (1 subgoal):
 1. \<lbrakk>local.mat_mod A = to_int_mat B; j < dim_col A\<rbrakk> \<Longrightarrow> vec_mod (col A j) = to_int_vec (col B j)
[PROOF STEP]
by (metis)


[STATEMENT]
lemma prime_dvd_prod_iff: "finite A \<Longrightarrow> prime p \<Longrightarrow> p dvd prod f A \<longleftrightarrow> (\<exists>x\<in>A. p dvd f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; prime p\<rbrakk> \<Longrightarrow> (p dvd prod f A) = (\<exists>x\<in>A. p dvd f x)
[PROOF STEP]
by (auto simp: prime_dvd_prod_mset_iff prod_unfold_prod_mset)


[STATEMENT]
lemma smult_power: "smult (c ^ n) (p ^ n) = (smult c p) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
have "smult (c ^ n) (p ^ n) = [:c ^ n:] * p ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = [:c ^ n:] * p ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
smult (c ^ n) (p ^ n) = [:c ^ n:] * p ^ n

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult (c ^ n) (p ^ n) = [:c ^ n:] * p ^ n

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
have "[:c:] ^ n = [:c ^ n:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:c:] ^ n = [:c ^ n:]
[PROOF STEP]
by (induction n) (auto simp: mult_ac)
[PROOF STATE]
proof (state)
this:
[:c:] ^ n = [:c ^ n:]

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
hence "[:c ^ n:] = [:c:] ^ n"
[PROOF STATE]
proof (prove)
using this:
[:c:] ^ n = [:c ^ n:]

goal (1 subgoal):
 1. [:c ^ n:] = [:c:] ^ n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
[:c ^ n:] = [:c:] ^ n

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[:c ^ n:] = [:c:] ^ n

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
have "\<dots> * p ^ n = ([:c:] * p) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:c:] ^ n * p ^ n = ([:c:] * p) ^ n
[PROOF STEP]
by (rule power_mult_distrib [symmetric])
[PROOF STATE]
proof (state)
this:
[:c:] ^ n * p ^ n = ([:c:] * p) ^ n

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[:c:] ^ n * p ^ n = ([:c:] * p) ^ n

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
have "\<dots> = (smult c p) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([:c:] * p) ^ n = smult c p ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
([:c:] * p) ^ n = smult c p ^ n

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

goal (1 subgoal):
 1. smult (c ^ n) (p ^ n) = smult c p ^ n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
smult (c ^ n) (p ^ n) = smult c p ^ n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_n_lists:
  assumes "distinct xs"
  shows "distinct (List.n_lists n xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (List.n_lists n xs)
[PROOF STEP]
proof (rule card_distinct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (set (List.n_lists n xs)) = length (List.n_lists n xs)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
distinct xs
[PROOF STEP]
have card_length: "card (set xs) = length xs"
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. card (set xs) = length xs
[PROOF STEP]
by (rule distinct_card)
[PROOF STATE]
proof (state)
this:
card (set xs) = length xs

goal (1 subgoal):
 1. card (set (List.n_lists n xs)) = length (List.n_lists n xs)
[PROOF STEP]
have "card (set (List.n_lists n xs)) = card (set xs) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set (List.n_lists n xs)) = card (set xs) ^ n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (set (List.n_lists 0 xs)) = card (set xs) ^ 0
 2. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card (set (List.n_lists 0 xs)) = card (set xs) ^ 0
 2. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set (List.n_lists 0 xs)) = card (set xs) ^ 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (set (List.n_lists 0 xs)) = card (set xs) ^ 0

goal (1 subgoal):
 1. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
card (set (List.n_lists n xs)) = card (set xs) ^ n

goal (1 subgoal):
 1. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (set (List.n_lists n xs)) = card (set xs) ^ n

goal (1 subgoal):
 1. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
have "card (\<Union>ys\<in>set (List.n_lists n xs). (\<lambda>y. y # ys) ` set xs)
      = (\<Sum>ys\<in>set (List.n_lists n xs). card ((\<lambda>y. y # ys) ` set xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (\<Union>ys\<in>set (List.n_lists n xs). (\<lambda>y. y # ys) ` set xs) = (\<Sum>ys\<in>set (List.n_lists n xs). card ((\<lambda>y. y # ys) ` set xs))
[PROOF STEP]
by (rule card_UN_disjoint) auto
[PROOF STATE]
proof (state)
this:
card (\<Union>ys\<in>set (List.n_lists n xs). (\<lambda>y. y # ys) ` set xs) = (\<Sum>ys\<in>set (List.n_lists n xs). card ((\<lambda>y. y # ys) ` set xs))

goal (1 subgoal):
 1. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (\<Union>ys\<in>set (List.n_lists n xs). (\<lambda>y. y # ys) ` set xs) = (\<Sum>ys\<in>set (List.n_lists n xs). card ((\<lambda>y. y # ys) ` set xs))

goal (1 subgoal):
 1. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
have "\<And>ys. card ((\<lambda>y. y # ys) ` set xs) = card (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ys. card ((\<lambda>y. y # ys) ` set xs) = card (set xs)
[PROOF STEP]
by (rule card_image) (simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
card ((\<lambda>y. y # ?ys) ` set xs) = card (set xs)

goal (1 subgoal):
 1. \<And>n. card (set (List.n_lists n xs)) = card (set xs) ^ n \<Longrightarrow> card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (set (List.n_lists n xs)) = card (set xs) ^ n
card (\<Union>ys\<in>set (List.n_lists n xs). (\<lambda>y. y # ys) ` set xs) = (\<Sum>ys\<in>set (List.n_lists n xs). card ((\<lambda>y. y # ys) ` set xs))
card ((\<lambda>y. y # ?ys) ` set xs) = card (set xs)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card (set (List.n_lists n xs)) = card (set xs) ^ n
card (\<Union>ys\<in>set (List.n_lists n xs). (\<lambda>y. y # ys) ` set xs) = (\<Sum>ys\<in>set (List.n_lists n xs). card ((\<lambda>y. y # ys) ` set xs))
card ((\<lambda>y. y # ?ys) ` set xs) = card (set xs)

goal (1 subgoal):
 1. card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (set (List.n_lists (Suc n) xs)) = card (set xs) ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card (set (List.n_lists n xs)) = card (set xs) ^ n

goal (1 subgoal):
 1. card (set (List.n_lists n xs)) = length (List.n_lists n xs)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (set (List.n_lists n xs)) = card (set xs) ^ n

goal (1 subgoal):
 1. card (set (List.n_lists n xs)) = length (List.n_lists n xs)
[PROOF STEP]
have "\<dots> = length xs ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set xs) ^ n = length xs ^ n
[PROOF STEP]
by (simp add: card_length)
[PROOF STATE]
proof (state)
this:
card (set xs) ^ n = length xs ^ n

goal (1 subgoal):
 1. card (set (List.n_lists n xs)) = length (List.n_lists n xs)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card (set (List.n_lists n xs)) = length xs ^ n
[PROOF STEP]
show "card (set (List.n_lists n xs)) = length (List.n_lists n xs)"
[PROOF STATE]
proof (prove)
using this:
card (set (List.n_lists n xs)) = length xs ^ n

goal (1 subgoal):
 1. card (set (List.n_lists n xs)) = length (List.n_lists n xs)
[PROOF STEP]
by (simp add: length_n_lists)
[PROOF STATE]
proof (state)
this:
card (set (List.n_lists n xs)) = length (List.n_lists n xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem gt_irrefl: "\<not> s >\<^sub>t s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> s >\<^sub>t s
[PROOF STEP]
unfolding basic_gt_iff_gt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> local.kbo_std.gt s s
[PROOF STEP]
by (rule kbo_std.gt_irrefl[simplified])


[STATEMENT]
lemma covector_inf_comp_1:
  assumes "vector x"
    shows "(y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
have "(y \<sqinter> x\<^sup>T) * z \<le> (y \<sqinter> x\<^sup>T) * (z \<sqinter> ((y\<^sup>T \<sqinter> x) * top))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * z \<le> (y \<sqinter> x\<^sup>T) * (z \<sqinter> (y\<^sup>T \<sqinter> x) * top)
[PROOF STEP]
by (metis inf_top_right dedekind_1 conv_dist_inf conv_involutive)
[PROOF STATE]
proof (state)
this:
(y \<sqinter> x\<^sup>T) * z \<le> (y \<sqinter> x\<^sup>T) * (z \<sqinter> (y\<^sup>T \<sqinter> x) * top)

goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(y \<sqinter> x\<^sup>T) * z \<le> (y \<sqinter> x\<^sup>T) * (z \<sqinter> (y\<^sup>T \<sqinter> x) * top)

goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
have "... \<le> (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * (z \<sqinter> (y\<^sup>T \<sqinter> x) * top) \<le> (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
by (metis assms comp_left_isotone comp_right_isotone inf_le2 inf_mono order_refl inf_commute)
[PROOF STATE]
proof (state)
this:
(y \<sqinter> x\<^sup>T) * (z \<sqinter> (y\<^sup>T \<sqinter> x) * top) \<le> (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)

goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(y \<sqinter> x\<^sup>T) * z \<le> (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(y \<sqinter> x\<^sup>T) * z \<le> (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)

goal (1 subgoal):
 1. (y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)
[PROOF STEP]
by (simp add: comp_right_isotone order.antisym)
[PROOF STATE]
proof (state)
this:
(y \<sqinter> x\<^sup>T) * z = (y \<sqinter> x\<^sup>T) * (x \<sqinter> z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma elts_vcard_vsum_eqpoll: "elts (vcard (i \<Uplus> j)) \<approx> Inl ` elts i \<union> Inr ` elts j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (vcard (i \<Uplus> j)) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. elts (vcard (i \<Uplus> j)) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
[PROOF STEP]
have "elts (i \<Uplus> j) \<approx> Inl ` elts i \<union> Inr ` elts j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (i \<Uplus> j) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
[PROOF STEP]
by (simp add: elts_vsum)
[PROOF STATE]
proof (state)
this:
elts (i \<Uplus> j) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j

goal (1 subgoal):
 1. elts (vcard (i \<Uplus> j)) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
elts (i \<Uplus> j) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
elts (i \<Uplus> j) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j

goal (1 subgoal):
 1. elts (vcard (i \<Uplus> j)) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
[PROOF STEP]
using cardinal_eqpoll eqpoll_trans
[PROOF STATE]
proof (prove)
using this:
elts (i \<Uplus> j) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
elts (vcard ?a) \<approx> elts ?a
\<lbrakk>?A \<approx> ?B; ?B \<approx> ?C\<rbrakk> \<Longrightarrow> ?A \<approx> ?C

goal (1 subgoal):
 1. elts (vcard (i \<Uplus> j)) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
elts (vcard (i \<Uplus> j)) \<approx> ZFC_Cardinals.Inl ` elts i \<union> ZFC_Cardinals.Inr ` elts j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_eq_sum:
  fixes f :: "nat \<Rightarrow> ('a::real_normed_vector)"
  assumes "\<And>n. n > m \<Longrightarrow> f n = 0"
  shows "(\<Sum>n. f n) = (\<Sum>n \<le> m. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. f n) = sum f {..m}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
m < ?n \<Longrightarrow> f ?n = (0::'a)

goal (1 subgoal):
 1. (\<Sum>n. f n) = sum f {..m}
[PROOF STEP]
by (meson atMost_iff finite_atMost not_le suminf_finite)


[STATEMENT]
lemma i_map2_eq_conv: "
  (i_map2 f xs ys = i_map2 g xs ys) = (\<forall>i. f (xs i) (ys i) = g (xs i) (ys i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i_map2 f xs ys = i_map2 g xs ys) = (\<forall>i. f (xs i) (ys i) = g (xs i) (ys i))
[PROOF STEP]
by (simp add: fun_eq_iff i_map2_nth)