[STATEMENT]
theorem find_set_path_compression_2:
  "VARS p y
  [ find_set_precondition p x \<and> p0 = p ]
  y := x;
  WHILE y \<noteq> p[[y]]
    INV { find_set_invariant p x y \<and> p0 = p }
    VAR { (p\<^sup>T\<^sup>\<star> * y)\<down> }
     DO y := p[[y]]
     OD;
  p := path_compression p x y
  [ path_compression_postcondition p x y p0 ]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [find_set_precondition p x \<and> p0 = p]
y := x; WHILE y \<noteq> p[[y]] INV {find_set_invariant p x y \<and> p0 = p}  VAR {(p\<^sup>T\<^sup>\<star> * y)\<down>}
DO y := p[[y]] OD; p := path_compression p x y
[path_compression_postcondition p x y p0]
[PROOF STEP]
apply vcg_tc_simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. find_set_precondition p0 x \<Longrightarrow> find_set_invariant p0 x x
 2. \<And>y. find_set_invariant p0 x y \<and> y \<noteq> p0[[y]] \<Longrightarrow> find_set_invariant p0 x (p0[[y]]) \<and> (p0\<^sup>T\<^sup>\<star> * (p0[[y]]))\<down> < (p0\<^sup>T\<^sup>\<star> * y)\<down>
 3. \<And>y. find_set_invariant p0 x y \<and> y = p0[[y]] \<Longrightarrow> path_compression_postcondition (path_compression p0 x y) x y p0
