[STATEMENT]
theorem minimal_imp_card_states_le:
       "\<lbrakk>minimal; dfa M'; dfa.language M' = language\<rbrakk>
        \<Longrightarrow> card (dfa.states M) \<le> card (dfa.states M')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>minimal; dfa M'; dfa.language M' = language\<rbrakk> \<Longrightarrow> card (dfa.states M) \<le> card (dfa.states M')
[PROOF STEP]
using minimal_imp_index_eq_app_right dfa.index_eq_app_right_lower min_states_def
[PROOF STATE]
proof (prove)
using this:
minimal \<Longrightarrow> card (dfa.states M) = min_states
dfa ?M \<Longrightarrow> card (UNIV // eq_app_right (dfa.language ?M)) \<le> card (dfa.states ?M)
min_states \<equiv> card (UNIV // eq_app_right language)

goal (1 subgoal):
 1. \<lbrakk>minimal; dfa M'; dfa.language M' = language\<rbrakk> \<Longrightarrow> card (dfa.states M) \<le> card (dfa.states M')
[PROOF STEP]
by fastforce


[STATEMENT]
lemma image_smult_interval:"(\<lambda>x. m *\<^sub>R (x::_::ordered_euclidean_space)) ` {a .. b} =
  (if {a .. b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a .. m *\<^sub>R b} else {m *\<^sub>R b .. m *\<^sub>R a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*\<^sub>R) m ` {a..b} = (if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})
[PROOF STEP]
using image_smult_cbox[of m a b]
[PROOF STATE]
proof (prove)
using this:
(*\<^sub>R) m ` cbox a b = (if cbox a b = {} then {} else if 0 \<le> m then cbox (m *\<^sub>R a) (m *\<^sub>R b) else cbox (m *\<^sub>R b) (m *\<^sub>R a))

goal (1 subgoal):
 1. (*\<^sub>R) m ` {a..b} = (if {a..b} = {} then {} else if 0 \<le> m then {m *\<^sub>R a..m *\<^sub>R b} else {m *\<^sub>R b..m *\<^sub>R a})
[PROOF STEP]
by (simp add: cbox_interval)


[STATEMENT]
lemma cos_even_kpi [simp]:
  fixes k::int
  assumes "even k"
  shows "cos (k * pi) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (real_of_int k * pi) = 1
[PROOF STEP]
by (simp add: assms mult.commute)


[STATEMENT]
lemma Partition_sum_Partition_diff:
  assumes "k \<le> m"
  shows "Partition m k = (\<Sum>i\<le>k. Partition (m - k) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Partition m k = sum (Partition (m - k)) {..k}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k \<le> m

goal (1 subgoal):
 1. Partition m k = sum (Partition (m - k)) {..k}
[PROOF STEP]
by (induct m k rule: Partition.induct) auto


[STATEMENT]
lemma lemma_3_5_i_1: "(d1 a b = 1) = (a = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (d1 a b = (1::'a)) = (a = b)
[PROOF STEP]
apply (simp add: d1_def left_lesseq [THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<le> b \<and> b \<le> a) = (a = b)
[PROOF STEP]
by auto


[STATEMENT]
lemma finprod_reindex_bij_witness:
  assumes witness:
    "\<And>a. a \<in> S \<Longrightarrow> i (j a) = a"
    "\<And>a. a \<in> S \<Longrightarrow> j a \<in> T"
    "\<And>b. b \<in> T \<Longrightarrow> j (i b) = b"
    "\<And>b. b \<in> T \<Longrightarrow> i b \<in> S"
  assumes eq:
    "\<And>a. a \<in> S \<Longrightarrow> h (j a) = g a"
  assumes g: "g \<in> S \<rightarrow> carrier G"
  and h: "h \<in> j ` S \<rightarrow> carrier G"
  shows "finprod G g S = finprod G h T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G g S = finprod G h T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finprod G g S = finprod G h T
[PROOF STEP]
have b: "bij_betw j S T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw j S T
[PROOF STEP]
using bij_betw_byWitness[where A=S and f=j and f'=i and A'=T] witness
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>a\<in>S. i (j a) = a; \<forall>a'\<in>T. j (i a') = a'; j ` S \<subseteq> T; i ` T \<subseteq> S\<rbrakk> \<Longrightarrow> bij_betw j S T
?a \<in> S \<Longrightarrow> i (j ?a) = ?a
?a \<in> S \<Longrightarrow> j ?a \<in> T
?b \<in> T \<Longrightarrow> j (i ?b) = ?b
?b \<in> T \<Longrightarrow> i ?b \<in> S

goal (1 subgoal):
 1. bij_betw j S T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw j S T

goal (1 subgoal):
 1. finprod G g S = finprod G h T
[PROOF STEP]
have fp: "finprod G g S = finprod G (\<lambda>x. h (j x)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G g S = (\<Otimes>x\<in>S. h (j x))
[PROOF STEP]
by (rule finprod_cong, insert eq g, auto)
[PROOF STATE]
proof (state)
this:
finprod G g S = (\<Otimes>x\<in>S. h (j x))

goal (1 subgoal):
 1. finprod G g S = finprod G h T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod G g S = finprod G h T
[PROOF STEP]
using finprod_reindex_bij_betw[OF b h]
[PROOF STATE]
proof (prove)
using this:
(\<Otimes>x\<in>S. h (j x)) = finprod G h T

goal (1 subgoal):
 1. finprod G g S = finprod G h T
[PROOF STEP]
unfolding fp
[PROOF STATE]
proof (prove)
using this:
(\<Otimes>x\<in>S. h (j x)) = finprod G h T

goal (1 subgoal):
 1. (\<Otimes>x\<in>S. h (j x)) = finprod G h T
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finprod G g S = finprod G h T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem tree_height_estimate_upper:
  "tree_invar t \<Longrightarrow>
  size (tree_to_multiset t) \<le> (2::nat)^(Suc (height_tree t)) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tree_invar t \<Longrightarrow> size (tree_to_multiset t) \<le> 2 ^ Suc (height_tree t) - 1
[PROOF STEP]
apply (cases t, simp only:)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2 x3 x4. \<lbrakk>tree_invar (Node x1 x2 x3 x4); t = Node x1 x2 x3 x4\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node x1 x2 x3 x4)) \<le> 2 ^ Suc (height_tree (Node x1 x2 x3 x4)) - 1
[PROOF STEP]
apply (frule tree_rank_estimate_upper)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2 x3 x4. \<lbrakk>tree_invar (Node x1 x2 x3 x4); t = Node x1 x2 x3 x4; size (tree_to_multiset (Node x1 x2 x3 x4)) \<le> 2 ^ Suc x3 - 1\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node x1 x2 x3 x4)) \<le> 2 ^ Suc (height_tree (Node x1 x2 x3 x4)) - 1
[PROOF STEP]
apply (frule tree_rank_height)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2 x3 x4. \<lbrakk>tree_invar (Node x1 x2 x3 x4); t = Node x1 x2 x3 x4; size (tree_to_multiset (Node x1 x2 x3 x4)) \<le> 2 ^ Suc x3 - 1; height_tree (Node x1 x2 x3 x4) = x3\<rbrakk> \<Longrightarrow> size (tree_to_multiset (Node x1 x2 x3 x4)) \<le> 2 ^ Suc (height_tree (Node x1 x2 x3 x4)) - 1
[PROOF STEP]
apply (simp only: )
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma arith_geo_mean:
  fixes u :: "'a::linordered_field"
  assumes "u\<^sup>2 = x * y" "x \<ge> 0" "y \<ge> 0"
  shows "u \<le> (x + y)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<le> (x + y) / (2::'a)
[PROOF STEP]
apply (rule power2_le_imp_le)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. u\<^sup>2 \<le> ((x + y) / (2::'a))\<^sup>2
 2. (0::'a) \<le> (x + y) / (2::'a)
[PROOF STEP]
using sum_squares_bound assms
[PROOF STATE]
proof (prove)
using this:
(2::?'a) * ?x * ?y \<le> ?x\<^sup>2 + ?y\<^sup>2
u\<^sup>2 = x * y
(0::'a) \<le> x
(0::'a) \<le> y

goal (2 subgoals):
 1. u\<^sup>2 \<le> ((x + y) / (2::'a))\<^sup>2
 2. (0::'a) \<le> (x + y) / (2::'a)
[PROOF STEP]
apply (auto simp: zero_le_mult_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. (2::?'a8) * x * y \<le> x\<^sup>2 + y\<^sup>2; u\<^sup>2 = x * y; (0::'a) \<le> x; (0::'a) \<le> y\<rbrakk> \<Longrightarrow> x * y \<le> ((x + y) / (2::'a))\<^sup>2
[PROOF STEP]
apply (auto simp: algebra_simps power2_eq_square)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem sophomores_dream2:
  "(\<lambda>k::nat. norm ((-k) powi (-k))) summable_on {1..}"
  "integral {0..1} (\<lambda>x. x powr x) = -(\<Sum>\<^sub>\<infinity> k\<in>{(1::nat)..}. (-k) powi (-k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) {1..} &&& integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) {1..}
 2. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
let ?I = "integral {0..1} (\<lambda>x. x powr x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) {1..}
 2. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "(\<lambda>k::nat. norm ((-k) powi (-k))) summable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) UNIV
[PROOF STEP]
using abs_summable_sophomores_dream
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. 1 / real (k ^ k))

goal (1 subgoal):
 1. Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) UNIV
[PROOF STEP]
by (intro norm_summable_imp_summable_on) (auto simp: power_int_minus field_simps)
[PROOF STATE]
proof (state)
this:
Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) UNIV

goal (2 subgoals):
 1. Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) {1..}
 2. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
thus "(\<lambda>k::nat. norm ((-k) powi (-k))) summable_on {1..}"
[PROOF STATE]
proof (prove)
using this:
Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) UNIV

goal (1 subgoal):
 1. Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) {1..}
[PROOF STEP]
by (rule summable_on_subset_banach) auto
[PROOF STATE]
proof (state)
this:
Infinite_Sum.abs_summable_on (\<lambda>k. real_of_int (- int k) powi - int k) {1..}

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "(\<lambda>n. (-1)^n / (n+1)^(n+1)) sums ?I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) sums integral {0..1} (\<lambda>x. x powr x)
[PROOF STEP]
using sophomores_dream_aux2
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>k. (- 1) ^ k / real ((k + 1) ^ (k + 1)))
integral {0..1} (\<lambda>x. x powr x) = (\<Sum>n. (- 1) ^ n / real ((n + 1) ^ (n + 1)))

goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) sums integral {0..1} (\<lambda>x. x powr x)
[PROOF STEP]
by (simp add: sums_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) sums integral {0..1} (\<lambda>x. x powr x)

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) sums integral {0..1} (\<lambda>x. x powr x)

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "summable (\<lambda>n. 1 / real (Suc n ^ Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. 1 / real (Suc n ^ Suc n))
[PROOF STEP]
by (subst summable_Suc_iff) (use abs_summable_sophomores_dream in \<open>auto simp: field_simps\<close>)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. 1 / real (Suc n ^ Suc n))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
hence "summable (\<lambda>n. norm ((- 1) ^ n / real (Suc n ^ Suc n)))"
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. 1 / real (Suc n ^ Suc n))

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

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) sums integral {0..1} (\<lambda>x. x powr x)
summable (\<lambda>n. norm ((- 1) ^ n / real (Suc n ^ Suc n)))
[PROOF STEP]
have "has_sum (\<lambda>n::nat. (-1)^n / (n+1)^(n+1)) UNIV ?I"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) sums integral {0..1} (\<lambda>x. x powr x)
summable (\<lambda>n. norm ((- 1) ^ n / real (Suc n ^ Suc n)))

goal (1 subgoal):
 1. has_sum (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) UNIV (integral {0..1} (\<lambda>x. x powr x))