[PROOF STEP]
apply (fact find_set_1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>y. find_set_invariant p0 x y \<and> y \<noteq> p0[[y]] \<Longrightarrow> find_set_invariant p0 x (p0[[y]]) \<and> (p0\<^sup>T\<^sup>\<star> * (p0[[y]]))\<down> < (p0\<^sup>T\<^sup>\<star> * y)\<down>
 2. \<And>y. find_set_invariant p0 x y \<and> y = p0[[y]] \<Longrightarrow> path_compression_postcondition (path_compression p0 x y) x y p0
[PROOF STEP]
apply (fact find_set_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. find_set_invariant p0 x y \<and> y = p0[[y]] \<Longrightarrow> path_compression_postcondition (path_compression p0 x y) x y p0
[PROOF STEP]
by (smt find_set_3 find_set_invariant_def find_set_postcondition_def find_set_precondition_def path_compression_function path_compression_precondition_def)


[STATEMENT]
lemma std_normal_density_def: "std_normal_density x = (1 / sqrt (2 * pi)) * exp (- x\<^sup>2 / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. std_normal_density x = 1 / sqrt (2 * pi) * exp (- x\<^sup>2 / 2)
[PROOF STEP]
unfolding normal_density_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / sqrt (2 * pi * 1\<^sup>2) * exp (- (x - 0)\<^sup>2 / (2 * 1\<^sup>2)) = 1 / sqrt (2 * pi) * exp (- x\<^sup>2 / 2)
[PROOF STEP]
by simp


[STATEMENT]
lemma lead_monom_mult_le: "lead_monom (p * q) \<le> lead_monom p + lead_monom q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_monom (p * q) \<le> lead_monom p + lead_monom q
[PROOF STEP]
proof (cases "p * q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p * q = 0 \<Longrightarrow> lead_monom (p * q) \<le> lead_monom p + lead_monom q
 2. p * q \<noteq> 0 \<Longrightarrow> lead_monom (p * q) \<le> lead_monom p + lead_monom q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p * q \<noteq> 0

goal (2 subgoals):
 1. p * q = 0 \<Longrightarrow> lead_monom (p * q) \<le> lead_monom p + lead_monom q
 2. p * q \<noteq> 0 \<Longrightarrow> lead_monom (p * q) \<le> lead_monom p + lead_monom q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_monom (p * q) \<le> lead_monom p + lead_monom q
[PROOF STEP]
proof (intro leI notI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lead_monom p + lead_monom q < lead_monom (p * q) \<Longrightarrow> False
[PROOF STEP]
assume "lead_monom p + lead_monom q < lead_monom (p * q)"
[PROOF STATE]
proof (state)
this:
lead_monom p + lead_monom q < lead_monom (p * q)

goal (1 subgoal):
 1. lead_monom p + lead_monom q < lead_monom (p * q) \<Longrightarrow> False
[PROOF STEP]
hence "lead_coeff (p * q) = 0"
[PROOF STATE]
proof (prove)
using this:
lead_monom p + lead_monom q < lead_monom (p * q)

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (p * q) = (0::'a)
[PROOF STEP]
unfolding lead_coeff_def coeff_mpoly_times
[PROOF STATE]
proof (prove)
using this:
lead_monom p + lead_monom q < lead_monom (p * q)

goal (1 subgoal):
 1. prod_fun (MPoly_Type.coeff p) (MPoly_Type.coeff q) (lead_monom (p * q)) = (0::'a)
[PROOF STEP]
by (rule prod_fun_gt_max_eq_zero) auto
[PROOF STATE]
proof (state)
this:
Symmetric_Polynomials.lead_coeff (p * q) = (0::'a)

goal (1 subgoal):
 1. lead_monom p + lead_monom q < lead_monom (p * q) \<Longrightarrow> False
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
p * q \<noteq> 0
Symmetric_Polynomials.lead_coeff (p * q) = (0::'a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
p * q \<noteq> 0
Symmetric_Polynomials.lead_coeff (p * q) = (0::'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
lead_monom (p * q) \<le> lead_monom p + lead_monom q

goal (1 subgoal):
 1. p * q = 0 \<Longrightarrow> lead_monom (p * q) \<le> lead_monom p + lead_monom q
[PROOF STEP]
qed auto


[STATEMENT]
lemma mset_le_add_iff1:
  "j \<le> (i::nat) \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i-j) u + m \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
assume "j \<le> i"
[PROOF STATE]
proof (state)
this:
j \<le> i

goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j \<le> i
[PROOF STEP]
have "j + (i - j) = i"
[PROOF STATE]
proof (prove)
using this:
j \<le> i

goal (1 subgoal):
 1. j + (i - j) = i
[PROOF STEP]
using le_add_diff_inverse
[PROOF STATE]
proof (prove)
using this:
j \<le> i
?b \<le> ?a \<Longrightarrow> ?b + (?a - ?b) = ?a

goal (1 subgoal):
 1. j + (i - j) = i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
j + (i - j) = i

goal (1 subgoal):
 1. j \<le> i \<Longrightarrow> (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j + (i - j) = i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j + (i - j) = i

goal (1 subgoal):
 1. (repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)
[PROOF STEP]
by (metis (no_types) add_le_cancel_left left_add_mult_distrib_mset)
[PROOF STATE]
proof (state)
this:
(repeat_mset i u + m \<le> repeat_mset j u + n) = (repeat_mset (i - j) u + m \<le> n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floor_diff_one [simp]: "\<lfloor>x - 1\<rfloor> = \<lfloor>x\<rfloor> - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x - (1::'a)\<rfloor> = \<lfloor>x\<rfloor> - 1
[PROOF STEP]
using floor_diff_of_int [of x 1]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>x - of_int 1\<rfloor> = \<lfloor>x\<rfloor> - 1

goal (1 subgoal):
 1. \<lfloor>x - (1::'a)\<rfloor> = \<lfloor>x\<rfloor> - 1
[PROOF STEP]
by simp


[STATEMENT]
lemma dist_exp_i_1: "norm(exp(\<i> * of_real t) - 1) = 2 * \<bar>sin(t / 2)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cmod (exp (\<i> * complex_of_real t) - 1) = 2 * \<bar>sin (t / 2)\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cmod (exp (\<i> * complex_of_real t) - 1) = 2 * \<bar>sin (t / 2)\<bar>
[PROOF STEP]
have "sqrt (2 - cos t * 2) = 2 * \<bar>sin (t / 2)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (2 - cos t * 2) = 2 * \<bar>sin (t / 2)\<bar>
[PROOF STEP]
using cos_double_sin [of "t/2"]
[PROOF STATE]
proof (prove)
using this:
cos (2 * (t / 2)) = 1 - 2 * (sin (t / 2))\<^sup>2

goal (1 subgoal):
 1. sqrt (2 - cos t * 2) = 2 * \<bar>sin (t / 2)\<bar>
[PROOF STEP]
by (simp add: real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
sqrt (2 - cos t * 2) = 2 * \<bar>sin (t / 2)\<bar>

goal (1 subgoal):
 1. cmod (exp (\<i> * complex_of_real t) - 1) = 2 * \<bar>sin (t / 2)\<bar>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sqrt (2 - cos t * 2) = 2 * \<bar>sin (t / 2)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt (2 - cos t * 2) = 2 * \<bar>sin (t / 2)\<bar>

goal (1 subgoal):
 1. cmod (exp (\<i> * complex_of_real t) - 1) = 2 * \<bar>sin (t / 2)\<bar>
[PROOF STEP]
by (simp add: exp_Euler cmod_def power2_diff sin_of_real cos_of_real algebra_simps)
[PROOF STATE]
proof (state)
this:
cmod (exp (\<i> * complex_of_real t) - 1) = 2 * \<bar>sin (t / 2)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dependent_explicit_finite:
  fixes S :: "(('a::{real_vector,field})^'n) set"
  assumes "finite S"
  shows "dependent S \<longleftrightarrow> (\<exists> u. (\<exists> v\<in>S. u v \<noteq> 0) \<and> (\<Sum> v\<in>S. u v *\<^sub>R v) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dependent S = (\<exists>u. (\<exists>v\<in>S. u v \<noteq> 0) \<and> (\<Sum>v\<in>S. u v *\<^sub>R v) = 0)
[PROOF STEP]
by (simp add: assms dependent_finite)


[STATEMENT]
lemma abs_convergent_prod_offset:
  assumes "abs_convergent_prod (\<lambda>n. f (n + m))"
  shows   "abs_convergent_prod f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abs_convergent_prod f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
abs_convergent_prod (\<lambda>n. f (n + m))

goal (1 subgoal):
 1. abs_convergent_prod f
[PROOF STEP]
unfolding abs_convergent_prod_def
[PROOF STATE]
proof (prove)
using this:
convergent_prod (\<lambda>i. 1 + norm (f (i + m) - (1::'a)))

goal (1 subgoal):
 1. convergent_prod (\<lambda>i. 1 + norm (f i - (1::'a)))
[PROOF STEP]
by (rule convergent_prod_offset)


[STATEMENT]
lemma cot_pfd_plus_1_real:
  assumes "x \<notin> \<int>"
  shows   "cot_pfd (x + 1 :: real) = cot_pfd x - 1 / (x + 1) + 1 / x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x
[PROOF STEP]
have "cot_pfd (complex_of_real (x + 1)) = cot_pfd (of_real x) - 1 / (of_real x + 1) + 1 / of_real x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot_pfd (complex_of_real (x + 1)) = cot_pfd (complex_of_real x) - 1 / (complex_of_real x + 1) + 1 / complex_of_real x
[PROOF STEP]
using cot_pfd_plus_1_complex[of x] assms
[PROOF STATE]
proof (prove)
using this:
complex_of_real x \<notin> \<int> \<Longrightarrow> cot_pfd (complex_of_real x + 1) = cot_pfd (complex_of_real x) - 1 / (complex_of_real x + 1) + 1 / complex_of_real x
x \<notin> \<int>

goal (1 subgoal):
 1. cot_pfd (complex_of_real (x + 1)) = cot_pfd (complex_of_real x) - 1 / (complex_of_real x + 1) + 1 / complex_of_real x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cot_pfd (complex_of_real (x + 1)) = cot_pfd (complex_of_real x) - 1 / (complex_of_real x + 1) + 1 / complex_of_real x

goal (1 subgoal):
 1. cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cot_pfd (complex_of_real (x + 1)) = cot_pfd (complex_of_real x) - 1 / (complex_of_real x + 1) + 1 / complex_of_real x

goal (1 subgoal):
 1. cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x
[PROOF STEP]
have "\<dots> = complex_of_real (cot_pfd x - 1 / (x + 1) + 1 / x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot_pfd (complex_of_real x) - 1 / (complex_of_real x + 1) + 1 / complex_of_real x = complex_of_real (cot_pfd x - 1 / (x + 1) + 1 / x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cot_pfd (complex_of_real x) - 1 / (complex_of_real x + 1) + 1 / complex_of_real x = complex_of_real (cot_pfd x - 1 / (x + 1) + 1 / x)

goal (1 subgoal):
 1. cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cot_pfd (complex_of_real (x + 1)) = complex_of_real (cot_pfd x - 1 / (x + 1) + 1 / x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cot_pfd (complex_of_real (x + 1)) = complex_of_real (cot_pfd x - 1 / (x + 1) + 1 / x)

goal (1 subgoal):
 1. cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x
[PROOF STEP]
unfolding cot_pfd_complex_of_real of_real_eq_iff
[PROOF STATE]
proof (prove)
using this:
cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x

goal (1 subgoal):
 1. cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cot_pfd (x + 1) = cot_pfd x - 1 / (x + 1) + 1 / x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aff_dim_affine_hull2:
  assumes "affine hull S = affine hull T"
  shows "aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S = aff_dim T
[PROOF STEP]
unfolding aff_dim_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SOME d. \<exists>B. affine hull B = affine hull S \<and> \<not> affine_dependent B \<and> int (card B) = d + 1) = (SOME d. \<exists>B. affine hull B = affine hull T \<and> \<not> affine_dependent B \<and> int (card B) = d + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
affine hull S = affine hull T

goal (1 subgoal):
 1. (SOME d. \<exists>B. affine hull B = affine hull S \<and> \<not> affine_dependent B \<and> int (card B) = d + 1) = (SOME d. \<exists>B. affine hull B = affine hull T \<and> \<not> affine_dependent B \<and> int (card B) = d + 1)
[PROOF STEP]
by auto


[STATEMENT]
lemma E_mono2:
  fixes f::"'a \<Rightarrow> real"
  shows "finite (set_pmf X) \<Longrightarrow> (\<forall>x\<in> set_pmf X. (f x) \<le> (u x)) \<Longrightarrow> E (map_pmf f X) \<le> E (map_pmf u X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> E (map_pmf f X) \<le> E (map_pmf u X)
[PROOF STEP]
unfolding E_def integral_map_pmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> measure_pmf.expectation X f \<le> measure_pmf.expectation X u
[PROOF STEP]
apply(rule integral_mono_AE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> integrable (measure_pmf X) f
 2. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> integrable (measure_pmf X) u
 3. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> AE x in measure_pmf X. f x \<le> u x
[PROOF STEP]
apply(simp add: integrable_measure_pmf_finite)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> AE x in measure_pmf X. f x \<le> u x
[PROOF STEP]
by (simp add: AE_measure_pmf_iff)


[STATEMENT]
lemma set_flatten: "set (flatten xs) = Union (set ` set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (flatten xs) = \<Union> (set ` set xs)
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set (flatten []) = \<Union> (set ` set [])
 2. \<And>a xs. set (flatten xs) = \<Union> (set ` set xs) \<Longrightarrow> set (flatten (a # xs)) = \<Union> (set ` set (a # xs))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs. set (flatten xs) = \<Union> (set ` set xs) \<Longrightarrow> set (flatten (a # xs)) = \<Union> (set ` set (a # xs))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finite_UN_disjointed_eq: "(\<Union>i\<in>{0..<n}. disjointed A i) = (\<Union>i\<in>{0..<n}. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n})
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<Union> (disjointed A ` {0..<0}) = \<Union> (A ` {0..<0})
 2. \<And>n. \<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n}) \<Longrightarrow> \<Union> (disjointed A ` {0..<Suc n}) = \<Union> (A ` {0..<Suc n})
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<Union> (disjointed A ` {0..<0}) = \<Union> (A ` {0..<0})
 2. \<And>n. \<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n}) \<Longrightarrow> \<Union> (disjointed A ` {0..<Suc n}) = \<Union> (A ` {0..<Suc n})
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (disjointed A ` {0..<0}) = \<Union> (A ` {0..<0})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Union> (disjointed A ` {0..<0}) = \<Union> (A ` {0..<0})

goal (1 subgoal):
 1. \<And>n. \<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n}) \<Longrightarrow> \<Union> (disjointed A ` {0..<Suc n}) = \<Union> (A ` {0..<Suc n})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n}) \<Longrightarrow> \<Union> (disjointed A ` {0..<Suc n}) = \<Union> (A ` {0..<Suc n})
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n})

goal (1 subgoal):
 1. \<And>n. \<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n}) \<Longrightarrow> \<Union> (disjointed A ` {0..<Suc n}) = \<Union> (A ` {0..<Suc n})
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<Union> (disjointed A ` {0..<n}) = \<Union> (A ` {0..<n})

goal (1 subgoal):
 1. \<Union> (disjointed A ` {0..<Suc n}) = \<Union> (A ` {0..<Suc n})
[PROOF STEP]
by (simp add: atLeastLessThanSuc disjointed_def)
[PROOF STATE]
proof (state)
this:
\<Union> (disjointed A ` {0..<Suc n}) = \<Union> (A ` {0..<Suc n})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Girard_Newton:
  assumes "finite X"
  shows   "(-1) ^ k * of_nat k * sym_mpoly X k +
           (\<Sum>i<k. (-1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) =
             (0 :: 'a :: comm_ring_1 mpoly)"
  (is "?lhs = 0")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
write Poly_Mapping.single ("sng")
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
define n where "n = card X"
[PROOF STATE]
proof (state)
this:
n = card X

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
define \ :: "(nat set \<times> nat) set"
    where "\ = {(A, j). A \<subseteq> X \<and> card A \<le> k \<and> j \<in> X \<and> (card A = k \<longrightarrow> j \<in> A)}"
[PROOF STATE]
proof (state)
this:
\ = {(A, j). A \<subseteq> X \<and> card A \<le> k \<and> j \<in> X \<and> (card A = k \<longrightarrow> j \<in> A)}

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
define \1 :: "(nat set \<times> nat) set"
    where "\1 = {A\<in>Pow X. card A < k} \<times> X"
[PROOF STATE]
proof (state)
this:
\1 = {A \<in> Pow X. card A < k} \<times> X

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
define \2 :: "(nat set \<times> nat) set"
    where "\2 = (SIGMA A:{A\<in>Pow X. card A = k}. A)"
[PROOF STATE]
proof (state)
this:
\2 = (SIGMA A:{A \<in> Pow X. card A = k}. A)

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
have \_split: "\ = \1 \<union> \2" "\1 \<inter> \2 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \ = \1 \<union> \2 &&& \1 \<inter> \2 = {}
[PROOF STEP]
by (auto simp: \_def \1_def \2_def)
[PROOF STATE]
proof (state)
this:
\ = \1 \<union> \2
\1 \<inter> \2 = {}

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
have [intro]: "finite \1" "finite \2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite \1 &&& finite \2
[PROOF STEP]
using assms finite_subset[of _ X]
[PROOF STATE]
proof (prove)
using this:
finite X
\<lbrakk>?A \<subseteq> X; finite X\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite \1 &&& finite \2
[PROOF STEP]
by (auto simp: \1_def \2_def intro!: finite_SigmaI)
[PROOF STATE]
proof (state)
this:
finite \1
finite \2

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
have [intro]: "finite \"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite \
[PROOF STEP]
by (subst \_split) auto

  \<comment> \<open>
    We define a `weight' function \<open>w\<close> from \<open>\\<close> to the ring of polynomials as
    \[w(A,j) = (-1)^{|A|} x_j^{k-|A|} \prod_{i\in A} x_i\ .\]
  \<close>
[PROOF STATE]
proof (state)
this:
finite \

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
define w :: "nat set \<times> nat \<Rightarrow> 'a mpoly"
    where "w = (\<lambda>(A, j). monom (monom_of_set A + sng j (k - card A)) ((-1) ^ card A))"

  \<comment> \<open>The sum of these weights over all of \<open>\\<close> is precisely the sum that we want to show equals 0:\<close>
[PROOF STATE]
proof (state)
this:
w = (\<lambda>(A, j). MPoly_Type.monom (monom_of_set A + sng j (k - card A)) ((- (1::'a)) ^ card A))

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
have "?lhs = (\<Sum>x\<in>\. w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
have "(\<Sum>x\<in>\. w x) = (\<Sum>x\<in>\1. w x) + (\<Sum>x\<in>\2. w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w \ = sum w \1 + sum w \2
[PROOF STEP]
by (subst \_split, subst sum.union_disjoint, use \_split(2) in auto)
[PROOF STATE]
proof (state)
this:
sum w \ = sum w \1 + sum w \2

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum w \ = sum w \1 + sum w \2

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
have "(\<Sum>x\<in>\1. w x) = (\<Sum>i<k. (-1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "(\<Sum>x\<in>\1. w x) = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w \1 = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. sum w \1 = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j))
[PROOF STEP]
by (subst sum.Sigma) (auto simp: \1_def)
[PROOF STATE]
proof (state)
this:
sum w \1 = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum w \1 = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "\<dots> = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X.
                        monom (monom_of_set A) ((-1) ^ card A) * monom (sng j (k - card A)) 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j)) = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * MPoly_Type.monom (sng j (k - card A)) (1::'a))
[PROOF STEP]
unfolding w_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. case (A, j) of (A, j) \<Rightarrow> MPoly_Type.monom (monom_of_set A + sng j (k - card A)) ((- (1::'a)) ^ card A)) = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * MPoly_Type.monom (sng j (k - card A)) (1::'a))
[PROOF STEP]
by (intro sum.cong) (auto simp: mult_monom)
[PROOF STATE]
proof (state)
this:
(\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j)) = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * MPoly_Type.monom (sng j (k - card A)) (1::'a))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. w (A, j)) = (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * MPoly_Type.monom (sng j (k - card A)) (1::'a))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "\<dots> = (\<Sum>A | A \<subseteq> X \<and> card A < k. monom (monom_of_set A) ((-1) ^ card A) *
                        powsum_mpoly X (k - card A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * MPoly_Type.monom (sng j (k - card A)) (1::'a)) = (\<Sum>A | A \<subseteq> X \<and> card A < k. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * powsum_mpoly X (k - card A))
[PROOF STEP]
by (simp add: sum_distrib_left powsum_mpoly_altdef)
[PROOF STATE]
proof (state)
this:
(\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * MPoly_Type.monom (sng j (k - card A)) (1::'a)) = (\<Sum>A | A \<subseteq> X \<and> card A < k. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * powsum_mpoly X (k - card A))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>A | A \<subseteq> X \<and> card A < k. \<Sum>j\<in>X. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * MPoly_Type.monom (sng j (k - card A)) (1::'a)) = (\<Sum>A | A \<subseteq> X \<and> card A < k. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * powsum_mpoly X (k - card A))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "\<dots> = (\<Sum>(i,A) \<in> (SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}).
                        monom (monom_of_set A) ((-1) ^ i) * powsum_mpoly X (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>A | A \<subseteq> X \<and> card A < k. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * powsum_mpoly X (k - card A)) = (\<Sum>(i, A)\<in>(SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}). MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ i) * powsum_mpoly X (k - i))
[PROOF STEP]
by (rule sum.reindex_bij_witness[of _ snd "\<lambda>A. (card A, A)"]) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>A | A \<subseteq> X \<and> card A < k. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * powsum_mpoly X (k - card A)) = (\<Sum>(i, A)\<in>(SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}). MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ i) * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>A | A \<subseteq> X \<and> card A < k. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ card A) * powsum_mpoly X (k - card A)) = (\<Sum>(i, A)\<in>(SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}). MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ i) * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "\<dots> = (\<Sum>i<k. \<Sum>A | A \<subseteq> X \<and> card A = i.
                        monom (monom_of_set A) 1 * monom 0 ((-1) ^ i) * powsum_mpoly X (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, A)\<in>(SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}). MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ i) * powsum_mpoly X (k - i)) = (\<Sum>i<k. \<Sum>A | A \<subseteq> X \<and> card A = i. MPoly_Type.monom (monom_of_set A) (1::'a) * MPoly_Type.monom 0 ((- (1::'a)) ^ i) * powsum_mpoly X (k - i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X

goal (1 subgoal):
 1. (\<Sum>(i, A)\<in>(SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}). MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ i) * powsum_mpoly X (k - i)) = (\<Sum>i<k. \<Sum>A | A \<subseteq> X \<and> card A = i. MPoly_Type.monom (monom_of_set A) (1::'a) * MPoly_Type.monom 0 ((- (1::'a)) ^ i) * powsum_mpoly X (k - i))
[PROOF STEP]
by (subst sum.Sigma) (auto simp: mult_monom)
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, A)\<in>(SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}). MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ i) * powsum_mpoly X (k - i)) = (\<Sum>i<k. \<Sum>A | A \<subseteq> X \<and> card A = i. MPoly_Type.monom (monom_of_set A) (1::'a) * MPoly_Type.monom 0 ((- (1::'a)) ^ i) * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, A)\<in>(SIGMA i:{..<k}. {A. A \<subseteq> X \<and> card A = i}). MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ i) * powsum_mpoly X (k - i)) = (\<Sum>i<k. \<Sum>A | A \<subseteq> X \<and> card A = i. MPoly_Type.monom (monom_of_set A) (1::'a) * MPoly_Type.monom 0 ((- (1::'a)) ^ i) * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "\<dots> = (\<Sum>i<k. (-1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<k. \<Sum>A | A \<subseteq> X \<and> card A = i. MPoly_Type.monom (monom_of_set A) (1::'a) * MPoly_Type.monom 0 ((- (1::'a)) ^ i) * powsum_mpoly X (k - i)) = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
by (simp add: sum_distrib_left sum_distrib_right mpoly_monom_0_eq_Const
                      mpoly_Const_power mpoly_Const_uminus algebra_simps sym_mpoly_altdef)
[PROOF STATE]
proof (state)
this:
(\<Sum>i<k. \<Sum>A | A \<subseteq> X \<and> card A = i. MPoly_Type.monom (monom_of_set A) (1::'a) * MPoly_Type.monom 0 ((- (1::'a)) ^ i) * powsum_mpoly X (k - i)) = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum w \1 = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
have "(\<Sum>x\<in>\2. w x) = (-1) ^ k * of_nat k * sym_mpoly X k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
have "(\<Sum>x\<in>\2. w x) = (\<Sum>(A,j)\<in>\2. monom (monom_of_set A) ((- 1) ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w \2 = (\<Sum>(A, j)\<in>\2. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k))
[PROOF STEP]
by (intro sum.cong) (auto simp: \2_def w_def mpoly_monom_0_eq_Const intro!: sum.cong)
[PROOF STATE]
proof (state)
this:
sum w \2 = (\<Sum>(A, j)\<in>\2. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k))

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum w \2 = (\<Sum>(A, j)\<in>\2. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k))

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
have "\<dots> = (\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. monom (monom_of_set A) ((- 1) ^ k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(A, j)\<in>\2. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k)) = (\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k))
[PROOF STEP]
using assms finite_subset[of _ X]
[PROOF STATE]
proof (prove)
using this:
finite X
\<lbrakk>?A \<subseteq> X; finite X\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. (\<Sum>(A, j)\<in>\2. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k)) = (\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k))
[PROOF STEP]
by (subst sum.Sigma) (auto simp: \2_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>(A, j)\<in>\2. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k)) = (\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k))

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(A, j)\<in>\2. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k)) = (\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k))

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
have "(\<lambda>A. monom (monom_of_set A) ((- 1) ^ k) :: 'a mpoly) =
                   (\<lambda>A. monom 0 ((-1) ^ k) * monom (monom_of_set A) 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>A. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k)) = (\<lambda>A. MPoly_Type.monom 0 ((- (1::'a)) ^ k) * MPoly_Type.monom (monom_of_set A) (1::'a))
[PROOF STEP]
by (auto simp: fun_eq_iff mult_monom)
[PROOF STATE]
proof (state)
this:
(\<lambda>A. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k)) = (\<lambda>A. MPoly_Type.monom 0 ((- (1::'a)) ^ k) * MPoly_Type.monom (monom_of_set A) (1::'a))

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>A. MPoly_Type.monom (monom_of_set A) ((- (1::'a)) ^ k)) = (\<lambda>A. MPoly_Type.monom 0 ((- (1::'a)) ^ k) * MPoly_Type.monom (monom_of_set A) (1::'a))

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
have "monom 0 ((-1) ^ k) = (-1) ^ k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.monom 0 ((- (1::'b)) ^ k) = (- 1) ^ k
[PROOF STEP]
by (auto simp: mpoly_monom_0_eq_Const mpoly_Const_power mpoly_Const_uminus)
[PROOF STATE]
proof (state)
this:
MPoly_Type.monom 0 ((- (1::?'b1)) ^ k) = (- 1) ^ k

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
MPoly_Type.monom 0 ((- (1::?'b1)) ^ k) = (- 1) ^ k

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
have "(\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. (- 1) ^ k * monom (monom_of_set A) 1) =
                   ((-1) ^ k * of_nat k * sym_mpoly X k :: 'a mpoly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. (- 1) ^ k * MPoly_Type.monom (monom_of_set A) (1::'a)) = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
by (auto simp: sum_distrib_left sum_distrib_right mult_ac sym_mpoly_altdef)
[PROOF STATE]
proof (state)
this:
(\<Sum>A | A \<subseteq> X \<and> card A = k. \<Sum>j\<in>A. (- 1) ^ k * MPoly_Type.monom (monom_of_set A) (1::'a)) = (- 1) ^ k * of_nat k * sym_mpoly X k

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k

goal (1 subgoal):
 1. sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum w \2 = (- 1) ^ k * of_nat k * sym_mpoly X k

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum w \ = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) + (- 1) ^ k * of_nat k * sym_mpoly X k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum w \ = (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) + (- 1) ^ k * of_nat k * sym_mpoly X k

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \

goal:
No subgoals!
[PROOF STEP]
qed

  \<comment> \<open>Next, we show that the weights sum to 0:\<close>
[PROOF STATE]
proof (state)
this:
(- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = sum w \

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
have "(\<Sum>x\<in>\. w x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
proof -
    \<comment> \<open>We define a function \<open>T\<close> that is a involutory permutation of \<open>\\<close>.
        To be more precise, it bijectively maps those elements \<open>(A,j)\<close> of \<open>\\<close> with \<open>j \<in> A\<close>
        to those where \<open>j \<notin> A\<close> and the other way round. `Involutory' means that \<open>T\<close> is its
        own inverse function, i.\,e.\ $T(T(x)) = x$.\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
define T :: "nat set \<times> nat \<Rightarrow> nat set \<times> nat"
      where "T = (\<lambda>(A, j). if j \<in> A then (A - {j}, j) else (insert j A, j))"
[PROOF STATE]
proof (state)
this:
T = (\<lambda>(A, j). if j \<in> A then (A - {j}, j) else (insert j A, j))

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have [simp]: "T (T x) = x" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T (T x) = x
[PROOF STEP]
by (auto simp: T_def split: prod.splits)
[PROOF STATE]
proof (state)
this:
T (T ?x) = ?x

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have [simp]: "T x \<in> \" if "x \<in> \" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T x \<in> \
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. T x \<in> \
[PROOF STEP]
have [simp]: "n \<le> n - Suc 0 \<longleftrightarrow> n = 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (n \<le> n - Suc 0) = (n = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(?n \<le> ?n - Suc 0) = (?n = 0)

goal (1 subgoal):
 1. T x \<in> \
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T x \<in> \
[PROOF STEP]
using that assms finite_subset[of _ X]
[PROOF STATE]
proof (prove)
using this:
x \<in> \
finite X
\<lbrakk>?A \<subseteq> X; finite X\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. T x \<in> \
[PROOF STEP]
by (auto simp: T_def \_def split: prod.splits)
[PROOF STATE]
proof (state)
this:
T x \<in> \

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> \ \<Longrightarrow> T ?x \<in> \

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have "snd (T x) \<in> fst (T x) \<longleftrightarrow> snd x \<notin> fst x" if "x \<in> \" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (snd (T x) \<in> fst (T x)) = (snd x \<notin> fst x)
[PROOF STEP]
by (auto simp: T_def split: prod.splits)
[PROOF STATE]
proof (state)
this:
?x \<in> \ \<Longrightarrow> (snd (T ?x) \<in> fst (T ?x)) = (snd ?x \<notin> fst ?x)

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
hence bij: "bij_betw T {x\<in>\. snd x \<in> fst x} {x\<in>\. snd x \<notin> fst x}"
[PROOF STATE]
proof (prove)
using this:
?x \<in> \ \<Longrightarrow> (snd (T ?x) \<in> fst (T ?x)) = (snd ?x \<notin> fst ?x)

goal (1 subgoal):
 1. bij_betw T {x \<in> \. snd x \<in> fst x} {x \<in> \. snd x \<notin> fst x}
[PROOF STEP]
by (intro bij_betwI[of _ _ _ T]) auto

    \<comment>\<open>Crucially, we show that \<^term>\<open>T\<close> flips the weight of each element:\<close>
[PROOF STATE]
proof (state)
this:
bij_betw T {x \<in> \. snd x \<in> fst x} {x \<in> \. snd x \<notin> fst x}

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have [simp]: "w (T x) = -w x" if "x \<in> \" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w (T x) = - w x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w (T x) = - w x
[PROOF STEP]
obtain A j where [simp]: "x = (A, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A j. x = (A, j) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force

      \<comment> \<open>Since \<^term>\<open>T\<close> is an involution, we can assume w.\,l.\,o.\,g.\ that \<open>j \<in> A\<close>:\<close>
[PROOF STATE]
proof (state)
this:
x = (A, j)

goal (1 subgoal):
 1. w (T x) = - w x
[PROOF STEP]
have aux: "w (T (A, j)) = - w (A, j)" if "(A, j) \<in> \" "j \<in> A" for j A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
(A, j) \<in> \
j \<in> A
[PROOF STEP]
have [simp]: "j \<in> A" "A \<subseteq> X" and "k > 0"
[PROOF STATE]
proof (prove)
using this:
(A, j) \<in> \
j \<in> A

goal (1 subgoal):
 1. (j \<in> A &&& A \<subseteq> X) &&& 0 < k
[PROOF STEP]
using finite_subset[OF _ assms, of A]
[PROOF STATE]
proof (prove)
using this:
(A, j) \<in> \
j \<in> A
A \<subseteq> X \<Longrightarrow> finite A

goal (1 subgoal):
 1. (j \<in> A &&& A \<subseteq> X) &&& 0 < k
[PROOF STEP]
by (auto simp: \_def intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
j \<in> A
A \<subseteq> X
0 < k

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have [simp]: "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A
[PROOF STEP]
using finite_subset[OF _ assms, of A]
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> X \<Longrightarrow> finite A

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

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
(A, j) \<in> \
j \<in> A
[PROOF STEP]
have "card A \<le> k"
[PROOF STATE]
proof (prove)
using this:
(A, j) \<in> \
j \<in> A

goal (1 subgoal):
 1. card A \<le> k
[PROOF STEP]
by (auto simp: \_def)
[PROOF STATE]
proof (state)
this:
card A \<le> k

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have card: "card A = Suc (card (A - {j}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = Suc (card (A - {j}))
[PROOF STEP]
using card.remove[of A j]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite A; j \<in> A\<rbrakk> \<Longrightarrow> card A = Suc (card (A - {j}))

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

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
hence card_less: "card (A - {j}) < card A"
[PROOF STATE]
proof (prove)
using this:
card A = Suc (card (A - {j}))

goal (1 subgoal):
 1. card (A - {j}) < card A
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
card (A - {j}) < card A

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have "w (T (A, j)) = monom (monom_of_set (A - {j}) + sng j (k - card (A - {j})))
                         ((- 1) ^ card (A - {j}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w (T (A, j)) = MPoly_Type.monom (monom_of_set (A - {j}) + sng j (k - card (A - {j}))) ((- (1::'a)) ^ card (A - {j}))
[PROOF STEP]
by (simp add: w_def T_def)
[PROOF STATE]
proof (state)
this:
w (T (A, j)) = MPoly_Type.monom (monom_of_set (A - {j}) + sng j (k - card (A - {j}))) ((- (1::'a)) ^ card (A - {j}))

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
w (T (A, j)) = MPoly_Type.monom (monom_of_set (A - {j}) + sng j (k - card (A - {j}))) ((- (1::'a)) ^ card (A - {j}))

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have "(- 1) ^ card (A - {j}) = ((- 1) ^ Suc (Suc (card (A - {j}))) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (1::'a)) ^ card (A - {j}) = (- (1::'a)) ^ Suc (Suc (card (A - {j})))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ card (A - {j}) = (- (1::'a)) ^ Suc (Suc (card (A - {j})))

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- (1::'a)) ^ card (A - {j}) = (- (1::'a)) ^ Suc (Suc (card (A - {j})))

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have "Suc (card (A - {j})) = card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (card (A - {j})) = card A
[PROOF STEP]
using card
[PROOF STATE]
proof (prove)
using this:
card A = Suc (card (A - {j}))

goal (1 subgoal):
 1. Suc (card (A - {j})) = card A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc (card (A - {j})) = card A

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc (card (A - {j})) = card A

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have "k - card (A - {j}) = Suc (k - card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k - card (A - {j}) = Suc (k - card A)
[PROOF STEP]
using \<open>k > 0\<close> \<open>card A \<le> k\<close> card_less
[PROOF STATE]
proof (prove)
using this:
0 < k
card A \<le> k
card (A - {j}) < card A

goal (1 subgoal):
 1. k - card (A - {j}) = Suc (k - card A)
[PROOF STEP]
by (subst card) auto
[PROOF STATE]
proof (state)
this:
k - card (A - {j}) = Suc (k - card A)

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k - card (A - {j}) = Suc (k - card A)

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have "monom_of_set (A - {j}) + sng j (Suc (k - card A)) =
                   monom_of_set A + sng j (k - card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_of_set (A - {j}) + sng j (Suc (k - card A)) = monom_of_set A + sng j (k - card A)
[PROOF STEP]
by (transfer fixing: A j k) (auto simp: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
monom_of_set (A - {j}) + sng j (Suc (k - card A)) = monom_of_set A + sng j (k - card A)

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
monom_of_set (A - {j}) + sng j (Suc (k - card A)) = monom_of_set A + sng j (k - card A)

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
have "monom \<dots> ((-1)^ Suc (card A)) = -w (A, j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.monom (monom_of_set A + sng j (k - card A)) ((- (1::'a)) ^ Suc (card A)) = - w (A, j)
[PROOF STEP]
by (simp add: w_def monom_uminus)
[PROOF STATE]
proof (state)
this:
MPoly_Type.monom (monom_of_set A + sng j (k - card A)) ((- (1::'a)) ^ Suc (card A)) = - w (A, j)

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
w (T (A, j)) = - w (A, j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
w (T (A, j)) = - w (A, j)

goal (1 subgoal):
 1. w (T (A, j)) = - w (A, j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
w (T (A, j)) = - w (A, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>(?A, ?j) \<in> \; ?j \<in> ?A\<rbrakk> \<Longrightarrow> w (T (?A, ?j)) = - w (?A, ?j)

goal (1 subgoal):
 1. w (T x) = - w x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w (T x) = - w x
[PROOF STEP]
proof (cases "j \<in> A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. j \<in> A \<Longrightarrow> w (T x) = - w x
 2. j \<notin> A \<Longrightarrow> w (T x) = - w x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
j \<in> A

goal (2 subgoals):
 1. j \<in> A \<Longrightarrow> w (T x) = - w x
 2. j \<notin> A \<Longrightarrow> w (T x) = - w x
[PROOF STEP]
with aux[of A j] that
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(A, j) \<in> \; j \<in> A\<rbrakk> \<Longrightarrow> w (T (A, j)) = - w (A, j)
x \<in> \
j \<in> A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(A, j) \<in> \; j \<in> A\<rbrakk> \<Longrightarrow> w (T (A, j)) = - w (A, j)
x \<in> \
j \<in> A

goal (1 subgoal):
 1. w (T x) = - w x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w (T x) = - w x

goal (1 subgoal):
 1. j \<notin> A \<Longrightarrow> w (T x) = - w x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. j \<notin> A \<Longrightarrow> w (T x) = - w x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
j \<notin> A

goal (1 subgoal):
 1. j \<notin> A \<Longrightarrow> w (T x) = - w x
[PROOF STEP]
hence "snd (T x) \<in> fst (T x)"
[PROOF STATE]
proof (prove)
using this:
j \<notin> A

goal (1 subgoal):
 1. snd (T x) \<in> fst (T x)
[PROOF STEP]
by (auto simp: T_def split: prod.splits)
[PROOF STATE]
proof (state)
this:
snd (T x) \<in> fst (T x)

goal (1 subgoal):
 1. j \<notin> A \<Longrightarrow> w (T x) = - w x
[PROOF STEP]
with aux[of "fst (T x)" "snd (T x)"] that
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>(fst (T x), snd (T x)) \<in> \; snd (T x) \<in> fst (T x)\<rbrakk> \<Longrightarrow> w (T (fst (T x), snd (T x))) = - w (fst (T x), snd (T x))
x \<in> \
snd (T x) \<in> fst (T x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(fst (T x), snd (T x)) \<in> \; snd (T x) \<in> fst (T x)\<rbrakk> \<Longrightarrow> w (T (fst (T x), snd (T x))) = - w (fst (T x), snd (T x))
x \<in> \
snd (T x) \<in> fst (T x)

goal (1 subgoal):
 1. w (T x) = - w x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w (T x) = - w x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
w (T x) = - w x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> \ \<Longrightarrow> w (T ?x) = - w ?x

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
text \<open>
      We can now show fairly easily that the sum is equal to zero.
    \<close>
[PROOF STATE]
proof (state)
this:
?x \<in> \ \<Longrightarrow> w (T ?x) = - w ?x

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have *: "\ = {x\<in>\. snd x \<in> fst x} \<union> {x\<in>\. snd x \<notin> fst x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \ = {x \<in> \. snd x \<in> fst x} \<union> {x \<in> \. snd x \<notin> fst x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\ = {x \<in> \. snd x \<in> fst x} \<union> {x \<in> \. snd x \<notin> fst x}

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have "(\<Sum>x\<in>\. w x) = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x) + (\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum w \ = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x) + (\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x)
[PROOF STEP]
using \<open>finite \\<close>
[PROOF STATE]
proof (prove)
using this:
finite \

goal (1 subgoal):
 1. sum w \ = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x) + (\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x)
[PROOF STEP]
by (subst *, subst sum.union_disjoint) auto
[PROOF STATE]
proof (state)
this:
sum w \ = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x) + (\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x)

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum w \ = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x) + (\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x)

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have "(\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x) = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x) = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x))
[PROOF STEP]
using sum.reindex_bij_betw[OF bij, of w]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x)) = sum w {x \<in> \. snd x \<notin> fst x}

goal (1 subgoal):
 1. (\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x) = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x) = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x))

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x | x \<in> \ \<and> snd x \<notin> fst x. w x) = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x))

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
have "\<dots> = -(\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x)) = - (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x)
[PROOF STEP]
by (simp add: sum_negf)
[PROOF STATE]
proof (state)
this:
(\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w (T x)) = - (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x)

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum w \ = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x) + - (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x)
[PROOF STEP]
show "(\<Sum>x\<in>\. w x) = 0"
[PROOF STATE]
proof (prove)
using this:
sum w \ = (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x) + - (\<Sum>x | x \<in> \ \<and> snd x \<in> fst x. w x)

goal (1 subgoal):
 1. sum w \ = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum w \ = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum w \ = 0

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0

goal (1 subgoal):
 1. (- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(- 1) ^ k * of_nat k * sym_mpoly X k + (\<Sum>i<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i)) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_root_nat_1 [simp]: "k > 0 \<Longrightarrow> nth_root_nat k 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> nth_root_nat k 1 = 1
[PROOF STEP]
by (rule nth_root_nat_unique) (auto simp del: One_nat_def)


[STATEMENT]
lemma t\<^sub>p_sumofALG: "distinct (fst s) \<Longrightarrow> snd a = [] \<Longrightarrow> (qs!i)\<in>set (fst s)
    \<Longrightarrow> t\<^sub>p (fst s) (qs!i) a = (\<Sum>e\<in>set (fst s). ALG e qs i s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct (fst s); snd a = []; qs ! i \<in> set (fst s)\<rbrakk> \<Longrightarrow> t\<^sub>p (fst s) (qs ! i) a = (\<Sum>e\<in>set (fst s). ALG e qs i s)
[PROOF STEP]
unfolding t\<^sub>p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct (fst s); snd a = []; qs ! i \<in> set (fst s)\<rbrakk> \<Longrightarrow> (let (mf, sws) = a in index (swaps sws (fst s)) (qs ! i) + length sws) = (\<Sum>e\<in>set (fst s). ALG e qs i s)
[PROOF STEP]
apply(simp add: split_def )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct (fst s); snd a = []; qs ! i \<in> set (fst s)\<rbrakk> \<Longrightarrow> index (fst s) (qs ! i) = (\<Sum>e\<in>set (fst s). if e < qs ! i in fst s then 1 else 0)
[PROOF STEP]
using index_sum
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct ?s; ?q \<in> set ?s\<rbrakk> \<Longrightarrow> index ?s ?q = (\<Sum>e\<in>set ?s. if e < ?q in ?s then 1 else 0)

goal (1 subgoal):
 1. \<lbrakk>distinct (fst s); snd a = []; qs ! i \<in> set (fst s)\<rbrakk> \<Longrightarrow> index (fst s) (qs ! i) = (\<Sum>e\<in>set (fst s). if e < qs ! i in fst s then 1 else 0)
[PROOF STEP]
by metis


[STATEMENT]
lemma E_mono3:
  fixes f::"'a \<Rightarrow> real"
  shows " integrable (measure_pmf X) f \<Longrightarrow>  integrable (measure_pmf X) u \<Longrightarrow> (\<forall>x\<in> set_pmf X. (f x) \<le> (u x)) \<Longrightarrow> E (map_pmf f X) \<le> E (map_pmf u X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>integrable (measure_pmf X) f; integrable (measure_pmf X) u; \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> E (map_pmf f X) \<le> E (map_pmf u X)
[PROOF STEP]
unfolding E_def integral_map_pmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>integrable (measure_pmf X) f; integrable (measure_pmf X) u; \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> measure_pmf.expectation X f \<le> measure_pmf.expectation X u
[PROOF STEP]
apply(rule integral_mono_AE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>integrable (measure_pmf X) f; integrable (measure_pmf X) u; \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> integrable (measure_pmf X) f
 2. \<lbrakk>integrable (measure_pmf X) f; integrable (measure_pmf X) u; \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> integrable (measure_pmf X) u
 3. \<lbrakk>integrable (measure_pmf X) f; integrable (measure_pmf X) u; \<forall>x\<in>set_pmf X. f x \<le> u x\<rbrakk> \<Longrightarrow> AE x in measure_pmf X. f x \<le> u x
[PROOF STEP]
by (auto simp add: AE_measure_pmf_iff)


[STATEMENT]
lemma trans6: "(a::nat) = b1 + (b2 + b3) + b4 \<Longrightarrow> b3 = 0 \<Longrightarrow>
            a = b1 + b2 + b4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a = b1 + (b2 + b3) + b4; b3 = 0\<rbrakk> \<Longrightarrow> a = b1 + b2 + b4
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma bitAND_linear:
  fixes k::nat
  shows "(b < 2^k) \<and> (d < 2^k) \<Longrightarrow> (a * 2^k + b) && (c * 2^k + d) = (a && c) * 2^k + (b && d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d)
[PROOF STEP]
proof(induction k arbitrary: a b c d)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b c d. b < 2 ^ 0 \<and> d < 2 ^ 0 \<Longrightarrow> a * 2 ^ 0 + b && c * 2 ^ 0 + d = (a && c) * 2 ^ 0 + (b && d)
 2. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
b < 2 ^ 0 \<and> d < 2 ^ 0

goal (2 subgoals):
 1. \<And>a b c d. b < 2 ^ 0 \<and> d < 2 ^ 0 \<Longrightarrow> a * 2 ^ 0 + b && c * 2 ^ 0 + d = (a && c) * 2 ^ 0 + (b && d)
 2. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b < 2 ^ 0 \<and> d < 2 ^ 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
b < 2 ^ 0 \<and> d < 2 ^ 0

goal (1 subgoal):
 1. a * 2 ^ 0 + b && c * 2 ^ 0 + d = (a && c) * 2 ^ 0 + (b && d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a * 2 ^ 0 + b && c * 2 ^ 0 + d = (a && c) * 2 ^ 0 + (b && d)

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
?b < 2 ^ k \<and> ?d < 2 ^ k \<Longrightarrow> ?a * 2 ^ k + ?b && ?c * 2 ^ k + ?d = (?a && ?c) * 2 ^ k + (?b && ?d)
b < 2 ^ Suc k \<and> d < 2 ^ Suc k

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
define m where "m = a * 2^(Suc k) + b"
[PROOF STATE]
proof (state)
this:
m = a * 2 ^ Suc k + b

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
define n where "n = c * 2^(Suc k) + d"
[PROOF STATE]
proof (state)
this:
n = c * 2 ^ Suc k + d

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
have "m && n = 2 * (bitAND_nat (m div 2) (n div 2)) + (m mod 2) * (n mod 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m && n = 2 * (m div 2 && n div 2) + m mod 2 * (n mod 2)
[PROOF STEP]
using bitAND_rec
[PROOF STATE]
proof (prove)
using this:
?m && ?n = 2 * (?m div 2 && ?n div 2) + ?m mod 2 * (?n mod 2)

goal (1 subgoal):
 1. m && n = 2 * (m div 2 && n div 2) + m mod 2 * (n mod 2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
m && n = 2 * (m div 2 && n div 2) + m mod 2 * (n mod 2)

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
m && n = 2 * (m div 2 && n div 2) + m mod 2 * (n mod 2)

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
have "d mod 2 = n mod 2 \<and> b mod 2 = m mod 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d mod 2 = n mod 2 \<and> b mod 2 = m mod 2
[PROOF STEP]
by (metis m_def n_def add.commute mod_mult_self2 power_Suc semiring_normalization_rules(19))
[PROOF STATE]
proof (state)
this:
d mod 2 = n mod 2 \<and> b mod 2 = m mod 2

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
m && n = 2 * (m div 2 && n div 2) + m mod 2 * (n mod 2)
d mod 2 = n mod 2 \<and> b mod 2 = m mod 2
[PROOF STEP]
have f0:"m && n
                      = 2 * ((a * 2^k + (b div 2)) && (c * 2^k + (d div 2))) + (b mod 2)*(d mod 2)"
[PROOF STATE]
proof (prove)
using this:
m && n = 2 * (m div 2 && n div 2) + m mod 2 * (n mod 2)
d mod 2 = n mod 2 \<and> b mod 2 = m mod 2

goal (1 subgoal):
 1. m && n = 2 * (a * 2 ^ k + b div 2 && c * 2 ^ k + d div 2) + b mod 2 * (d mod 2)
[PROOF STEP]
by (metis add.commute div_mult_self2 m_def n_def power_Suc semiring_normalization_rules(19)
              zero_neq_numeral)
[PROOF STATE]
proof (state)
this:
m && n = 2 * (a * 2 ^ k + b div 2 && c * 2 ^ k + d div 2) + b mod 2 * (d mod 2)

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
have "b div 2 < (2 ^ k) \<and> d div 2 < (2 ^ k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b div 2 < 2 ^ k \<and> d div 2 < 2 ^ k
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
b < 2 ^ Suc k \<and> d < 2 ^ Suc k

goal (1 subgoal):
 1. b div 2 < 2 ^ k \<and> d div 2 < 2 ^ k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b div 2 < 2 ^ k \<and> d div 2 < 2 ^ k

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b div 2 < 2 ^ k \<and> d div 2 < 2 ^ k
[PROOF STEP]
have f1:"m && n
                = ((a && c) * 2^(Suc k)) + 2 * ((b div 2) && (d div 2)) + (b mod 2) * (d mod 2)"
[PROOF STATE]
proof (prove)
using this:
b div 2 < 2 ^ k \<and> d div 2 < 2 ^ k

goal (1 subgoal):
 1. m && n = (a && c) * 2 ^ Suc k + 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)
[PROOF STEP]
using f0 Suc.IH
[PROOF STATE]
proof (prove)
using this:
b div 2 < 2 ^ k \<and> d div 2 < 2 ^ k
m && n = 2 * (a * 2 ^ k + b div 2 && c * 2 ^ k + d div 2) + b mod 2 * (d mod 2)
?b < 2 ^ k \<and> ?d < 2 ^ k \<Longrightarrow> ?a * 2 ^ k + ?b && ?c * 2 ^ k + ?d = (?a && ?c) * 2 ^ k + (?b && ?d)

goal (1 subgoal):
 1. m && n = (a && c) * 2 ^ Suc k + 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m && n = (a && c) * 2 ^ Suc k + 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
have "b && d = 2 * ((b div 2) && (d div 2)) + (b mod 2) * (d mod 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b && d = 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)
[PROOF STEP]
using bitAND_rec
[PROOF STATE]
proof (prove)
using this:
?m && ?n = 2 * (?m div 2 && ?n div 2) + ?m mod 2 * (?n mod 2)

goal (1 subgoal):
 1. b && d = 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b && d = 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)

goal (1 subgoal):
 1. \<And>k a b c d. \<lbrakk>\<And>a b c d. b < 2 ^ k \<and> d < 2 ^ k \<Longrightarrow> a * 2 ^ k + b && c * 2 ^ k + d = (a && c) * 2 ^ k + (b && d); b < 2 ^ Suc k \<and> d < 2 ^ Suc k\<rbrakk> \<Longrightarrow> a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
b && d = 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
b && d = 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)

goal (1 subgoal):
 1. a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
b && d = 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)
m && n = (a && c) * 2 ^ Suc k + 2 * (b div 2 && d div 2) + b mod 2 * (d mod 2)

goal (1 subgoal):
 1. a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)
[PROOF STEP]
by (auto simp add: m_def n_def)
[PROOF STATE]
proof (state)
this:
a * 2 ^ Suc k + b && c * 2 ^ Suc k + d = (a && c) * 2 ^ Suc k + (b && d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma atan2_bounded:
  shows "-pi \<le> atan2 y x \<and> atan2 y x < pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi \<le> atan2 y x \<and> atan2 y x < pi
[PROOF STEP]
using arctan_bounded[of "y/x"] zero_le_arctan_iff[of "y/x"] arctan_le_zero_iff[of "y/x"] zero_less_arctan_iff[of "y/x"] arctan_less_zero_iff[of "y/x"]
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < arctan (y / x) \<and> arctan (y / x) < pi / 2
(0 \<le> arctan (y / x)) = (0 \<le> y / x)
(arctan (y / x) \<le> 0) = (y / x \<le> 0)
(0 < arctan (y / x)) = (0 < y / x)
(arctan (y / x) < 0) = (y / x < 0)

goal (1 subgoal):
 1. - pi \<le> atan2 y x \<and> atan2 y x < pi
[PROOF STEP]
using divide_neg_neg[of y x] divide_neg_pos[of y x] divide_pos_pos[of y x]  divide_pos_neg[of y x]
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < arctan (y / x) \<and> arctan (y / x) < pi / 2
(0 \<le> arctan (y / x)) = (0 \<le> y / x)
(arctan (y / x) \<le> 0) = (y / x \<le> 0)
(0 < arctan (y / x)) = (0 < y / x)
(arctan (y / x) < 0) = (y / x < 0)
\<lbrakk>y < 0; x < 0\<rbrakk> \<Longrightarrow> 0 < y / x
\<lbrakk>y < 0; 0 < x\<rbrakk> \<Longrightarrow> y / x < 0
\<lbrakk>0 < y; 0 < x\<rbrakk> \<Longrightarrow> 0 < y / x
\<lbrakk>0 < y; x < 0\<rbrakk> \<Longrightarrow> y / x < 0

goal (1 subgoal):
 1. - pi \<le> atan2 y x \<and> atan2 y x < pi
[PROOF STEP]
unfolding atan2_def
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) < arctan (y / x) \<and> arctan (y / x) < pi / 2
(0 \<le> arctan (y / x)) = (0 \<le> y / x)
(arctan (y / x) \<le> 0) = (y / x \<le> 0)
(0 < arctan (y / x)) = (0 < y / x)
(arctan (y / x) < 0) = (y / x < 0)
\<lbrakk>y < 0; x < 0\<rbrakk> \<Longrightarrow> 0 < y / x
\<lbrakk>y < 0; 0 < x\<rbrakk> \<Longrightarrow> y / x < 0
\<lbrakk>0 < y; 0 < x\<rbrakk> \<Longrightarrow> 0 < y / x
\<lbrakk>0 < y; x < 0\<rbrakk> \<Longrightarrow> y / x < 0

goal (1 subgoal):
 1. - pi \<le> (if 0 < x then arctan (y / x) else if x < 0 then if 0 < y then arctan (y / x) + pi else arctan (y / x) - pi else if 0 < y then pi / 2 else if y < 0 then - pi / 2 else 0) \<and> (if 0 < x then arctan (y / x) else if x < 0 then if 0 < y then arctan (y / x) + pi else arctan (y / x) - pi else if 0 < y then pi / 2 else if y < 0 then - pi / 2 else 0) < pi
[PROOF STEP]
by (simp (no_asm_simp)) auto


[STATEMENT]
lemma prod_less_prodinf:
  fixes f :: "nat \<Rightarrow> real"
  assumes f: "convergent_prod f" and 1: "\<And>m. m\<ge>n \<Longrightarrow> 1 < f m" and 0: "\<And>m. 0 < f m"
  shows "prod f {..<n} < prodinf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<n} < prodinf f
[PROOF STEP]
by (meson "0" "1" f le_less prod_less_prodinf2)


[STATEMENT]
lemma unit_circle_fix_moebius_pt_inversion [simp]:
  assumes "unit_circle_fix M"
  shows "moebius_pt M (inversion z) = inversion (moebius_pt M z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt M (inversion z) = inversion (moebius_pt M z)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M

goal (1 subgoal):
 1. moebius_pt M (inversion z) = inversion (moebius_pt M z)
[PROOF STEP]
using symmetry_principle[of z "inversion z" unit_circle M]
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M
circline_symmetric z (inversion z) unit_circle \<Longrightarrow> circline_symmetric (moebius_pt M z) (moebius_pt M (inversion z)) (moebius_circline M unit_circle)

goal (1 subgoal):
 1. moebius_pt M (inversion z) = inversion (moebius_pt M z)
[PROOF STEP]
using unit_circle_fix_iff[of M, symmetric]
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M
circline_symmetric z (inversion z) unit_circle \<Longrightarrow> circline_symmetric (moebius_pt M z) (moebius_pt M (inversion z)) (moebius_circline M unit_circle)
(moebius_circline M unit_circle = unit_circle) = unit_circle_fix M

goal (1 subgoal):
 1. moebius_pt M (inversion z) = inversion (moebius_pt M z)
[PROOF STEP]
using circline_symmetric_inv_homo_disc[of z]
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M
circline_symmetric z (inversion z) unit_circle \<Longrightarrow> circline_symmetric (moebius_pt M z) (moebius_pt M (inversion z)) (moebius_circline M unit_circle)
(moebius_circline M unit_circle = unit_circle) = unit_circle_fix M
circline_symmetric z (inversion z) unit_circle

goal (1 subgoal):
 1. moebius_pt M (inversion z) = inversion (moebius_pt M z)
[PROOF STEP]
using circline_symmetric_inv_homo_disc'[of "moebius_pt M z" "moebius_pt M (inversion z)"]
[PROOF STATE]
proof (prove)
using this:
unit_circle_fix M
circline_symmetric z (inversion z) unit_circle \<Longrightarrow> circline_symmetric (moebius_pt M z) (moebius_pt M (inversion z)) (moebius_circline M unit_circle)
(moebius_circline M unit_circle = unit_circle) = unit_circle_fix M
circline_symmetric z (inversion z) unit_circle
circline_symmetric (moebius_pt M z) (moebius_pt M (inversion z)) unit_circle \<Longrightarrow> moebius_pt M (inversion z) = inversion (moebius_pt M z)

goal (1 subgoal):
 1. moebius_pt M (inversion z) = inversion (moebius_pt M z)
[PROOF STEP]
by metis


[STATEMENT]
lemma random_bst_altdef':
  assumes "finite A"
  shows   "random_bst A = fold_random_permutation Tree_Set.insert Leaf A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
have "random_bst A = map_pmf bst_of_list (pmf_of_set (permutations_of_set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. random_bst A = map_pmf bst_of_list (pmf_of_set (permutations_of_set A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. random_bst A = map_pmf bst_of_list (pmf_of_set (permutations_of_set A))
[PROOF STEP]
by (simp add: random_bst_altdef)
[PROOF STATE]
proof (state)
this:
random_bst A = map_pmf bst_of_list (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
random_bst A = map_pmf bst_of_list (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
have "\<dots> = map_pmf (\<lambda>xs. fold Tree_Set.insert xs Leaf) (pmf_of_set (permutations_of_set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_pmf bst_of_list (pmf_of_set (permutations_of_set A)) = map_pmf (\<lambda>xs. fold Tree_Set.insert xs \<langle>\<rangle>) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. map_pmf bst_of_list (pmf_of_set (permutations_of_set A)) = map_pmf (\<lambda>xs. fold Tree_Set.insert xs \<langle>\<rangle>) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
by (intro map_pmf_cong refl) (auto simp: bst_of_list_altdef)
[PROOF STATE]
proof (state)
this:
map_pmf bst_of_list (pmf_of_set (permutations_of_set A)) = map_pmf (\<lambda>xs. fold Tree_Set.insert xs \<langle>\<rangle>) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_pmf bst_of_list (pmf_of_set (permutations_of_set A)) = map_pmf (\<lambda>xs. fold Tree_Set.insert xs \<langle>\<rangle>) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have "\<dots> = fold_random_permutation Tree_Set.insert Leaf A"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. map_pmf (\<lambda>xs. fold Tree_Set.insert xs \<langle>\<rangle>) (pmf_of_set (permutations_of_set A)) = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
by (simp add: fold_random_permutation_fold)
[PROOF STATE]
proof (state)
this:
map_pmf (\<lambda>xs. fold Tree_Set.insert xs \<langle>\<rangle>) (pmf_of_set (permutations_of_set A)) = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A

goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A

goal (1 subgoal):
 1. random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
random_bst A = fold_random_permutation Tree_Set.insert \<langle>\<rangle> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relInvImage_Id_on:
  "(\<And>a1 a2. f a1 = f a2 \<longleftrightarrow> a1 = a2) \<Longrightarrow> relInvImage A (Id_on B) f \<subseteq> Id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a1 a2. (f a1 = f a2) = (a1 = a2)) \<Longrightarrow> relInvImage A (Id_on B) f \<subseteq> Id
[PROOF STEP]
unfolding relInvImage_def Id_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a1 a2. (f a1 = f a2) = (a1 = a2)) \<Longrightarrow> {(a1, a2) |a1 a2. a1 \<in> A \<and> a2 \<in> A \<and> (f a1, f a2) \<in> (\<Union>x\<in>B. {(x, x)})} \<subseteq> Id
[PROOF STEP]
by auto


[STATEMENT]
lemma E_nonneg:
  shows "(\<forall>x\<in>set_pmf X. 0\<le> x) \<Longrightarrow> 0 \<le> E X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set_pmf X. 0 \<le> x \<Longrightarrow> 0 \<le> E X
[PROOF STEP]
unfolding E_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set_pmf X. 0 \<le> x \<Longrightarrow> 0 \<le> measure_pmf.expectation X (\<lambda>x. x)
[PROOF STEP]
using integral_nonneg
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f integrable_on ?S; \<And>x. x \<in> ?S \<Longrightarrow> 0 \<le> ?f x\<rbrakk> \<Longrightarrow> 0 \<le> integral ?S ?f

goal (1 subgoal):
 1. \<forall>x\<in>set_pmf X. 0 \<le> x \<Longrightarrow> 0 \<le> measure_pmf.expectation X (\<lambda>x. x)
[PROOF STEP]
by (simp add: AE_measure_pmf_iff integral_nonneg_AE)


[STATEMENT]
lemma tank_inv_arith2:
  assumes "0 \<le> (\<tau>::real)" and "0 < c\<^sub>o" and b: "y\<^sub>0 \<le> hmax" and g: "\<tau> \<le> - ((hmin - y\<^sub>0) / c\<^sub>o)"
  shows "hmin \<le> y\<^sub>0 - c\<^sub>o \<cdot> \<tau>" and "y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hmin \<le> y\<^sub>0 - c\<^sub>o \<cdot> \<tau> &&& y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. hmin \<le> y\<^sub>0 - c\<^sub>o \<cdot> \<tau>
 2. y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax
[PROOF STEP]
have "\<tau> \<cdot> c\<^sub>o \<le> y\<^sub>0 - hmin"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau> \<cdot> c\<^sub>o \<le> y\<^sub>0 - hmin
[PROOF STEP]
using g \<open>0 < c\<^sub>o\<close> pos_le_minus_divide_eq
[PROOF STATE]
proof (prove)
using this:
\<tau> \<le> - ((hmin - y\<^sub>0) / c\<^sub>o)
0 < c\<^sub>o
(0::?'a) < ?c \<Longrightarrow> (?a \<le> - (?b / ?c)) = (?a \<cdot> ?c \<le> - ?b)

goal (1 subgoal):
 1. \<tau> \<cdot> c\<^sub>o \<le> y\<^sub>0 - hmin
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<tau> \<cdot> c\<^sub>o \<le> y\<^sub>0 - hmin

goal (2 subgoals):
 1. hmin \<le> y\<^sub>0 - c\<^sub>o \<cdot> \<tau>
 2. y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax
[PROOF STEP]
thus "hmin \<le> y\<^sub>0 - c\<^sub>o \<cdot> \<tau>"
[PROOF STATE]
proof (prove)
using this:
\<tau> \<cdot> c\<^sub>o \<le> y\<^sub>0 - hmin

goal (1 subgoal):
 1. hmin \<le> y\<^sub>0 - c\<^sub>o \<cdot> \<tau>
[PROOF STEP]
by (auto simp: mult.commute)
[PROOF STATE]
proof (state)
this:
hmin \<le> y\<^sub>0 - c\<^sub>o \<cdot> \<tau>

goal (1 subgoal):
 1. y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax
[PROOF STEP]
show "y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax
[PROOF STEP]
using b assms(1,2)
[PROOF STATE]
proof (prove)
using this:
y\<^sub>0 \<le> hmax
0 \<le> \<tau>
0 < c\<^sub>o

goal (1 subgoal):
 1. y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax
[PROOF STEP]
by (smt mult_nonneg_nonneg)
[PROOF STATE]
proof (state)
this:
y\<^sub>0 - c\<^sub>o \<cdot> \<tau> \<le> hmax

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_rabs: "summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)"
  for f :: "nat \<Rightarrow> real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. \<bar>f n\<bar>) \<Longrightarrow> \<bar>suminf f\<bar> \<le> (\<Sum>n. \<bar>f n\<bar>)
[PROOF STEP]
by (fold real_norm_def) (rule summable_norm)


[STATEMENT]
lemma uniform_limit1':
    "uniform_limit {z. Re z \<in> {x..y}}
          (\<lambda>n z. LBINT u=ereal ((1/2)^Suc n)..exp (-1). f z u)
          (\<lambda>z. LBINT u=0..exp (-1). f z u) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit {z. Re z \<in> {x..y}} (\<lambda>n z. complex_interval_lebesgue_integral lborel (ereal ((1 / 2) ^ Suc n)) (ereal (exp (- 1))) (f z)) (\<lambda>z. complex_interval_lebesgue_integral lborel 0 (ereal (exp (- 1))) (f z)) sequentially
[PROOF STEP]
proof (rule filterlim_compose[OF uniform_limit1])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LIM x sequentially. ereal ((1 / 2) ^ Suc x) :> at_right 0
[PROOF STEP]
have "filterlim (\<lambda>n. (1/2)^Suc n :: real) (at_right 0) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM n sequentially. (1 / 2) ^ Suc n :> at_right 0
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
LIM n sequentially. (1 / 2) ^ Suc n :> at_right 0

goal (1 subgoal):
 1. LIM x sequentially. ereal ((1 / 2) ^ Suc x) :> at_right 0
[PROOF STEP]
hence "filtermap ereal (filtermap (\<lambda>n. ((1 / 2) ^ Suc n)) sequentially) \<le>
        filtermap ereal (at_right 0)"
[PROOF STATE]
proof (prove)
using this:
LIM n sequentially. (1 / 2) ^ Suc n :> at_right 0

goal (1 subgoal):
 1. filtermap ereal (filtermap (\<lambda>n. (1 / 2) ^ Suc n) sequentially) \<le> filtermap ereal (at_right 0)
[PROOF STEP]
unfolding filterlim_def
[PROOF STATE]
proof (prove)
using this:
filtermap (\<lambda>n. (1 / 2) ^ Suc n) sequentially \<le> at_right 0

goal (1 subgoal):
 1. filtermap ereal (filtermap (\<lambda>n. (1 / 2) ^ Suc n) sequentially) \<le> filtermap ereal (at_right 0)
[PROOF STEP]
by (rule filtermap_mono)
[PROOF STATE]
proof (state)
this:
filtermap ereal (filtermap (\<lambda>n. (1 / 2) ^ Suc n) sequentially) \<le> filtermap ereal (at_right 0)

goal (1 subgoal):
 1. LIM x sequentially. ereal ((1 / 2) ^ Suc x) :> at_right 0
[PROOF STEP]
thus "filterlim (\<lambda>n. ereal ((1/2)^Suc n)) (at_right 0) sequentially"
[PROOF STATE]
proof (prove)
using this:
filtermap ereal (filtermap (\<lambda>n. (1 / 2) ^ Suc n) sequentially) \<le> filtermap ereal (at_right 0)

goal (1 subgoal):
 1. LIM n sequentially. ereal ((1 / 2) ^ Suc n) :> at_right 0
[PROOF STEP]
unfolding zero_ereal_def at_right_ereal
[PROOF STATE]
proof (prove)
using this:
filtermap ereal (filtermap (\<lambda>n. (1 / 2) ^ Suc n) sequentially) \<le> filtermap ereal (at_right 0)

goal (1 subgoal):
 1. LIM n sequentially. ereal ((1 / 2) ^ Suc n) :> filtermap ereal (at_right 0)
[PROOF STEP]
by (simp add: filterlim_def filtermap_filtermap)
[PROOF STATE]
proof (state)
this:
LIM n sequentially. ereal ((1 / 2) ^ Suc n) :> at_right 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_cong_eq_0_iff: "prime p \<Longrightarrow> [a = 0] (mod p) \<longleftrightarrow> \<not>coprime a p" for a p :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> [a = 0] (mod p) = (\<not> coprime a p)
[PROOF STEP]
using not_coprime_cong_eq_0[of p a] cong_eq_0_not_coprime[of p a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>prime p; \<not> coprime a p\<rbrakk> \<Longrightarrow> [a = 0] (mod p)
\<lbrakk>prime p; [a = 0] (mod p)\<rbrakk> \<Longrightarrow> \<not> coprime a p

goal (1 subgoal):
 1. prime p \<Longrightarrow> [a = 0] (mod p) = (\<not> coprime a p)
[PROOF STEP]
by auto


[STATEMENT]
lemma lin_indpt_list_length_eq_n: assumes "lin_indpt_list xs"
  and "length xs = n"
shows "span (set xs) = carrier_vec n" "basis (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set xs) = carrier_vec n &&& basis (set xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. local.span (set xs) = carrier_vec n
 2. basis (set xs)
[PROOF STEP]
from assms[unfolded lin_indpt_list_def]
[PROOF STATE]
proof (chain)
picking this:
set xs \<subseteq> carrier_vec n \<and> distinct xs \<and> lin_indpt (set xs)
length xs = n
[PROOF STEP]
have xs: "set xs \<subseteq> carrier_vec n" and dist: "distinct xs" and lin: "lin_indpt (set xs)"
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> carrier_vec n \<and> distinct xs \<and> lin_indpt (set xs)
length xs = n

goal (1 subgoal):
 1. set xs \<subseteq> carrier_vec n &&& distinct xs &&& lin_indpt (set xs)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> carrier_vec n
distinct xs
lin_indpt (set xs)

goal (2 subgoals):
 1. local.span (set xs) = carrier_vec n
 2. basis (set xs)
[PROOF STEP]
from dist
[PROOF STATE]
proof (chain)
picking this:
distinct xs
[PROOF STEP]
have "card (set xs) = length xs"
[PROOF STATE]
proof (prove)
using this:
distinct xs

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

goal (2 subgoals):
 1. local.span (set xs) = carrier_vec n
 2. basis (set xs)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
lin_indpt_list xs
length xs = n
card (set xs) = length xs
[PROOF STEP]
have "card (set xs) = n"
[PROOF STATE]
proof (prove)
using this:
lin_indpt_list xs
length xs = n
card (set xs) = length xs

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

goal (2 subgoals):
 1. local.span (set xs) = carrier_vec n
 2. basis (set xs)
[PROOF STEP]
with lin xs
[PROOF STATE]
proof (chain)
picking this:
lin_indpt (set xs)
set xs \<subseteq> carrier_vec n
card (set xs) = n
[PROOF STEP]
show "span (set xs) = carrier_vec n" "basis (set xs)"
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set xs)
set xs \<subseteq> carrier_vec n
card (set xs) = n

goal (1 subgoal):
 1. local.span (set xs) = carrier_vec n &&& basis (set xs)
[PROOF STEP]
using dim_is_n
[PROOF STATE]
proof (prove)
using this:
lin_indpt (set xs)
set xs \<subseteq> carrier_vec n
card (set xs) = n
local.dim = n

goal (1 subgoal):
 1. local.span (set xs) = carrier_vec n &&& basis (set xs)
[PROOF STEP]
by (metis basis_def dim_basis dim_li_is_basis fin_dim finite_basis_exists gen_ge_dim li_le_dim(1))+
[PROOF STATE]
proof (state)
this:
local.span (set xs) = carrier_vec n
basis (set xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma binomial_coeffs_induct:
  fixes n k :: nat
  shows "(1 + fps_X)^n $ k = of_nat(n choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + fps_X) ^ n $ k = of_nat (n choose k)
[PROOF STEP]
proof (induct n arbitrary: k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k. (1 + fps_X) ^ 0 $ k = of_nat (0 choose k)
 2. \<And>n k. (\<And>k. (1 + fps_X) ^ n $ k = of_nat (n choose k)) \<Longrightarrow> (1 + fps_X) ^ Suc n $ k = of_nat (Suc n choose k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>k. (1 + fps_X) ^ 0 $ k = of_nat (0 choose k)
 2. \<And>n k. (\<And>k. (1 + fps_X) ^ n $ k = of_nat (n choose k)) \<Longrightarrow> (1 + fps_X) ^ Suc n $ k = of_nat (Suc n choose k)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + fps_X) ^ 0 $ k = of_nat (0 choose k)
[PROOF STEP]
by (metis binomial_eq_0_iff binomial_n_0 fps_nth_of_nat not_gr_zero of_nat_0 of_nat_1 power_0)
[PROOF STATE]
proof (state)
this:
(1 + fps_X) ^ 0 $ k = of_nat (0 choose k)

goal (1 subgoal):
 1. \<And>n k. (\<And>k. (1 + fps_X) ^ n $ k = of_nat (n choose k)) \<Longrightarrow> (1 + fps_X) ^ Suc n $ k = of_nat (Suc n choose k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n k. (\<And>k. (1 + fps_X) ^ n $ k = of_nat (n choose k)) \<Longrightarrow> (1 + fps_X) ^ Suc n $ k = of_nat (Suc n choose k)
[PROOF STEP]
case h: (Suc n)
[PROOF STATE]
proof (state)
this:
(1 + fps_X) ^ n $ ?k = of_nat (n choose ?k)

goal (1 subgoal):
 1. \<And>n k. (\<And>k. (1 + fps_X) ^ n $ k = of_nat (n choose k)) \<Longrightarrow> (1 + fps_X) ^ Suc n $ k = of_nat (Suc n choose k)
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n k. (\<And>k. (1 + fps_X) ^ n $ k = of_nat (n choose k)) \<Longrightarrow> (1 + fps_X) ^ Suc n $ k = of_nat (Suc n choose k)
[PROOF STEP]
have start: "(1 + fps_X)^(n + 1) = (1 + fps_X) * (1 + fps_X)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + fps_X) ^ (n + 1) = (1 + fps_X) * (1 + fps_X) ^ n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 + fps_X) ^ (n + 1) = (1 + fps_X) * (1 + fps_X) ^ n

goal (1 subgoal):
 1. \<And>n k. (\<And>k. (1 + fps_X) ^ n $ k = of_nat (n choose k)) \<Longrightarrow> (1 + fps_X) ^ Suc n $ k = of_nat (Suc n choose k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + fps_X) ^ Suc n $ ka__ = of_nat (Suc n choose ka__)
[PROOF STEP]
using One_nat_def Suc_eq_plus1 Suc_pred add.commute binomial_Suc_Suc binomial_n_0
        fps_mult_fps_X_plus_1_nth h.hyps neq0_conv start
[PROOF STATE]
proof (prove)
using this:
1 = Suc 0
Suc ?n = ?n + 1
0 < ?n \<Longrightarrow> Suc (?n - Suc 0) = ?n
?a + ?b = ?b + ?a
Suc ?n choose Suc ?k = ?n choose ?k + (?n choose Suc ?k)
?n choose 0 = 1
((1 + fps_X) * ?a) $ ?n = (if ?n = 0 then ?a $ ?n else ?a $ ?n + ?a $ (?n - 1))
(1 + fps_X) ^ n $ ?k = of_nat (n choose ?k)
(?n \<noteq> 0) = (0 < ?n)
(1 + fps_X) ^ (n + 1) = (1 + fps_X) * (1 + fps_X) ^ n

goal (1 subgoal):
 1. (1 + fps_X) ^ Suc n $ ka__ = of_nat (Suc n choose ka__)
[PROOF STEP]
by (smt of_nat_add)
[PROOF STATE]
proof (state)
this:
(1 + fps_X) ^ Suc n $ ka__ = of_nat (Suc n choose ka__)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "!!x. (x::nat) - y = 0 ==> x <= y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x - y = 0 \<Longrightarrow> x \<le> y
[PROOF STEP]
by linarith


[STATEMENT]
lemma "(\<lambda>x::real. ((x + 4) powr (3/2) + exp x - 9) / x) \<midarrow>0\<rightarrow> 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ((x + 4) powr (3 / 2) + exp x - 9) / x) \<midarrow>0\<rightarrow> 4
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma coeff_mult:
  assumes "subring K R"
  assumes "f \<in> carrier (K[X])" "g \<in> carrier (K[X])"
  shows "coeff (f \<otimes>\<^bsub>K[X]\<^esub> g) i =
    (\<Oplus> k \<in> {..i}. (coeff f) k \<otimes> (coeff g) (i - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (f \<otimes>\<^bsub>K [X]\<^esub> g) i = (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.coeff (f \<otimes>\<^bsub>K [X]\<^esub> g) i = (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k))
[PROOF STEP]
have a:"set f \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set f \<subseteq> carrier R
[PROOF STEP]
using assms(1,2) univ_poly_carrier
[PROOF STATE]
proof (prove)
using this:
subring K R
f \<in> carrier (K [X])
polynomial\<^bsub>?R\<^esub> ?K ?p = (?p \<in> carrier (?K [X]\<^bsub>?R\<^esub>))

goal (1 subgoal):
 1. set f \<subseteq> carrier R
[PROOF STEP]
using subringE(1)[OF assms(1)] polynomial_incl
[PROOF STATE]
proof (prove)
using this:
subring K R
f \<in> carrier (K [X])
polynomial\<^bsub>?R\<^esub> ?K ?p = (?p \<in> carrier (?K [X]\<^bsub>?R\<^esub>))
K \<subseteq> carrier R
polynomial ?K ?p \<Longrightarrow> set ?p \<subseteq> ?K

goal (1 subgoal):
 1. set f \<subseteq> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set f \<subseteq> carrier R

goal (1 subgoal):
 1. local.coeff (f \<otimes>\<^bsub>K [X]\<^esub> g) i = (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k))
[PROOF STEP]
have b:"set g \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set g \<subseteq> carrier R
[PROOF STEP]
using assms(1,3) univ_poly_carrier
[PROOF STATE]
proof (prove)
using this:
subring K R
g \<in> carrier (K [X])
polynomial\<^bsub>?R\<^esub> ?K ?p = (?p \<in> carrier (?K [X]\<^bsub>?R\<^esub>))

goal (1 subgoal):
 1. set g \<subseteq> carrier R
[PROOF STEP]
using subringE(1)[OF assms(1)] polynomial_incl
[PROOF STATE]
proof (prove)
using this:
subring K R
g \<in> carrier (K [X])
polynomial\<^bsub>?R\<^esub> ?K ?p = (?p \<in> carrier (?K [X]\<^bsub>?R\<^esub>))
K \<subseteq> carrier R
polynomial ?K ?p \<Longrightarrow> set ?p \<subseteq> ?K

goal (1 subgoal):
 1. set g \<subseteq> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set g \<subseteq> carrier R

goal (1 subgoal):
 1. local.coeff (f \<otimes>\<^bsub>K [X]\<^esub> g) i = (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (f \<otimes>\<^bsub>K [X]\<^esub> g) i = (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k))
[PROOF STEP]
unfolding univ_poly_mult poly_mult_coeff[OF a b]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k)) = (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.coeff (f \<otimes>\<^bsub>K [X]\<^esub> g) i = (\<Oplus>k\<in>{..i}. local.coeff f k \<otimes> local.coeff g (i - k))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interior_of_Union_openin_subsets:
   "\<Union>{T. openin X T \<and> T \<subseteq> S} = X interior_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> {T. openin X T \<and> T \<subseteq> S} = X interior_of S
[PROOF STEP]
by (rule interior_of_unique [symmetric]) auto


[STATEMENT]
lemma real_sqrt_gt_zero: "0 < x \<Longrightarrow> 0 < sqrt x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> 0 < sqrt x
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> 0 < root 2 x
[PROOF STEP]
by (rule real_root_gt_zero [OF pos2])


[STATEMENT]
theorem sylow_thm:
  "\<lbrakk>prime p; group G; order G = (p^a) * m; finite (carrier G)\<rbrakk>
    \<Longrightarrow> \<exists>H. subgroup H G \<and> card H = p^a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>prime p; Group.group G; order G = p ^ a * m; finite (carrier G)\<rbrakk> \<Longrightarrow> \<exists>H. subgroup H G \<and> card H = p ^ a
[PROOF STEP]
by (rule sylow.sylow_thm [of G p a m]) (simp add: sylow_eq sylow_axioms_def)


[STATEMENT]
lemma bag_of_nths_Un_disjoint:
     "A Int B = {}
      ==> bag_of (nths l (A Un B)) =
          bag_of (nths l A) + bag_of (nths l B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter> B = {} \<Longrightarrow> mset (nths l (A \<union> B)) = mset (nths l A) + mset (nths l B)
[PROOF STEP]
by (simp add: bag_of_nths_Un_Int [symmetric])


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

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


[STATEMENT]
lemma set_of_minus: "set_of (X - Y) = {x - y | x y . x \<in> set_of X \<and> y \<in> set_of Y}"
  for X Y :: "'a :: linordered_ab_group_add interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of (X - Y) = {x - y |x y. x \<in>\<^sub>i X \<and> y \<in>\<^sub>i Y}
[PROOF STEP]
unfolding minus_interval_def set_of_plus set_of_uminus set_plus_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {c. \<exists>a\<in>set_of X. \<exists>b\<in>{- x |x. x \<in>\<^sub>i Y}. c = a + b} = {x - y |x y. x \<in>\<^sub>i X \<and> y \<in>\<^sub>i Y}
[PROOF STEP]
by force