[PROOF STEP]
by (intro norm_summable_imp_has_sum) auto
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) UNIV (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) UNIV (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "?this \<longleftrightarrow> has_sum ((\<lambda>n::nat. -((-1)^n / n^n)) \<circ> Suc) UNIV ?I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) UNIV (integral {0..1} (\<lambda>x. x powr x)) = has_sum ((\<lambda>n. - ((- 1) ^ n / real (n ^ n))) \<circ> Suc) UNIV (integral {0..1} (\<lambda>x. x powr x))
[PROOF STEP]
by (simp add: o_def field_simps)
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) UNIV (integral {0..1} (\<lambda>x. x powr x)) = has_sum ((\<lambda>n. - ((- 1) ^ n / real (n ^ n))) \<circ> Suc) UNIV (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>n. (- 1) ^ n / real ((n + 1) ^ (n + 1))) UNIV (integral {0..1} (\<lambda>x. x powr x)) = has_sum ((\<lambda>n. - ((- 1) ^ n / real (n ^ n))) \<circ> Suc) UNIV (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> has_sum (\<lambda>n::nat. -((-1)^n / n ^ n)) (Suc ` UNIV) ?I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum ((\<lambda>n. - ((- 1) ^ n / real (n ^ n))) \<circ> Suc) UNIV (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. - ((- 1) ^ n / real (n ^ n))) (range Suc) (integral {0..1} (\<lambda>x. x powr x))
[PROOF STEP]
by (intro has_sum_reindex [symmetric]) auto
[PROOF STATE]
proof (state)
this:
has_sum ((\<lambda>n. - ((- 1) ^ n / real (n ^ n))) \<circ> Suc) UNIV (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. - ((- 1) ^ n / real (n ^ n))) (range Suc) (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
has_sum ((\<lambda>n. - ((- 1) ^ n / real (n ^ n))) \<circ> Suc) UNIV (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. - ((- 1) ^ n / real (n ^ n))) (range Suc) (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "Suc ` UNIV = {1..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range Suc = {1..}
[PROOF STEP]
using greaterThan_0
[PROOF STATE]
proof (prove)
using this:
{0<..} = range Suc

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

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
range Suc = {1..}

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "has_sum (\<lambda>n::nat. -((- 1) ^ n / real (n ^ n))) {1..} ?I \<longleftrightarrow>
             has_sum (\<lambda>n::nat. -((-n) powi (-n))) {1..} ?I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum (\<lambda>n. - ((- 1) ^ n / real (n ^ n))) {1..} (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. - (real_of_int (- int n) powi - int n)) {1..} (integral {0..1} (\<lambda>x. x powr x))
[PROOF STEP]
by (intro has_sum_cong) (auto simp: power_int_minus field_simps power_minus')
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>n. - ((- 1) ^ n / real (n ^ n))) {1..} (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. - (real_of_int (- int n) powi - int n)) {1..} (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>n. - ((- 1) ^ n / real (n ^ n))) {1..} (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. - (real_of_int (- int n) powi - int n)) {1..} (integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> has_sum (\<lambda>n::nat. (-n) powi (-n)) {1..} (-?I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_sum (\<lambda>n. - (real_of_int (- int n) powi - int n)) {1..} (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. real_of_int (- int n) powi - int n) {1..} (- integral {0..1} (\<lambda>x. x powr x))
[PROOF STEP]
by (simp add: has_sum_uminus)
[PROOF STATE]
proof (state)
this:
has_sum (\<lambda>n. - (real_of_int (- int n) powi - int n)) {1..} (integral {0..1} (\<lambda>x. x powr x)) = has_sum (\<lambda>n. real_of_int (- int n) powi - int n) {1..} (- integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
has_sum (\<lambda>n. real_of_int (- int n) powi - int n) {1..} (- integral {0..1} (\<lambda>x. x powr x))
[PROOF STEP]
show "integral {0..1} (\<lambda>x. x powr x) = -(\<Sum>\<^sub>\<infinity>k\<in>{(1::nat)..}. (-k) powi (-k))"
[PROOF STATE]
proof (prove)
using this:
has_sum (\<lambda>n. real_of_int (- int n) powi - int n) {1..} (- integral {0..1} (\<lambda>x. x powr x))

goal (1 subgoal):
 1. integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)
[PROOF STEP]
by (auto dest!: infsumI simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
integral {0..1} (\<lambda>x. x powr x) = - (\<Sum>\<^sub>\<infinity>k\<in>{1..}. real_of_int (- int k) powi - int k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rec_by_index_main: "nat_to_pr (rec_by_index n1 n2) = UnaryRecOp (nat_to_pr n1) (nat_to_pr n2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_pr (rec_by_index n1 n2) = UnaryRecOp (nat_to_pr n1) (nat_to_pr n2)
[PROOF STEP]
by (unfold rec_by_index_def, unfold nat_to_pr_def, simp add: loc_srj_5_1)


[STATEMENT]
lemma "ipv4addr_of_dotdecimal (192, 168, 0, 1) = 3232235521"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv4addr_of_dotdecimal (192, 168, 0, 1) = 3232235521
[PROOF STEP]
by(simp add: ipv4addr_of_dotdecimal.simps ipv4addr_of_nat_def)


[STATEMENT]
lemma power_neg_one_If: "(-1) ^ n = (if even n then 1 else -1 :: 'a :: ring_1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ n = (if even n then 1::'a else - (1::'a))
[PROOF STEP]
by (induction n) (simp_all split: if_splits)


[STATEMENT]
lemma lborel_has_bochner_integral_real_affine_iff:
  fixes x :: "'a :: {banach, second_countable_topology}"
  shows "c \<noteq> 0 \<Longrightarrow>
    has_bochner_integral lborel f x \<longleftrightarrow>
    has_bochner_integral lborel (\<lambda>x. f (t + c * x)) (x /\<^sub>R \<bar>c\<bar>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> has_bochner_integral lborel f x = has_bochner_integral lborel (\<lambda>x. f (t + c * x)) (x /\<^sub>R \<bar>c\<bar>)
[PROOF STEP]
unfolding has_bochner_integral_iff lborel_integrable_real_affine_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0 \<Longrightarrow> (integrable lborel f \<and> integral\<^sup>L lborel f = x) = (integrable lborel f \<and> LINT x|lborel. f (t + c * x) = x /\<^sub>R \<bar>c\<bar>)
[PROOF STEP]
by (simp_all add: lborel_integral_real_affine[symmetric] divideR_right cong: conj_cong)


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


[STATEMENT]
lemma  det_identical_rows:
  fixes A :: "'a::comm_ring_1^'n^'n"
  assumes ij: "i \<noteq> j" and r: "row i A = row j A"
  shows "det A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (0::'a)
[PROOF STEP]
by (metis column_transpose det_identical_columns det_transpose ij r)


[STATEMENT]
lemma convex_closure_rel_interior_inter:
  assumes "\<forall>S\<in>I. convex (S :: 'n::euclidean_space set)"
    and "\<Inter>{rel_interior S |S. S \<in> I} \<noteq> {}"
  shows "\<Inter>{closure S |S. S \<in> I} \<le> closure (\<Inter>{rel_interior S |S. S \<in> I})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
obtain x where x: "\<forall>S\<in>I. x \<in> rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<forall>S\<in>I. x \<in> rel_interior S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>S\<in>I. convex S
\<Inter> {rel_interior S |S. S \<in> I} \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. \<forall>S\<in>I. x \<in> rel_interior S \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>S\<in>I. x \<in> rel_interior S

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>S\<in>I. x \<in> rel_interior S

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
assume "y \<in> \<Inter>{closure S |S. S \<in> I}"
[PROOF STATE]
proof (state)
this:
y \<in> \<Inter> {closure S |S. S \<in> I}

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> \<Inter> {closure S |S. S \<in> I}
[PROOF STEP]
have y: "\<forall>S \<in> I. y \<in> closure S"
[PROOF STATE]
proof (prove)
using this:
y \<in> \<Inter> {closure S |S. S \<in> I}

goal (1 subgoal):
 1. \<forall>S\<in>I. y \<in> closure S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>S\<in>I. y \<in> closure S

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>S\<in>I. y \<in> closure S

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
assume "y = x"
[PROOF STATE]
proof (state)
this:
y = x

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = x
[PROOF STEP]
have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
[PROOF STATE]
proof (prove)
using this:
y = x

goal (1 subgoal):
 1. y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
using x closure_subset[of "\<Inter>{rel_interior S |S. S \<in> I}"]
[PROOF STATE]
proof (prove)
using this:
y = x
\<forall>S\<in>I. x \<in> rel_interior S
\<Inter> {rel_interior S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
y = x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
y = x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
y = x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
assume "y \<noteq> x"
[PROOF STATE]
proof (state)
this:
y \<noteq> x

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
y \<noteq> x

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
assume e: "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
define e1 where "e1 = min 1 (e/norm (y - x))"
[PROOF STATE]
proof (state)
this:
e1 = min 1 (e / norm (y - x))

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e1 = min 1 (e / norm (y - x))
[PROOF STEP]
have e1: "e1 > 0" "e1 \<le> 1" "e1 * norm (y - x) \<le> e"
[PROOF STATE]
proof (prove)
using this:
e1 = min 1 (e / norm (y - x))

goal (1 subgoal):
 1. 0 < e1 &&& e1 \<le> 1 &&& e1 * norm (y - x) \<le> e
[PROOF STEP]
using \<open>y \<noteq> x\<close> \<open>e > 0\<close> le_divide_eq[of e1 e "norm (y - x)"]
[PROOF STATE]
proof (prove)
using this:
e1 = min 1 (e / norm (y - x))
y \<noteq> x
0 < e
(e1 \<le> e / norm (y - x)) = (if 0 < norm (y - x) then e1 * norm (y - x) \<le> e else if norm (y - x) < 0 then e \<le> e1 * norm (y - x) else e1 \<le> 0)

goal (1 subgoal):
 1. 0 < e1 &&& e1 \<le> 1 &&& e1 * norm (y - x) \<le> e
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < e1
e1 \<le> 1
e1 * norm (y - x) \<le> e

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
define z where "z = y - e1 *\<^sub>R (y - x)"
[PROOF STATE]
proof (state)
this:
z = y - e1 *\<^sub>R (y - x)

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
z = y - e1 *\<^sub>R (y - x)

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
assume "S \<in> I"
[PROOF STATE]
proof (state)
this:
S \<in> I

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S \<in> I
[PROOF STEP]
have "z \<in> rel_interior S"
[PROOF STATE]
proof (prove)
using this:
S \<in> I

goal (1 subgoal):
 1. z \<in> rel_interior S
[PROOF STEP]
using rel_interior_closure_convex_shrink[of S x y e1] assms x y e1 z_def
[PROOF STATE]
proof (prove)
using this:
S \<in> I
\<lbrakk>convex S; x \<in> rel_interior S; y \<in> closure S; 0 < e1; e1 \<le> 1\<rbrakk> \<Longrightarrow> y - e1 *\<^sub>R (y - x) \<in> rel_interior S
\<forall>S\<in>I. convex S
\<Inter> {rel_interior S |S. S \<in> I} \<noteq> {}
\<forall>S\<in>I. x \<in> rel_interior S
\<forall>S\<in>I. y \<in> closure S
0 < e1
e1 \<le> 1
e1 * norm (y - x) \<le> e
z = y - e1 *\<^sub>R (y - x)

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

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?S2 \<in> I \<Longrightarrow> z \<in> rel_interior ?S2

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?S2 \<in> I \<Longrightarrow> z \<in> rel_interior ?S2
[PROOF STEP]
have *: "z \<in> \<Inter>{rel_interior S |S. S \<in> I}"
[PROOF STATE]
proof (prove)
using this:
?S2 \<in> I \<Longrightarrow> z \<in> rel_interior ?S2

goal (1 subgoal):
 1. z \<in> \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<in> \<Inter> {rel_interior S |S. S \<in> I}

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
have "\<exists>z. z \<in> \<Inter>{rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>z. z \<in> \<Inter> {rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> e
[PROOF STEP]
using \<open>y \<noteq> x\<close> z_def * e1 e dist_norm[of z y]
[PROOF STATE]
proof (prove)
using this:
y \<noteq> x
z = y - e1 *\<^sub>R (y - x)
z \<in> \<Inter> {rel_interior S |S. S \<in> I}
0 < e1
e1 \<le> 1
e1 * norm (y - x) \<le> e
0 < e
dist z y = norm (z - y)

goal (1 subgoal):
 1. \<exists>z. z \<in> \<Inter> {rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> e
[PROOF STEP]
by (rule_tac x="z" in exI) auto
[PROOF STATE]
proof (state)
this:
\<exists>z. z \<in> \<Inter> {rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> e

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
0 < ?e2 \<Longrightarrow> \<exists>z. z \<in> \<Inter> {rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> ?e2

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < ?e2 \<Longrightarrow> \<exists>z. z \<in> \<Inter> {rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> ?e2
[PROOF STEP]
have "y islimpt \<Inter>{rel_interior S |S. S \<in> I}"
[PROOF STATE]
proof (prove)
using this:
0 < ?e2 \<Longrightarrow> \<exists>z. z \<in> \<Inter> {rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> ?e2

goal (1 subgoal):
 1. y islimpt \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
unfolding islimpt_approachable_le
[PROOF STATE]
proof (prove)
using this:
0 < ?e2 \<Longrightarrow> \<exists>z. z \<in> \<Inter> {rel_interior S |S. S \<in> I} \<and> z \<noteq> y \<and> dist z y \<le> ?e2

goal (1 subgoal):
 1. \<forall>e>0. \<exists>x'\<in>\<Inter> {rel_interior S |S. S \<in> I}. x' \<noteq> y \<and> dist x' y \<le> e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
y islimpt \<Inter> {rel_interior S |S. S \<in> I}

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y islimpt \<Inter> {rel_interior S |S. S \<in> I}
[PROOF STEP]
have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
[PROOF STATE]
proof (prove)
using this:
y islimpt \<Inter> {rel_interior S |S. S \<in> I}

goal (1 subgoal):
 1. y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
unfolding closure_def
[PROOF STATE]
proof (prove)
using this:
y islimpt \<Inter> {rel_interior S |S. S \<in> I}

goal (1 subgoal):
 1. y \<in> \<Inter> {rel_interior S |S. S \<in> I} \<union> {x. x islimpt \<Inter> {rel_interior S |S. S \<in> I}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
y \<noteq> x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
y = x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
y \<noteq> x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
have "y \<in> closure (\<Inter>{rel_interior S |S. S \<in> I})"
[PROOF STATE]
proof (prove)
using this:
y = x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
y \<noteq> x \<Longrightarrow> y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?y2 \<in> \<Inter> {closure S |S. S \<in> I} \<Longrightarrow> ?y2 \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?y2 \<in> \<Inter> {closure S |S. S \<in> I} \<Longrightarrow> ?y2 \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?y2 \<in> \<Inter> {closure S |S. S \<in> I} \<Longrightarrow> ?y2 \<in> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal (1 subgoal):
 1. \<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Inter> {closure S |S. S \<in> I} \<subseteq> closure (\<Inter> {rel_interior S |S. S \<in> I})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_3way_split:
  assumes "x \<in> (A :: 'a :: linorder set)" "finite A"
  shows   "card A = card {y\<in>A. y < x} + card {y\<in>A. y > x} + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
finite A
[PROOF STEP]
have "A = insert x ({y\<in>A. y < x} \<union> {y\<in>A. y > x})"
[PROOF STATE]
proof (prove)
using this:
x \<in> A
finite A

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

goal (1 subgoal):
 1. card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A = insert x ({y \<in> A. y < x} \<union> {y \<in> A. x < y})

goal (1 subgoal):
 1. card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
have "card \<dots> = card {y\<in>A. y < x} + card {y\<in>A. y > x} + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert x ({y \<in> A. y < x} \<union> {y \<in> A. x < y})) = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> A
finite A

goal (1 subgoal):
 1. card (insert x ({y \<in> A. y < x} \<union> {y \<in> A. x < y})) = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
by (subst card_insert_disjoint) (auto intro: card_Un_disjoint)
[PROOF STATE]
proof (state)
this:
card (insert x ({y \<in> A. y < x} \<union> {y \<in> A. x < y})) = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1

goal (1 subgoal):
 1. card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1

goal (1 subgoal):
 1. card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card A = card {y \<in> A. y < x} + card {y \<in> A. x < y} + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hyp_inverse_mult_distrib:
  fixes a b :: "('a :: {inverse, comm_ring_1, division_ring}) hyperdual"
  shows "inverse (a * b) = inverse b * inverse a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (a * b) = inverse b * inverse a
[PROOF STEP]
proof (cases "Base a = 0 \<or> Base b = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Base a = (0::'a) \<or> Base b = (0::'a) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
 2. \<not> (Base a = (0::'a) \<or> Base b = (0::'a)) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Base a = (0::'a) \<or> Base b = (0::'a)

goal (2 subgoals):
 1. Base a = (0::'a) \<or> Base b = (0::'a) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
 2. \<not> (Base a = (0::'a) \<or> Base b = (0::'a)) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Base a = (0::'a) \<or> Base b = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Base a = (0::'a) \<or> Base b = (0::'a)

goal (1 subgoal):
 1. inverse (a * b) = inverse b * inverse a
[PROOF STEP]
by (metis hyp_base_mult_eq_0_iff mult_zero_left mult_zero_right zero_base_zero_inverse)
[PROOF STATE]
proof (state)
this:
inverse (a * b) = inverse b * inverse a

goal (1 subgoal):
 1. \<not> (Base a = (0::'a) \<or> Base b = (0::'a)) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (Base a = (0::'a) \<or> Base b = (0::'a)) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (Base a = (0::'a) \<or> Base b = (0::'a))

goal (1 subgoal):
 1. \<not> (Base a = (0::'a) \<or> Base b = (0::'a)) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (Base a = (0::'a) \<or> Base b = (0::'a))
[PROOF STEP]
have "a * (b * inverse b) * inverse a = 1"
[PROOF STATE]
proof (prove)
using this:
\<not> (Base a = (0::'a) \<or> Base b = (0::'a))

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

goal (1 subgoal):
 1. \<not> (Base a = (0::'a) \<or> Base b = (0::'a)) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * (b * inverse b) * inverse a = 1
[PROOF STEP]
have "a * b * (inverse b * inverse a) = 1"
[PROOF STATE]
proof (prove)
using this:
a * (b * inverse b) * inverse a = 1

goal (1 subgoal):
 1. a * b * (inverse b * inverse a) = 1
[PROOF STEP]
by (simp only: mult.assoc)
[PROOF STATE]
proof (state)
this:
a * b * (inverse b * inverse a) = 1

goal (1 subgoal):
 1. \<not> (Base a = (0::'a) \<or> Base b = (0::'a)) \<Longrightarrow> inverse (a * b) = inverse b * inverse a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
a * b * (inverse b * inverse a) = 1

goal (1 subgoal):
 1. inverse (a * b) = inverse b * inverse a
[PROOF STEP]
using hyp_inverse_unique[of "a * b" "(inverse b * inverse a)"]
[PROOF STATE]
proof (prove)
using this:
a * b * (inverse b * inverse a) = 1
a * b * (inverse b * inverse a) = 1 \<Longrightarrow> inverse b * inverse a = inverse (a * b)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma weak_inf_insert [simp]:
  assumes "a \<in> carrier L" "A \<subseteq> carrier L"
  shows "\<Sqinter>insert a A .= a \<sqinter> \<Sqinter>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>insert a A .= a \<sqinter> \<Sqinter>A
[PROOF STEP]
proof (rule weak_le_antisym)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<Sqinter>insert a A \<sqsubseteq> a \<sqinter> \<Sqinter>A
 2. a \<sqinter> \<Sqinter>A \<sqsubseteq> \<Sqinter>insert a A
 3. \<Sqinter>insert a A \<in> carrier L
 4. a \<sqinter> \<Sqinter>A \<in> carrier L
[PROOF STEP]
show "\<Sqinter>insert a A \<sqsubseteq> a \<sqinter> \<Sqinter>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>insert a A \<sqsubseteq> a \<sqinter> \<Sqinter>A
[PROOF STEP]
by (simp add: assms inf_lower local.inf_greatest meet_le)
[PROOF STATE]
proof (state)
this:
\<Sqinter>insert a A \<sqsubseteq> a \<sqinter> \<Sqinter>A

goal (3 subgoals):
 1. a \<sqinter> \<Sqinter>A \<sqsubseteq> \<Sqinter>insert a A
 2. \<Sqinter>insert a A \<in> carrier L
 3. a \<sqinter> \<Sqinter>A \<in> carrier L
[PROOF STEP]
show aA: "a \<sqinter> \<Sqinter>A \<in> carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<sqinter> \<Sqinter>A \<in> carrier L
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier L
A \<subseteq> carrier L

goal (1 subgoal):
 1. a \<sqinter> \<Sqinter>A \<in> carrier L
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a \<sqinter> \<Sqinter>A \<in> carrier L

goal (2 subgoals):
 1. a \<sqinter> \<Sqinter>A \<sqsubseteq> \<Sqinter>insert a A
 2. \<Sqinter>insert a A \<in> carrier L
[PROOF STEP]
show "a \<sqinter> \<Sqinter>A \<sqsubseteq> \<Sqinter>insert a A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<sqinter> \<Sqinter>A \<sqsubseteq> \<Sqinter>insert a A
[PROOF STEP]
apply (rule inf_greatest)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. insert a A \<subseteq> carrier L
 2. a \<sqinter> \<Sqinter>A \<in> carrier L
 3. \<And>x. x \<in> insert a A \<Longrightarrow> a \<sqinter> \<Sqinter>A \<sqsubseteq> x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier L
A \<subseteq> carrier L

goal (3 subgoals):
 1. insert a A \<subseteq> carrier L
 2. a \<sqinter> \<Sqinter>A \<in> carrier L
 3. \<And>x. x \<in> insert a A \<Longrightarrow> a \<sqinter> \<Sqinter>A \<sqsubseteq> x
[PROOF STEP]
apply (simp_all add: aA)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x = a \<or> x \<in> A; a \<in> carrier L; A \<subseteq> carrier L\<rbrakk> \<Longrightarrow> a \<sqinter> \<Sqinter>A \<sqsubseteq> x
[PROOF STEP]
by (meson aA inf_closed inf_lower local.le_trans meet_left meet_right subsetCE)
[PROOF STATE]
proof (state)
this:
a \<sqinter> \<Sqinter>A \<sqsubseteq> \<Sqinter>insert a A

goal (1 subgoal):
 1. \<Sqinter>insert a A \<in> carrier L
[PROOF STEP]
show "\<Sqinter>insert a A \<in> carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>insert a A \<in> carrier L
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier L
A \<subseteq> carrier L

goal (1 subgoal):
 1. \<Sqinter>insert a A \<in> carrier L
[PROOF STEP]
by (force intro: le_trans inf_closed meet_right meet_left inf_lower)
[PROOF STATE]
proof (state)
this:
\<Sqinter>insert a A \<in> carrier L

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_norm_triangle:
fixes u::"complex Matrix.vec"
  assumes "dim_vec u = dim_vec v"
  shows "vec_norm (u+ v) \<le> vec_norm u + vec_norm v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_norm (u + v) \<le> vec_norm u + vec_norm v
[PROOF STEP]
proof (rule cpx_real_le)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 \<le> vec_norm (u + v)
 2. 0 \<le> vec_norm u + vec_norm v
 3. (vec_norm (u + v))\<^sup>2 \<le> (vec_norm u + vec_norm v)\<^sup>2
[PROOF STEP]
show "(vec_norm (u + v))\<^sup>2 \<le> (vec_norm u + vec_norm v)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (vec_norm (u + v))\<^sup>2 \<le> (vec_norm u + vec_norm v)\<^sup>2
[PROOF STEP]
using assms vec_norm_triangle_sq
[PROOF STATE]
proof (prove)
using this:
dim_vec u = dim_vec v
dim_vec ?u = dim_vec ?v \<Longrightarrow> (vec_norm (?u + ?v))\<^sup>2 \<le> (vec_norm ?u + vec_norm ?v)\<^sup>2

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

goal (2 subgoals):
 1. 0 \<le> vec_norm (u + v)
 2. 0 \<le> vec_norm u + vec_norm v
[PROOF STEP]
show "0 \<le> vec_norm (u + v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> vec_norm (u + v)
[PROOF STEP]
using vec_norm_geq_0
[PROOF STATE]
proof (prove)
using this:
0 \<le> vec_norm ?v

goal (1 subgoal):
 1. 0 \<le> vec_norm (u + v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> vec_norm (u + v)

goal (1 subgoal):
 1. 0 \<le> vec_norm u + vec_norm v
[PROOF STEP]
show "0 \<le> vec_norm u + vec_norm v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> vec_norm u + vec_norm v
[PROOF STEP]
using vec_norm_geq_0
[PROOF STATE]
proof (prove)
using this:
0 \<le> vec_norm ?v

goal (1 subgoal):
 1. 0 \<le> vec_norm u + vec_norm v
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> vec_norm u + vec_norm v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HComplex_mult [simp]:
  "\<And>x1 y1 x2 y2. HComplex x1 y1 * HComplex x2 y2 = HComplex (x1*x2 - y1*y2) (x1*y2 + y1*x2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 y1 x2 y2. HComplex x1 y1 * HComplex x2 y2 = HComplex (x1 * x2 - y1 * y2) (x1 * y2 + y1 * x2)
[PROOF STEP]
by transfer (rule complex_mult)


[STATEMENT]
lemma "\<Gamma>\<turnstile>\<^sub>t \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace>
          WHILE \<acute>M \<noteq> a
          INV \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<le> a\<rbrace>
          VAR MEASURE a - \<acute>M
          DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD
          \<lbrace>\<acute>S = a * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile>\<^sub>t \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> WHILE \<acute>M \<noteq> a INV \<lbrace>\<acute>S = \<acute>M * b \<and> \<acute>M \<le> a\<rbrace> VAR MEASURE a - \<acute>M DO \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 OD \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
apply vcg
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>M S. \<lbrakk>M = 0; S = 0\<rbrakk> \<Longrightarrow> S = M * b \<and> M \<le> a
 2. \<And>M S. \<lbrakk>S = M * b; M \<le> a; M \<noteq> a\<rbrakk> \<Longrightarrow> a - (M + 1) < a - M \<and> S + b = (M + 1) * b \<and> M + 1 \<le> a
 3. \<And>M S. \<lbrakk>S = M * b; M \<le> a; \<not> M \<noteq> a\<rbrakk> \<Longrightarrow> S = a * b
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Lambert_W_plus_Lambert_W_eq:
  assumes "x > 0" "y > 0"
  shows   "Lambert_W x + Lambert_W y = Lambert_W (x * y * (1 / Lambert_W x + 1 / Lambert_W y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W x + Lambert_W y = Lambert_W (x * y * (1 / Lambert_W x + 1 / Lambert_W y))
[PROOF STEP]
proof (rule sym, rule Lambert_W_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - 1 \<le> Lambert_W x + Lambert_W y
 2. (Lambert_W x + Lambert_W y) * exp (Lambert_W x + Lambert_W y) = x * y * (1 / Lambert_W x + 1 / Lambert_W y)
[PROOF STEP]
have "x > -exp(-1)" "y > -exp (-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - exp (- 1) < x &&& - exp (- 1) < y
[PROOF STEP]
by (rule less_trans[OF _ assms(1)] less_trans[OF _ assms(2)], simp)+
[PROOF STATE]
proof (state)
this:
- exp (- 1) < x
- exp (- 1) < y

goal (2 subgoals):
 1. - 1 \<le> Lambert_W x + Lambert_W y
 2. (Lambert_W x + Lambert_W y) * exp (Lambert_W x + Lambert_W y) = x * y * (1 / Lambert_W x + 1 / Lambert_W y)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
0 < x
0 < y
- exp (- 1) < x
- exp (- 1) < y
[PROOF STEP]
show "(Lambert_W x + Lambert_W y) * exp (Lambert_W x + Lambert_W y) =
                     x * y * (1 / Lambert_W x + 1 / Lambert_W y)"
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < y
- exp (- 1) < x
- exp (- 1) < y

goal (1 subgoal):
 1. (Lambert_W x + Lambert_W y) * exp (Lambert_W x + Lambert_W y) = x * y * (1 / Lambert_W x + 1 / Lambert_W y)
[PROOF STEP]
by (auto simp: field_simps exp_add exp_Lambert_W)
[PROOF STATE]
proof (state)
this:
(Lambert_W x + Lambert_W y) * exp (Lambert_W x + Lambert_W y) = x * y * (1 / Lambert_W x + 1 / Lambert_W y)

goal (1 subgoal):
 1. - 1 \<le> Lambert_W x + Lambert_W y
[PROOF STEP]
have "-1 \<le> (0 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 \<le> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- 1 \<le> 0

goal (1 subgoal):
 1. - 1 \<le> Lambert_W x + Lambert_W y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- 1 \<le> 0

goal (1 subgoal):
 1. - 1 \<le> Lambert_W x + Lambert_W y
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < x
0 < y
[PROOF STEP]
have "\<dots> \<le> Lambert_W x + Lambert_W y"
[PROOF STATE]
proof (prove)
using this:
0 < x
0 < y

goal (1 subgoal):
 1. 0 \<le> Lambert_W x + Lambert_W y
[PROOF STEP]
by (intro add_nonneg_nonneg) auto
[PROOF STATE]
proof (state)
this:
0 \<le> Lambert_W x + Lambert_W y

goal (1 subgoal):
 1. - 1 \<le> Lambert_W x + Lambert_W y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- 1 \<le> Lambert_W x + Lambert_W y
[PROOF STEP]
show "\<dots> \<ge> -1"
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> Lambert_W x + Lambert_W y

goal (1 subgoal):
 1. - 1 \<le> Lambert_W x + Lambert_W y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
- 1 \<le> Lambert_W x + Lambert_W y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coeff_0_div:
  assumes "coeff p 0 \<noteq> 0"
  assumes "(q :: 'a :: field poly) dvd p"
  shows   "coeff (p div q) 0 = coeff p 0 div coeff q 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
proof (cases "q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q = 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
 2. q \<noteq> 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

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

goal (1 subgoal):
 1. p = p div q * q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p = p div q * q

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
 2. q \<noteq> 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p = p div q * q

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
 2. q \<noteq> 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
have "coeff \<dots> 0 = coeff (p div q) 0 * coeff q 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. constant_term (p div q * q) = constant_term (p div q) * constant_term q
[PROOF STEP]
by (simp add: coeff_0_mult)
[PROOF STATE]
proof (state)
this:
constant_term (p div q * q) = constant_term (p div q) * constant_term q

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
 2. q \<noteq> 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
constant_term p = constant_term (p div q) * constant_term q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
constant_term p = constant_term (p div q) * constant_term q

goal (1 subgoal):
 1. constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
constant_term p = constant_term (p div q) * constant_term q
constant_term p \<noteq> (0::'a)
q dvd p

goal (1 subgoal):
 1. constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
constant_term (p div q) = constant_term p / constant_term q

goal (1 subgoal):
 1. q = 0 \<Longrightarrow> constant_term (p div q) = constant_term p / constant_term q
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma linear_continuous_on_compose:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space" and g :: "'b \<Rightarrow> 'c::real_normed_vector"
  assumes "continuous_on S f" "linear g"
  shows "continuous_on S (\<lambda>x. g(f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on S (\<lambda>x. g (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
linear g

goal (1 subgoal):
 1. continuous_on S (\<lambda>x. g (f x))
[PROOF STEP]
by (simp add: continuous_on_eq_continuous_within linear_continuous_compose)


[STATEMENT]
lemma prime_1_mod_4_sum_of_squares_unique_aux:
  fixes p x y :: nat
  assumes "prime p" "[p = 1] (mod 4)" "x ^ 2 + y ^ 2 = p"
  shows   "x > 0 \<and> y > 0 \<and> x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<and> 0 < y \<and> x \<noteq> y
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < x
 2. 0 < y
 3. x = y \<Longrightarrow> False
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
[p = 1] (mod 4)
x\<^sup>2 + y\<^sup>2 = p
[PROOF STEP]
show "x > 0" "y > 0"
[PROOF STATE]
proof (prove)
using this:
prime p
[p = 1] (mod 4)
x\<^sup>2 + y\<^sup>2 = p

goal (1 subgoal):
 1. 0 < x &&& 0 < y
[PROOF STEP]
by (auto intro!: Nat.gr0I simp: prime_power_iff)
[PROOF STATE]
proof (state)
this:
0 < x
0 < y

goal (1 subgoal):
 1. x = y \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y \<Longrightarrow> False
[PROOF STEP]
assume "x = y"
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. x = y \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
[p = 1] (mod 4)
x\<^sup>2 + y\<^sup>2 = p
x = y
[PROOF STEP]
have "p = 2 * x ^ 2"
[PROOF STATE]
proof (prove)
using this:
prime p
[p = 1] (mod 4)
x\<^sup>2 + y\<^sup>2 = p
x = y

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

goal (1 subgoal):
 1. x = y \<Longrightarrow> False
[PROOF STEP]
with \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
p = 2 * x\<^sup>2
[PROOF STEP]
have "p = 2"
[PROOF STATE]
proof (prove)
using this:
prime p
p = 2 * x\<^sup>2

goal (1 subgoal):
 1. p = 2
[PROOF STEP]
by (auto dest: prime_product)
[PROOF STATE]
proof (state)
this:
p = 2

goal (1 subgoal):
 1. x = y \<Longrightarrow> False
[PROOF STEP]
with \<open>[p = 1] (mod 4)\<close>
[PROOF STATE]
proof (chain)
picking this:
[p = 1] (mod 4)
p = 2
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
[p = 1] (mod 4)
p = 2

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Carmichael_odd_prime_power:
  assumes "prime p" "odd p" "k > 0"
  shows   "Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
prime p
odd p
0 < k
[PROOF STEP]
obtain g where "residue_primroot (p ^ k) g"
[PROOF STATE]
proof (prove)
using this:
prime p
odd p
0 < k

goal (1 subgoal):
 1. (\<And>g. residue_primroot (p ^ k) g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using residue_primroot_odd_prime_power_exists[of p] assms
[PROOF STATE]
proof (prove)
using this:
prime p
odd p
0 < k
\<lbrakk>prime p; odd p; \<And>g. \<forall>k>0. residue_primroot (p ^ k) g \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
prime p
odd p
0 < k

goal (1 subgoal):
 1. (\<And>g. residue_primroot (p ^ k) g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
residue_primroot (p ^ k) g

goal (1 subgoal):
 1. Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)
[PROOF STEP]
hence "Carmichael (p ^ k) = totient (p ^ k)"
[PROOF STATE]
proof (prove)
using this:
residue_primroot (p ^ k) g

goal (1 subgoal):
 1. Carmichael (p ^ k) = totient (p ^ k)
[PROOF STEP]
by (intro residue_primroot_Carmichael[of "p ^ k" g]) auto
[PROOF STATE]
proof (state)
this:
Carmichael (p ^ k) = totient (p ^ k)

goal (1 subgoal):
 1. Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
prime p
odd p
0 < k
Carmichael (p ^ k) = totient (p ^ k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prime p
odd p
0 < k
Carmichael (p ^ k) = totient (p ^ k)

goal (1 subgoal):
 1. Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)
[PROOF STEP]
by (simp add: totient_prime_power)
[PROOF STATE]
proof (state)
this:
Carmichael (p ^ k) = p ^ (k - 1) * (p - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma geo_sum:
  assumes "x \<noteq> 1"
  shows "(1-x)*(\<Sum>l = 0..<r. (x::('a mod_ring))^l) = (1-x^r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - x) * sum ((^) x) {0..<r} = 1 - x ^ r
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1 - x) * sum ((^) x) {0..<r} = 1 - x ^ r
[PROOF STEP]
have 0:"x * (\<Sum>l = 0..<r. x^l) = (\<Sum>l = 0..<r. x^(Suc l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * sum ((^) x) {0..<r} = (\<Sum>l = 0..<r. x ^ Suc l)
[PROOF STEP]
using sum_in[of "\<lambda> l. x^l" x r]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = 0..<r. x ^ i * x) = sum ((^) x) {0..<r} * x

goal (1 subgoal):
 1. x * sum ((^) x) {0..<r} = (\<Sum>l = 0..<r. x ^ Suc l)
[PROOF STEP]
by(simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
x * sum ((^) x) {0..<r} = (\<Sum>l = 0..<r. x ^ Suc l)

goal (1 subgoal):
 1. (1 - x) * sum ((^) x) {0..<r} = 1 - x ^ r
[PROOF STEP]
have 1:"(\<Sum>l = 0..<r. x^l) - (\<Sum>l = 0..<r. x^(Suc l)) = (\<Sum>l = 0..<r. x^l - x^(Suc l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((^) x) {0..<r} - (\<Sum>l = 0..<r. x ^ Suc l) = (\<Sum>l = 0..<r. x ^ l - x ^ Suc l)
[PROOF STEP]
by(rule sum_diff_in)
[PROOF STATE]
proof (state)
this:
sum ((^) x) {0..<r} - (\<Sum>l = 0..<r. x ^ Suc l) = (\<Sum>l = 0..<r. x ^ l - x ^ Suc l)

goal (1 subgoal):
 1. (1 - x) * sum ((^) x) {0..<r} = 1 - x ^ r
[PROOF STEP]
have 2: "(\<Sum>l = 0..<r. x^l - x^(Suc l)) = 1 - x^r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>l = 0..<r. x ^ l - x ^ Suc l) = 1 - x ^ r
[PROOF STEP]
by(induction r) simp+
[PROOF STATE]
proof (state)
this:
(\<Sum>l = 0..<r. x ^ l - x ^ Suc l) = 1 - x ^ r

goal (1 subgoal):
 1. (1 - x) * sum ((^) x) {0..<r} = 1 - x ^ r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>l = 0..<r. x ^ l - x ^ Suc l) = 1 - x ^ r

goal (1 subgoal):
 1. (1 - x) * sum ((^) x) {0..<r} = 1 - x ^ r
[PROOF STEP]
by (simp add: lessThan_atLeast0 one_diff_power_eq)
[PROOF STATE]
proof (state)
this:
(1 - x) * sum ((^) x) {0..<r} = 1 - x ^ r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lipschitz_on_concat_max:
  fixes a b c::real
  assumes f: "L-lipschitz_on {a .. b} f"
  assumes g: "M-lipschitz_on {b .. c} g"
  assumes fg: "f b = g b"
  shows "(max L M)-lipschitz_on {a .. c} (\<lambda>x. if x \<le> b then f x else g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (max L M)-lipschitz_on {a..c} (\<lambda>x. if x \<le> b then f x else g x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (max L M)-lipschitz_on {a..c} (\<lambda>x. if x \<le> b then f x else g x)
[PROOF STEP]
have "lipschitz_on (max L M) {a .. b} f" "lipschitz_on (max L M) {b .. c} g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (max L M)-lipschitz_on {a..b} f &&& (max L M)-lipschitz_on {b..c} g
[PROOF STEP]
by (auto intro!: lipschitz_on_mono[OF f order_refl] lipschitz_on_mono[OF g order_refl])
[PROOF STATE]
proof (state)
this:
(max L M)-lipschitz_on {a..b} f
(max L M)-lipschitz_on {b..c} g

goal (1 subgoal):
 1. (max L M)-lipschitz_on {a..c} (\<lambda>x. if x \<le> b then f x else g x)
[PROOF STEP]
from lipschitz_on_concat[OF this fg]
[PROOF STATE]
proof (chain)
picking this:
(max L M)-lipschitz_on {a..c} (\<lambda>x. if x \<le> b then f x else g x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(max L M)-lipschitz_on {a..c} (\<lambda>x. if x \<le> b then f x else g x)

goal (1 subgoal):
 1. (max L M)-lipschitz_on {a..c} (\<lambda>x. if x \<le> b then f x else g x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(max L M)-lipschitz_on {a..c} (\<lambda>x. if x \<le> b then f x else g x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem pr_rec1_scheme: "\<lbrakk> h \<in> PrimRec2; f 0 = a; \<forall> y. f (Suc y) = h y (f y) \<rbrakk> \<Longrightarrow> f \<in> PrimRec1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>h \<in> PrimRec2; f 0 = a; \<forall>y. f (Suc y) = h y (f y)\<rbrakk> \<Longrightarrow> f \<in> PrimRec1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>h \<in> PrimRec2; f 0 = a; \<forall>y. f (Suc y) = h y (f y)\<rbrakk> \<Longrightarrow> f \<in> PrimRec1
[PROOF STEP]
assume h_is_pr: "h \<in> PrimRec2"
[PROOF STATE]
proof (state)
this:
h \<in> PrimRec2

goal (1 subgoal):
 1. \<lbrakk>h \<in> PrimRec2; f 0 = a; \<forall>y. f (Suc y) = h y (f y)\<rbrakk> \<Longrightarrow> f \<in> PrimRec1
[PROOF STEP]
assume f_at_0: "f 0 = a"
[PROOF STATE]
proof (state)
this:
f 0 = a

goal (1 subgoal):
 1. \<lbrakk>h \<in> PrimRec2; f 0 = a; \<forall>y. f (Suc y) = h y (f y)\<rbrakk> \<Longrightarrow> f \<in> PrimRec1
[PROOF STEP]
assume f_at_Suc: "\<forall> y. f (Suc y) = h y (f y)"
[PROOF STATE]
proof (state)
this:
\<forall>y. f (Suc y) = h y (f y)

goal (1 subgoal):
 1. \<lbrakk>h \<in> PrimRec2; f 0 = a; \<forall>y. f (Suc y) = h y (f y)\<rbrakk> \<Longrightarrow> f \<in> PrimRec1
[PROOF STEP]
from f_at_0 f_at_Suc
[PROOF STATE]
proof (chain)
picking this:
f 0 = a
\<forall>y. f (Suc y) = h y (f y)
[PROOF STEP]
have "\<And> y. f y  = PrimRecOp1 a h y"
[PROOF STATE]
proof (prove)
using this:
f 0 = a
\<forall>y. f (Suc y) = h y (f y)

goal (1 subgoal):
 1. \<And>y. f y = PrimRecOp1 a h y
[PROOF STEP]
by (induct_tac y, simp_all)
[PROOF STATE]
proof (state)
this:
f ?y = PrimRecOp1 a h ?y

goal (1 subgoal):
 1. \<lbrakk>h \<in> PrimRec2; f 0 = a; \<forall>y. f (Suc y) = h y (f y)\<rbrakk> \<Longrightarrow> f \<in> PrimRec1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ?y = PrimRecOp1 a h ?y
[PROOF STEP]
have "f = PrimRecOp1 a h"
[PROOF STATE]
proof (prove)
using this:
f ?y = PrimRecOp1 a h ?y

goal (1 subgoal):
 1. f = PrimRecOp1 a h
[PROOF STEP]
by (simp add: ext)
[PROOF STATE]
proof (state)
this:
f = PrimRecOp1 a h

goal (1 subgoal):
 1. \<lbrakk>h \<in> PrimRec2; f 0 = a; \<forall>y. f (Suc y) = h y (f y)\<rbrakk> \<Longrightarrow> f \<in> PrimRec1
[PROOF STEP]
with h_is_pr
[PROOF STATE]
proof (chain)
picking this:
h \<in> PrimRec2
f = PrimRecOp1 a h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
h \<in> PrimRec2
f = PrimRecOp1 a h

goal (1 subgoal):
 1. f \<in> PrimRec1
[PROOF STEP]
by (simp add: pr_rec1)
[PROOF STATE]
proof (state)
this:
f \<in> PrimRec1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aff_dim_le_card:
  fixes V :: "'n::euclidean_space set"
  assumes "finite V"
  shows "aff_dim V \<le> of_nat (card V) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim V \<le> int (card V) - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aff_dim V \<le> int (card V) - 1
[PROOF STEP]
obtain B where B: "B \<subseteq> V" "of_nat (card B) = aff_dim V + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> V; int (card B) = aff_dim V + 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using aff_dim_inner_basis_exists[of V]
[PROOF STATE]
proof (prove)
using this:
\<exists>B\<subseteq>V. affine hull B = affine hull V \<and> \<not> affine_dependent B \<and> int (card B) = aff_dim V + 1

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> V; int (card B) = aff_dim V + 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<subseteq> V
int (card B) = aff_dim V + 1

goal (1 subgoal):
 1. aff_dim V \<le> int (card V) - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<subseteq> V
int (card B) = aff_dim V + 1
[PROOF STEP]
have "card B \<le> card V"
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> V
int (card B) = aff_dim V + 1

goal (1 subgoal):
 1. card B \<le> card V
[PROOF STEP]
using assms card_mono
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> V
int (card B) = aff_dim V + 1
finite V
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> card ?A \<le> card ?B

goal (1 subgoal):
 1. card B \<le> card V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card B \<le> card V

goal (1 subgoal):
 1. aff_dim V \<le> int (card V) - 1
[PROOF STEP]
with B
[PROOF STATE]
proof (chain)
picking this:
B \<subseteq> V
int (card B) = aff_dim V + 1
card B \<le> card V
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> V
int (card B) = aff_dim V + 1
card B \<le> card V

goal (1 subgoal):
 1. aff_dim V \<le> int (card V) - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aff_dim V \<le> int (card V) - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_plus_neg_powr_powser:
  fixes z s :: complex
  assumes "norm (z :: complex) < 1"
  shows "(\<lambda>n. (-1)^n * ((s + n - 1) gchoose n) * z^n) sums (1 + z) powr (-s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n * (s + of_nat n - 1 gchoose n) * z ^ n) sums (1 + z) powr - s
[PROOF STEP]
using gen_binomial_complex[OF assms, of "-s"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. (- s gchoose n) * z ^ n) sums (1 + z) powr - s

goal (1 subgoal):
 1. (\<lambda>n. (- 1) ^ n * (s + of_nat n - 1 gchoose n) * z ^ n) sums (1 + z) powr - s
[PROOF STEP]
by (simp add: gbinomial_minus)


[STATEMENT]
lemma setsum_least_eq:
  fixes f::"nat \<Rightarrow> nat"
  assumes h0: "p \<le> n"
  assumes h1: "\<forall>i \<in> {..<p}. f i = 1"
  assumes h2: "\<forall>i \<in> {p..n}. f i = 0"
  shows "(\<Sum>i \<le> n. f i) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
have eq_p: "(\<Sum>i \<in> {..<p}. f i) = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<p} = p
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{..<p}. f i = 1

goal (1 subgoal):
 1. sum f {..<p} = p
[PROOF STEP]
by (induct p) (simp_all)
[PROOF STATE]
proof (state)
this:
sum f {..<p} = p

goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
have eq_zero: "(\<Sum>i \<in> {p..n}. f i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {p..n} = 0
[PROOF STEP]
using h2
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{p..n}. f i = 0

goal (1 subgoal):
 1. sum f {p..n} = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum f {p..n} = 0

goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
have "(\<Sum>i \<le> n. f i) = (\<Sum>i \<in> {..<p}. f i) + (\<Sum>i \<in> {p..n}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..n} = sum f {..<p} + sum f {p..n}
[PROOF STEP]
using h0
[PROOF STATE]
proof (prove)
using this:
p \<le> n

goal (1 subgoal):
 1. sum f {..n} = sum f {..<p} + sum f {p..n}
[PROOF STEP]
by (simp add: setsum_add_nat_ivl2)
[PROOF STATE]
proof (state)
this:
sum f {..n} = sum f {..<p} + sum f {p..n}

goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f {..n} = sum f {..<p} + sum f {p..n}

goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
have "... = (\<Sum>i \<in> {..<p}. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<p} + sum f {p..n} = sum f {..<p}
[PROOF STEP]
using eq_zero
[PROOF STATE]
proof (prove)
using this:
sum f {p..n} = 0

goal (1 subgoal):
 1. sum f {..<p} + sum f {p..n} = sum f {..<p}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {..<p} + sum f {p..n} = sum f {..<p}

goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f {..n} = sum f {..<p}
[PROOF STEP]
show "(\<Sum>i \<le> n. f i) = p"
[PROOF STATE]
proof (prove)
using this:
sum f {..n} = sum f {..<p}

goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
using eq_p
[PROOF STATE]
proof (prove)
using this:
sum f {..n} = sum f {..<p}
sum f {..<p} = p

goal (1 subgoal):
 1. sum f {..n} = p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {..n} = p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PrefixListMonotonicity:
fixes
  l1 :: "'a list" and
  l2 :: "'a list"
assumes
  "prefixList l1 l2"
shows
  "length l1 < length l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length l1 < length l2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prefixList l1 l2

goal (1 subgoal):
 1. length l1 < length l2
[PROOF STEP]
by (induct rule: prefixList.induct, auto)


[STATEMENT]
lemma card_gt_1D:
  assumes "card A > 1"
  shows "\<exists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 < card A
[PROOF STEP]
have "A \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
1 < card A

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

goal (1 subgoal):
 1. \<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A \<noteq> {}
[PROOF STEP]
obtain x where "x \<in> A"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

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

goal (1 subgoal):
 1. \<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> A

goal (1 subgoal):
 1. \<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y

goal (1 subgoal):
 1. \<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
\<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y
[PROOF STEP]
have "A = {x}"
[PROOF STATE]
proof (prove)
using this:
x \<in> A
\<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y

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

goal (1 subgoal):
 1. \<nexists>x y. x \<in> A \<and> y \<in> A \<and> x \<noteq> y \<Longrightarrow> False
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
1 < card A
A = {x}
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
1 < card A
A = {x}

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rat_floor_lemma: "of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
have "Fract a b = of_int (a div b) + Fract (a mod b) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fract a b = of_int (a div b) + Fract (a mod b) b
[PROOF STEP]
by (cases "b = 0") (simp, simp add: of_int_rat)
[PROOF STATE]
proof (state)
this:
Fract a b = of_int (a div b) + Fract (a mod b) b

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Fract a b = of_int (a div b) + Fract (a mod b) b

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
have "0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1
[PROOF STEP]
unfolding Fract_of_int_quotient
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> of_int (a mod b) / of_int b \<and> of_int (a mod b) / of_int b < 1
[PROOF STEP]
by (rule linorder_cases [of b 0]) (simp_all add: divide_nonpos_neg)
[PROOF STATE]
proof (state)
this:
0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Fract a b = of_int (a div b) + Fract (a mod b) b
0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Fract a b = of_int (a div b) + Fract (a mod b) b
0 \<le> Fract (a mod b) b \<and> Fract (a mod b) b < 1

goal (1 subgoal):
 1. of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int (a div b) \<le> Fract a b \<and> Fract a b < of_int (a div b + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_eq_const_sum:
  fixes k:: real
  assumes "finite A"
  shows "k*card A = sum (\<lambda>x. k) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * real (card A) = (\<Sum>x\<in>A. k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k * real (card A) = (\<Sum>x\<in>A. k)
[PROOF STEP]
have "plus \<circ> (\<lambda>_. Suc 0) = (\<lambda>_. Suc)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (+) \<circ> (\<lambda>_. Suc 0) = (\<lambda>_. Suc)
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(+) \<circ> (\<lambda>_. Suc 0) = (\<lambda>_. Suc)

goal (1 subgoal):
 1. k * real (card A) = (\<Sum>x\<in>A. k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(+) \<circ> (\<lambda>_. Suc 0) = (\<lambda>_. Suc)
[PROOF STEP]
have "Finite_Set.fold (plus \<circ> (\<lambda>_. Suc 0)) = Finite_Set.fold (\<lambda>_. Suc)"
[PROOF STATE]
proof (prove)
using this:
(+) \<circ> (\<lambda>_. Suc 0) = (\<lambda>_. Suc)

goal (1 subgoal):
 1. Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) = Finite_Set.fold (\<lambda>_. Suc)
[PROOF STEP]
by (rule arg_cong)
[PROOF STATE]
proof (state)
this:
Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) = Finite_Set.fold (\<lambda>_. Suc)

goal (1 subgoal):
 1. k * real (card A) = (\<Sum>x\<in>A. k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) = Finite_Set.fold (\<lambda>_. Suc)
[PROOF STEP]
have "Finite_Set.fold (plus \<circ> (\<lambda>_. Suc 0)) 0 A = Finite_Set.fold (\<lambda>_. Suc) 0 A"
[PROOF STATE]
proof (prove)
using this:
Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) = Finite_Set.fold (\<lambda>_. Suc)

goal (1 subgoal):
 1. Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) 0 A = Finite_Set.fold (\<lambda>_. Suc) 0 A
[PROOF STEP]
by (blast intro: fun_cong)
[PROOF STATE]
proof (state)
this:
Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) 0 A = Finite_Set.fold (\<lambda>_. Suc) 0 A

goal (1 subgoal):
 1. k * real (card A) = (\<Sum>x\<in>A. k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) 0 A = Finite_Set.fold (\<lambda>_. Suc) 0 A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Finite_Set.fold ((+) \<circ> (\<lambda>_. Suc 0)) 0 A = Finite_Set.fold (\<lambda>_. Suc) 0 A

goal (1 subgoal):
 1. k * real (card A) = (\<Sum>x\<in>A. k)
[PROOF STEP]
by (simp add: card.eq_fold sum.eq_fold)
[PROOF STATE]
proof (state)
this:
k * real (card A) = (\<Sum>x\<in>A. k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_inter_lt_single: "finite A \<Longrightarrow> finite B \<Longrightarrow> card (A \<inter> B) \<le> card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B\<rbrakk> \<Longrightarrow> card (A \<inter> B) \<le> card A
[PROOF STEP]
by (simp add: card_mono)


[STATEMENT]
lemma comm_add_vecset:
  assumes "(A :: 'a :: ab_semigroup_add vec set) \<subseteq> carrier_vec n"
    and "B \<subseteq> carrier_vec n"
  shows "A + B = B + A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A + B = B + A
[PROOF STEP]
unfolding set_plus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {c. \<exists>a\<in>A. \<exists>b\<in>B. c = a + b} = {c. \<exists>a\<in>B. \<exists>b\<in>A. c = a + b}
[PROOF STEP]
using comm_add_vec assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v\<^sub>1 \<in> carrier_vec ?n; ?v\<^sub>2 \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> ?v\<^sub>1 + ?v\<^sub>2 = ?v\<^sub>2 + ?v\<^sub>1
A \<subseteq> carrier_vec n
B \<subseteq> carrier_vec n

goal (1 subgoal):
 1. {c. \<exists>a\<in>A. \<exists>b\<in>B. c = a + b} = {c. \<exists>a\<in>B. \<exists>b\<in>A. c = a + b}
[PROOF STEP]
by blast


[STATEMENT]
theorem gbinomial_Gamma:
  assumes "z + 1 \<notin> \<int>\<^sub>\<le>\<^sub>0"
  shows   "(z gchoose n) = Gamma (z + 1) / (fact n * Gamma (z - of_nat n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
have "(z gchoose n) = Gamma (z + 2) / (z + 1) / (fact n * Gamma (z - of_nat n + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z gchoose n = Gamma (z + (2::'a)) / (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
by (subst gbinomial_Beta[OF assms]) (simp_all add: Beta_def Gamma_fact [symmetric] add_ac)
[PROOF STATE]
proof (state)
this:
z gchoose n = Gamma (z + (2::'a)) / (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))

goal (1 subgoal):
 1. z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
z gchoose n = Gamma (z + (2::'a)) / (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))

goal (1 subgoal):
 1. z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
z + (1::'a) \<notin> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
have "Gamma (z + 2) / (z + 1) = Gamma (z + 1)"
[PROOF STATE]
proof (prove)
using this:
z + (1::'a) \<notin> \<int>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. Gamma (z + (2::'a)) / (z + (1::'a)) = Gamma (z + (1::'a))
[PROOF STEP]
using Gamma_plus1[of "z+1"]
[PROOF STATE]
proof (prove)
using this:
z + (1::'a) \<notin> \<int>\<^sub>\<le>\<^sub>0
z + (1::'a) \<notin> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> Gamma (z + (1::'a) + (1::'a)) = (z + (1::'a)) * Gamma (z + (1::'a))

goal (1 subgoal):
 1. Gamma (z + (2::'a)) / (z + (1::'a)) = Gamma (z + (1::'a))
[PROOF STEP]
by (auto simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
Gamma (z + (2::'a)) / (z + (1::'a)) = Gamma (z + (1::'a))

goal (1 subgoal):
 1. z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))

goal (1 subgoal):
 1. z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
z gchoose n = Gamma (z + (1::'a)) / (fact n * Gamma (z - of_nat n + (1::'a)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_combine:
  fixes f :: "real \<Rightarrow> 'a::euclidean_space"
  assumes f: "integrable (lebesgue_on {a..b}) f" and "a \<le> c" "c \<le> b"
  shows "integral\<^sup>L (lebesgue_on {a..b}) f = integral\<^sup>L (lebesgue_on {a..c}) f + integral\<^sup>L (lebesgue_on {c..b}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {a..b}) f = integral\<^sup>L (lebesgue_on {a..c}) f + integral\<^sup>L (lebesgue_on {c..b}) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {a..b}) f = integral\<^sup>L (lebesgue_on {a..c}) f + integral\<^sup>L (lebesgue_on {c..b}) f
[PROOF STEP]
have i: "has_bochner_integral (lebesgue_on {a..c}) f(integral\<^sup>L (lebesgue_on {a..c}) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {a..c}) f (integral\<^sup>L (lebesgue_on {a..c}) f)
[PROOF STEP]
using integrable_subinterval \<open>c \<le> b\<close> f has_bochner_integral_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable (lebesgue_on {?a..?b}) ?f; {?c..?d} \<subseteq> {?a..?b}\<rbrakk> \<Longrightarrow> integrable (lebesgue_on {?c..?d}) ?f
c \<le> b
integrable (lebesgue_on {a..b}) f
has_bochner_integral ?M ?f ?x = (integrable ?M ?f \<and> integral\<^sup>L ?M ?f = ?x)

goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {a..c}) f (integral\<^sup>L (lebesgue_on {a..c}) f)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
has_bochner_integral (lebesgue_on {a..c}) f (integral\<^sup>L (lebesgue_on {a..c}) f)

goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {a..b}) f = integral\<^sup>L (lebesgue_on {a..c}) f + integral\<^sup>L (lebesgue_on {c..b}) f
[PROOF STEP]
have j: "has_bochner_integral (lebesgue_on {c..b}) f(integral\<^sup>L (lebesgue_on {c..b}) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {c..b}) f (integral\<^sup>L (lebesgue_on {c..b}) f)
[PROOF STEP]
using integrable_subinterval \<open>a \<le> c\<close> f has_bochner_integral_iff
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable (lebesgue_on {?a..?b}) ?f; {?c..?d} \<subseteq> {?a..?b}\<rbrakk> \<Longrightarrow> integrable (lebesgue_on {?c..?d}) ?f
a \<le> c
integrable (lebesgue_on {a..b}) f
has_bochner_integral ?M ?f ?x = (integrable ?M ?f \<and> integral\<^sup>L ?M ?f = ?x)

goal (1 subgoal):
 1. has_bochner_integral (lebesgue_on {c..b}) f (integral\<^sup>L (lebesgue_on {c..b}) f)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
has_bochner_integral (lebesgue_on {c..b}) f (integral\<^sup>L (lebesgue_on {c..b}) f)

goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {a..b}) f = integral\<^sup>L (lebesgue_on {a..c}) f + integral\<^sup>L (lebesgue_on {c..b}) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>L (lebesgue_on {a..b}) f = integral\<^sup>L (lebesgue_on {a..c}) f + integral\<^sup>L (lebesgue_on {c..b}) f
[PROOF STEP]
by (meson \<open>a \<le> c\<close> \<open>c \<le> b\<close> has_bochner_integral_combine has_bochner_integral_iff i j)
[PROOF STATE]
proof (state)
this:
integral\<^sup>L (lebesgue_on {a..b}) f = integral\<^sup>L (lebesgue_on {a..c}) f + integral\<^sup>L (lebesgue_on {c..b}) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem all_partitions_paper_equiv_alg:
  fixes xs::"'a list"
  shows "distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs)
[PROOF STEP]
using all_partitions_equivalence'
[PROOF STATE]
proof (prove)
using this:
distinct ?xs \<Longrightarrow> set (map set (all_partitions_list ?xs)) = all_partitions (set ?xs) \<and> (\<forall>ps\<in>set (all_partitions_list ?xs). distinct ps)

goal (1 subgoal):
 1. distinct xs \<Longrightarrow> set (map set (all_partitions_list xs)) = all_partitions (set xs)
[PROOF STEP]
by blast


[STATEMENT]
lemma potential2:
fixes t :: "nat \<Rightarrow> 'a::linordered_ab_group_add" and p :: "nat \<Rightarrow> 'a"
assumes p0: "p 0 = 0" and ppos: "\<And>n. p n \<ge> 0"
and ub: "\<And>m. m<n \<Longrightarrow> t m + p(m+1) - p m \<le> u m"
shows "(\<Sum>i<n. t i) \<le> (\<Sum>i<n. u i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
let ?a = "\<lambda>n. t n + p(n+1) - p n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
have "(\<Sum>i<n. t i) = (\<Sum>i<n. ?a i) - p(n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum t {..<n} = (\<Sum>i<n. t i + p (i + 1) - p i) - p n
[PROOF STEP]
by(induction n) (simp_all add: p0)
[PROOF STATE]
proof (state)
this:
sum t {..<n} = (\<Sum>i<n. t i + p (i + 1) - p i) - p n

goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum t {..<n} = (\<Sum>i<n. t i + p (i + 1) - p i) - p n

goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
have      "\<dots> \<le> (\<Sum>i<n. ?a i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. t i + p (i + 1) - p i) - p n \<le> (\<Sum>i<n. t i + p (i + 1) - p i)
[PROOF STEP]
using ppos
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> p ?n

goal (1 subgoal):
 1. (\<Sum>i<n. t i + p (i + 1) - p i) - p n \<le> (\<Sum>i<n. t i + p (i + 1) - p i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. t i + p (i + 1) - p i) - p n \<le> (\<Sum>i<n. t i + p (i + 1) - p i)

goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. t i + p (i + 1) - p i) - p n \<le> (\<Sum>i<n. t i + p (i + 1) - p i)

goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
have      "\<dots> \<le> (\<Sum>i<n. u i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<n. t i + p (i + 1) - p i) \<le> sum u {..<n}
[PROOF STEP]
apply(rule sum_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<n} \<Longrightarrow> t i + p (i + 1) - p i \<le> u i
[PROOF STEP]
apply(rule ub)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i \<in> {..<n} \<Longrightarrow> i < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<n. t i + p (i + 1) - p i) \<le> sum u {..<n}

goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum t {..<n} \<le> sum u {..<n}

goal (1 subgoal):
 1. sum t {..<n} \<le> sum u {..<n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum t {..<n} \<le> sum u {..<n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monom_1_dvd_iff: "p \<noteq> 0 \<Longrightarrow> monom 1 n dvd p \<longleftrightarrow> n \<le> order 0 p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> (monom (1::'a) n dvd p) = (n \<le> order (0::'a) p)
[PROOF STEP]
using order_divides[of 0 n p]
[PROOF STATE]
proof (prove)
using this:
([:- (0::'a), 1::'a:] ^ n dvd p) = (p = 0 \<or> n \<le> order (0::'a) p)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> (monom (1::'a) n dvd p) = (n \<le> order (0::'a) p)
[PROOF STEP]
by (simp add: monom_altdef)


[STATEMENT]
lemma expectation_binomial_pmf':
  fixes f :: "nat \<Rightarrow> 'a :: {banach, second_countable_topology}"
  assumes p: "p \<in> {0..1}"
  shows   "measure_pmf.expectation (binomial_pmf n p) f =
             (\<Sum>k\<le>n. (real (n choose k) * p ^ k * (1 - p) ^ (n - k)) *\<^sub>R f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation (binomial_pmf n p) f = (\<Sum>k\<le>n. (real (n choose k) * p ^ k * (1 - p) ^ (n - k)) *\<^sub>R f k)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p \<in> {0..1}

goal (1 subgoal):
 1. measure_pmf.expectation (binomial_pmf n p) f = (\<Sum>k\<le>n. (real (n choose k) * p ^ k * (1 - p) ^ (n - k)) *\<^sub>R f k)
[PROOF STEP]
by (subst integral_measure_pmf[where A = "{..n}"])
             (auto simp: set_pmf_binomial_eq split: if_splits)


[STATEMENT]
lemma nn_integral_measure_pmf_finite:
  fixes f :: "'a \<Rightarrow> ennreal"
  assumes f: "finite (set_pmf M)" and nn: "\<And>x. x \<in> set_pmf M \<Longrightarrow> 0 \<le> f x"
  shows "(\<integral>\<^sup>+x. f x \<partial>measure_pmf M) = (\<Sum>x\<in>set_pmf M. f x * pmf M x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>set_pmf M. f x * ennreal (pmf M x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (set_pmf M)
?x \<in> set_pmf M \<Longrightarrow> 0 \<le> f ?x

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf M) f = (\<Sum>x\<in>set_pmf M. f x * ennreal (pmf M x))
[PROOF STEP]
by (intro nn_integral_measure_pmf_support) auto


[STATEMENT]
lemma inner_prod_smult_left:
  fixes u v :: "complex vec"
  assumes dimu: "u \<in> carrier_vec n" and dimv: "v \<in> carrier_vec n"
  shows "inner_prod u (a \<cdot>\<^sub>v v) = a * inner_prod u v" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod u (a \<cdot>\<^sub>v v) = a * inner_prod u v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<in> carrier_vec n
v \<in> carrier_vec n

goal (1 subgoal):
 1. inner_prod u (a \<cdot>\<^sub>v v) = a * inner_prod u v
[PROOF STEP]
apply (simp add: scalar_prod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> carrier_vec n; v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. a * v $ i * cnj (u $ i)) = a * (\<Sum>i = 0..<n. v $ i * cnj (u $ i))
[PROOF STEP]
apply (subst sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<in> carrier_vec n; v \<in> carrier_vec n\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<n. a * v $ i * cnj (u $ i)) = (\<Sum>n = 0..<n. a * (v $ n * cnj (u $ n)))
[PROOF STEP]
by (rule sum.cong, auto)