[STATEMENT]
lemma (in pair_sigma_finite) integral_product_swap:
  fixes f :: "_ \<Rightarrow> _::{banach, second_countable_topology}"
  assumes f: "f \<in> borel_measurable (M1 \<Otimes>\<^sub>M M2)"
  shows "(\<integral>(x,y). f (y,x) \<partial>(M2 \<Otimes>\<^sub>M M1)) = integral\<^sup>L (M1 \<Otimes>\<^sub>M M2) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT (x, y)|(M2 \<Otimes>\<^sub>M M1). f (y, x) = integral\<^sup>L (M1 \<Otimes>\<^sub>M M2) f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LINT (x, y)|(M2 \<Otimes>\<^sub>M M1). f (y, x) = integral\<^sup>L (M1 \<Otimes>\<^sub>M M2) f
[PROOF STEP]
have *: "(\<lambda>(x,y). f (y,x)) = (\<lambda>x. f (case x of (x,y)\<Rightarrow>(y,x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). f (y, x)) = (\<lambda>x. f (case x of (x, y) \<Rightarrow> (y, x)))
[PROOF STEP]
by (auto simp: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). f (y, x)) = (\<lambda>x. f (case x of (x, y) \<Rightarrow> (y, x)))

goal (1 subgoal):
 1. LINT (x, y)|(M2 \<Otimes>\<^sub>M M1). f (y, x) = integral\<^sup>L (M1 \<Otimes>\<^sub>M M2) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT (x, y)|(M2 \<Otimes>\<^sub>M M1). f (y, x) = integral\<^sup>L (M1 \<Otimes>\<^sub>M M2) f
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|(M2 \<Otimes>\<^sub>M M1). f (case x of (x, y) \<Rightarrow> (y, x)) = integral\<^sup>L (M1 \<Otimes>\<^sub>M M2) f
[PROOF STEP]
by (simp add: integral_distr[symmetric, OF measurable_pair_swap' f] distr_pair_swap[symmetric])
[PROOF STATE]
proof (state)
this:
LINT (x, y)|(M2 \<Otimes>\<^sub>M M1). f (y, x) = integral\<^sup>L (M1 \<Otimes>\<^sub>M M2) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_mirror_eq_conv: "
  \<lbrakk> a \<le> l + r; b \<le> l + r \<rbrakk> \<Longrightarrow>
  (nat_mirror a l r = nat_mirror b l r) = (a = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> l + r; b \<le> l + r\<rbrakk> \<Longrightarrow> (nat_mirror a l r = nat_mirror b l r) = (a = b)
[PROOF STEP]
unfolding nat_mirror_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> l + r; b \<le> l + r\<rbrakk> \<Longrightarrow> (l + r - a = l + r - b) = (a = b)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma absdiff_infnorm: "\<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)
[PROOF STEP]
have *: "\<And>(nx::real) n ny. nx \<le> n + ny \<Longrightarrow> ny \<le> n + nx \<Longrightarrow> \<bar>nx - ny\<bar> \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nx n ny. \<lbrakk>nx \<le> n + ny; ny \<le> n + nx\<rbrakk> \<Longrightarrow> \<bar>nx - ny\<bar> \<le> n
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
\<lbrakk>?nx \<le> ?n + ?ny; ?ny \<le> ?n + ?nx\<rbrakk> \<Longrightarrow> \<bar>?nx - ?ny\<bar> \<le> ?n

goal (1 subgoal):
 1. \<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)
[PROOF STEP]
proof (rule *)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. infnorm x \<le> infnorm (x - y) + infnorm y
 2. infnorm y \<le> infnorm (x - y) + infnorm x
[PROOF STEP]
from infnorm_triangle[of "x - y" " y"] infnorm_triangle[of "x - y" "-x"]
[PROOF STATE]
proof (chain)
picking this:
infnorm (x - y + y) \<le> infnorm (x - y) + infnorm y
infnorm (x - y + - x) \<le> infnorm (x - y) + infnorm (- x)
[PROOF STEP]
show "infnorm x \<le> infnorm (x - y) + infnorm y" "infnorm y \<le> infnorm (x - y) + infnorm x"
[PROOF STATE]
proof (prove)
using this:
infnorm (x - y + y) \<le> infnorm (x - y) + infnorm y
infnorm (x - y + - x) \<le> infnorm (x - y) + infnorm (- x)

goal (1 subgoal):
 1. infnorm x \<le> infnorm (x - y) + infnorm y &&& infnorm y \<le> infnorm (x - y) + infnorm x
[PROOF STEP]
by (simp_all add: field_simps infnorm_neg)
[PROOF STATE]
proof (state)
this:
infnorm x \<le> infnorm (x - y) + infnorm y
infnorm y \<le> infnorm (x - y) + infnorm x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>infnorm x - infnorm y\<bar> \<le> infnorm (x - y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma meval_trm_eval_trm: "wf_tuple n A x \<Longrightarrow> fv_trm t \<subseteq> A \<Longrightarrow> \<forall>i\<in>A. i < n \<Longrightarrow>
    meval_trm t x = Formula.eval_trm (map the x) t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_tuple n A x; fv_trm t \<subseteq> A; \<forall>i\<in>A. i < n\<rbrakk> \<Longrightarrow> meval_trm t x = Formula.eval_trm (map the x) t
[PROOF STEP]
unfolding wf_tuple_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length x = n \<and> (\<forall>i<n. (x ! i = None) = (i \<notin> A)); fv_trm t \<subseteq> A; \<forall>i\<in>A. i < n\<rbrakk> \<Longrightarrow> meval_trm t x = Formula.eval_trm (map the x) t
[PROOF STEP]
by (induction t) simp_all


[STATEMENT]
theorem nat_to_set_srj1: "finite (D::nat set) \<Longrightarrow> \<exists> u. nat_to_set u = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite D \<Longrightarrow> \<exists>u. nat_to_set u = D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite D \<Longrightarrow> \<exists>u. nat_to_set u = D
[PROOF STEP]
assume A: "finite D"
[PROOF STATE]
proof (state)
this:
finite D

goal (1 subgoal):
 1. finite D \<Longrightarrow> \<exists>u. nat_to_set u = D
[PROOF STEP]
show " \<exists> u. nat_to_set u = D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>u. nat_to_set u = D
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nat_to_set ?u = D
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
finite D
[PROOF STEP]
show "nat_to_set (set_to_nat D) = D"
[PROOF STATE]
proof (prove)
using this:
finite D

goal (1 subgoal):
 1. nat_to_set (set_to_nat D) = D
[PROOF STEP]
by (rule nat_to_set_srj)
[PROOF STATE]
proof (state)
this:
nat_to_set (set_to_nat D) = D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>u. nat_to_set u = D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insertion_fun_add:
  fixes f p q
  shows "insertion_fun f (Poly_Mapping.lookup (p + q)) =
    insertion_fun f (Poly_Mapping.lookup p) +
      insertion_fun f (Poly_Mapping.lookup q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion_fun f (poly_mapping.lookup (p + q)) = insertion_fun f (poly_mapping.lookup p) + insertion_fun f (poly_mapping.lookup q)
[PROOF STEP]
unfolding insertion_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>m. poly_mapping.lookup (p + q) m * (\<Prod>v. f v ^ poly_mapping.lookup m v)) = (\<Sum>m. poly_mapping.lookup p m * (\<Prod>v. f v ^ poly_mapping.lookup m v)) + (\<Sum>m. poly_mapping.lookup q m * (\<Prod>v. f v ^ poly_mapping.lookup m v))
[PROOF STEP]
apply (subst Sum_any.distrib [symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. finite {a. poly_mapping.lookup p a * (\<Prod>v. f v ^ poly_mapping.lookup a v) \<noteq> (0::'a)}
 2. finite {a. poly_mapping.lookup q a * (\<Prod>v. f v ^ poly_mapping.lookup a v) \<noteq> (0::'a)}
 3. (\<Sum>m. poly_mapping.lookup (p + q) m * (\<Prod>v. f v ^ poly_mapping.lookup m v)) = (\<Sum>a. poly_mapping.lookup p a * (\<Prod>v. f v ^ poly_mapping.lookup a v) + poly_mapping.lookup q a * (\<Prod>v. f v ^ poly_mapping.lookup a v))
[PROOF STEP]
apply (simp_all add: plus_poly_mapping.rep_eq algebra_simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {a. poly_mapping.lookup p a * (\<Prod>v. f v ^ poly_mapping.lookup a v) \<noteq> (0::'a)}
 2. finite {a. poly_mapping.lookup q a * (\<Prod>v. f v ^ poly_mapping.lookup a v) \<noteq> (0::'a)}
[PROOF STEP]
apply (rule finite_mult_not_eq_zero_rightI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {a. poly_mapping.lookup p a \<noteq> (0::'a)}
 2. finite {a. poly_mapping.lookup q a * (\<Prod>v. f v ^ poly_mapping.lookup a v) \<noteq> (0::'a)}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {a. poly_mapping.lookup q a * (\<Prod>v. f v ^ poly_mapping.lookup a v) \<noteq> (0::'a)}
[PROOF STEP]
apply (rule finite_mult_not_eq_zero_rightI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {a. poly_mapping.lookup q a \<noteq> (0::'a)}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma compact_sums:
  fixes s t :: "'a::real_normed_vector set"
  assumes "compact s"
    and "compact t"
  shows "compact {x + y | x y. x \<in> s \<and> y \<in> t}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact {x + y |x y. x \<in> s \<and> y \<in> t}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compact {x + y |x y. x \<in> s \<and> y \<in> t}
[PROOF STEP]
have *: "{x + y | x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x + y |x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)
[PROOF STEP]
by (fastforce simp: image_iff)
[PROOF STATE]
proof (state)
this:
{x + y |x y. x \<in> s \<and> y \<in> t} = (\<lambda>z. fst z + snd z) ` (s \<times> t)

goal (1 subgoal):
 1. compact {x + y |x y. x \<in> s \<and> y \<in> t}
[PROOF STEP]
have "continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)
[PROOF STEP]
unfolding continuous_on
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>s \<times> t. ((\<lambda>z. fst z + snd z) \<longlongrightarrow> fst x + snd x) (at x within s \<times> t)
[PROOF STEP]
by (rule ballI) (intro tendsto_intros)
[PROOF STATE]
proof (state)
this:
continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)

goal (1 subgoal):
 1. compact {x + y |x y. x \<in> s \<and> y \<in> t}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)

goal (1 subgoal):
 1. compact {x + y |x y. x \<in> s \<and> y \<in> t}
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
using this:
continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)

goal (1 subgoal):
 1. compact ((\<lambda>z. fst z + snd z) ` (s \<times> t))
[PROOF STEP]
using compact_continuous_image compact_Times [OF assms]
[PROOF STATE]
proof (prove)
using this:
continuous_on (s \<times> t) (\<lambda>z. fst z + snd z)
\<lbrakk>continuous_on ?s ?f; compact ?s\<rbrakk> \<Longrightarrow> compact (?f ` ?s)
compact (s \<times> t)

goal (1 subgoal):
 1. compact ((\<lambda>z. fst z + snd z) ` (s \<times> t))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
compact {x + y |x y. x \<in> s \<and> y \<in> t}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bin_prime_factor:
  assumes "prime p"
  assumes "k > 0" "k < p"
  shows "p dvd (p choose k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd p choose k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p dvd p choose k
[PROOF STEP]
have "p dvd fact p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd fact p
[PROOF STEP]
using assms(1) prime_dvd_fact_iff
[PROOF STATE]
proof (prove)
using this:
normalization_semidom_class.prime p
normalization_semidom_class.prime ?p \<Longrightarrow> (?p dvd fact ?n) = (?p \<le> ?n)

goal (1 subgoal):
 1. p dvd fact p
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p dvd fact p

goal (1 subgoal):
 1. p dvd p choose k
[PROOF STEP]
hence "p dvd fact k * fact (p - k) * (p choose k)"
[PROOF STATE]
proof (prove)
using this:
p dvd fact p

goal (1 subgoal):
 1. p dvd fact k * fact (p - k) * (p choose k)
[PROOF STEP]
using binomial_fact_lemma assms
[PROOF STATE]
proof (prove)
using this:
p dvd fact p
?k \<le> ?n \<Longrightarrow> fact ?k * fact (?n - ?k) * (?n choose ?k) = fact ?n
normalization_semidom_class.prime p
0 < k
k < p

goal (1 subgoal):
 1. p dvd fact k * fact (p - k) * (p choose k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p dvd fact k * fact (p - k) * (p choose k)

goal (1 subgoal):
 1. p dvd p choose k
[PROOF STEP]
hence "p dvd fact k \<or> p dvd fact (p-k) \<or> p dvd (p choose k)"
[PROOF STATE]
proof (prove)
using this:
p dvd fact k * fact (p - k) * (p choose k)

goal (1 subgoal):
 1. p dvd fact k \<or> p dvd fact (p - k) \<or> p dvd p choose k
[PROOF STEP]
by (simp add: assms(1) prime_dvd_mult_eq_nat)
[PROOF STATE]
proof (state)
this:
p dvd fact k \<or> p dvd fact (p - k) \<or> p dvd p choose k

goal (1 subgoal):
 1. p dvd p choose k
[PROOF STEP]
thus "p dvd (p choose k)"
[PROOF STATE]
proof (prove)
using this:
p dvd fact k \<or> p dvd fact (p - k) \<or> p dvd p choose k

goal (1 subgoal):
 1. p dvd p choose k
[PROOF STEP]
using assms(1,2,3) prime_dvd_fact_iff
[PROOF STATE]
proof (prove)
using this:
p dvd fact k \<or> p dvd fact (p - k) \<or> p dvd p choose k
normalization_semidom_class.prime p
0 < k
k < p
normalization_semidom_class.prime ?p \<Longrightarrow> (?p dvd fact ?n) = (?p \<le> ?n)

goal (1 subgoal):
 1. p dvd p choose k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p dvd p choose k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bounded_imp_summable:
  fixes a :: "nat \<Rightarrow> 'a::{conditionally_complete_linorder,linorder_topology,linordered_comm_semiring_strict}"
  assumes 0: "\<And>n. a n \<ge> 0" and bounded: "\<And>n. (\<Sum>k\<le>n. a k) \<le> B"
  shows "summable a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. summable a
[PROOF STEP]
have "bdd_above (range(\<lambda>n. \<Sum>k\<le>n. a k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_above (range (\<lambda>n. sum a {..n}))
[PROOF STEP]
by (meson bdd_aboveI2 bounded)
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. sum a {..n}))

goal (1 subgoal):
 1. summable a
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bdd_above (range (\<lambda>n. sum a {..n}))

goal (1 subgoal):
 1. summable a
[PROOF STEP]
have "incseq (\<lambda>n. \<Sum>k\<le>n. a k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. incseq (\<lambda>n. sum a {..n})
[PROOF STEP]
by (simp add: mono_def "0" sum_mono2)
[PROOF STATE]
proof (state)
this:
incseq (\<lambda>n. sum a {..n})

goal (1 subgoal):
 1. summable a
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bdd_above (range (\<lambda>n. sum a {..n}))
incseq (\<lambda>n. sum a {..n})
[PROOF STEP]
obtain s where "(\<lambda>n. \<Sum>k\<le>n. a k) \<longlonglongrightarrow> s"
[PROOF STATE]
proof (prove)
using this:
bdd_above (range (\<lambda>n. sum a {..n}))
incseq (\<lambda>n. sum a {..n})

goal (1 subgoal):
 1. (\<And>s. (\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using LIMSEQ_incseq_SUP
[PROOF STATE]
proof (prove)
using this:
bdd_above (range (\<lambda>n. sum a {..n}))
incseq (\<lambda>n. sum a {..n})
\<lbrakk>bdd_above (range ?X); incseq ?X\<rbrakk> \<Longrightarrow> ?X \<longlonglongrightarrow> Sup (range ?X)

goal (1 subgoal):
 1. (\<And>s. (\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s

goal (1 subgoal):
 1. summable a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. sum a {..n}) \<longlonglongrightarrow> s

goal (1 subgoal):
 1. summable a
[PROOF STEP]
by (auto simp: sums_def_le summable_def)
[PROOF STATE]
proof (state)
this:
summable a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fstar_pred_char:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  shows "mono f \<Longrightarrow> fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mono f \<Longrightarrow> fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
assume hyp: "mono f"
[PROOF STATE]
proof (state)
this:
mono f

goal (1 subgoal):
 1. mono f \<Longrightarrow> fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
have "\<forall>g. (id \<sqinter> (f \<circ> g)) x = x \<sqinter> f (g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>g. (id \<sqinter> (f \<circ> g)) x = x \<sqinter> f (g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>g. (id \<sqinter> (f \<circ> g)) x = x \<sqinter> f (g x)

goal (1 subgoal):
 1. mono f \<Longrightarrow> fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
hence "\<forall>g. fiter_fun id f g x = (\<lambda>y. x \<sqinter> f y) (g x)"
[PROOF STATE]
proof (prove)
using this:
\<forall>g. (id \<sqinter> (f \<circ> g)) x = x \<sqinter> f (g x)

goal (1 subgoal):
 1. \<forall>g. fiter_fun id f g x = x \<sqinter> f (g x)
[PROOF STEP]
unfolding fiter_fun_def
[PROOF STATE]
proof (prove)
using this:
\<forall>g. (id \<sqinter> (f \<circ> g)) x = x \<sqinter> f (g x)

goal (1 subgoal):
 1. \<forall>g. ((\<sqinter>) id \<circ> (\<circ>) f) g x = x \<sqinter> f (g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>g. fiter_fun id f g x = x \<sqinter> f (g x)

goal (1 subgoal):
 1. mono f \<Longrightarrow> fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>g. fiter_fun id f g x = x \<sqinter> f (g x)

goal (1 subgoal):
 1. fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)
[PROOF STEP]
by (simp add: fiter_id_def fiter_def gfp_fusion_var hyp iso_fiter_fun2 iso_id iso_fiter_ext)
[PROOF STATE]
proof (state)
this:
fiter_id f x = gfp (\<lambda>y. x \<sqinter> f y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_integral_Beta2:
  fixes a :: real
  assumes "a < -1/2"
  shows   "((\<lambda>x. (1 + x ^ 2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
define f where "f = (\<lambda>u. u powr (-1/2) / (1 + u) powr (-a))"
[PROOF STATE]
proof (state)
this:
f = (\<lambda>u. u powr (- 1 / 2) / (1 + u) powr - a)

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
define C where "C = Beta (-a-1/2) (1/2)"
[PROOF STATE]
proof (state)
this:
C = Beta (- a - 1 / 2) (1 / 2)

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
have I: "(f has_integral C) {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral C) {0<..}
[PROOF STEP]
using has_integral_Beta_real'[of "-a-1/2" "1/2"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < - a - 1 / 2; 0 < 1 / 2\<rbrakk> \<Longrightarrow> ((\<lambda>u. u powr (1 / 2 - 1) / (1 + u) powr (- a - 1 / 2 + 1 / 2)) has_integral Beta (- a - 1 / 2) (1 / 2)) {0<..}
a < - 1 / 2

goal (1 subgoal):
 1. (f has_integral C) {0<..}
[PROOF STEP]
by (simp_all add: diff_divide_distrib f_def C_def)
[PROOF STATE]
proof (state)
this:
(f has_integral C) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
define g where "g = (\<lambda>x. x ^ 2 :: real)"
[PROOF STATE]
proof (state)
this:
g = power2

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
have bij: "bij_betw g {0<..} {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw g {0<..} {0<..}
[PROOF STEP]
by (intro bij_betwI[of _ _ _ sqrt]) (auto simp: g_def)
[PROOF STATE]
proof (state)
this:
bij_betw g {0<..} {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
have "(f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C
[PROOF STEP]
using I bij
[PROOF STATE]
proof (prove)
using this:
(f has_integral C) {0<..}
bij_betw g {0<..} {0<..}

goal (1 subgoal):
 1. f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C
[PROOF STEP]
by (simp add: bij_betw_def has_integral_iff absolutely_integrable_on_def f_def)
[PROOF STATE]
proof (state)
this:
f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
have "?this \<longleftrightarrow> ((\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on {0<..} \<and>
                         integral {0<..} (\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) = C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C) = ((\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on {0<..} \<and> integral {0<..} (\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) = C)
[PROOF STEP]
using bij
[PROOF STATE]
proof (prove)
using this:
bij_betw g {0<..} {0<..}

goal (1 subgoal):
 1. (f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C) = ((\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on {0<..} \<and> integral {0<..} (\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) = C)
[PROOF STEP]
by (intro has_absolute_integral_change_of_variables_1' [symmetric])
                 (auto intro!: derivative_eq_intros simp: g_def bij_betw_def)
[PROOF STATE]
proof (state)
this:
(f absolutely_integrable_on g ` {0<..} \<and> integral (g ` {0<..}) f = C) = ((\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on {0<..} \<and> integral {0<..} (\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) = C)

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on {0<..} \<and> integral {0<..} (\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) = C
[PROOF STEP]
have "((\<lambda>x. \<bar>2 * x\<bar> * f (g x)) has_integral C) {0<..}"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) absolutely_integrable_on {0<..} \<and> integral {0<..} (\<lambda>x. \<bar>2 * x\<bar> *\<^sub>R f (g x)) = C

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>2 * x\<bar> * f (g x)) has_integral C) {0<..}
[PROOF STEP]
by (simp add: absolutely_integrable_on_def f_def has_integral_iff)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>2 * x\<bar> * f (g x)) has_integral C) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>2 * x\<bar> * f (g x)) has_integral C) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
have "?this \<longleftrightarrow> ((\<lambda>x::real. 2 * (1 + x\<^sup>2) powr a) has_integral C) {0<..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>2 * x\<bar> * f (g x)) has_integral C) {0<..} = ((\<lambda>x. 2 * (1 + x\<^sup>2) powr a) has_integral C) {0<..}
[PROOF STEP]
by (intro has_integral_cong) (auto simp: f_def g_def powr_def exp_minus ln_realpow field_simps)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>2 * x\<bar> * f (g x)) has_integral C) {0<..} = ((\<lambda>x. 2 * (1 + x\<^sup>2) powr a) has_integral C) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. 2 * (1 + x\<^sup>2) powr a) has_integral C) {0<..}
[PROOF STEP]
have "((\<lambda>x::real. 1/2 * (2 * (1 + x\<^sup>2) powr a)) has_integral 1/2 * C) {0<..}"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. 2 * (1 + x\<^sup>2) powr a) has_integral C) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. 1 / 2 * (2 * (1 + x\<^sup>2) powr a)) has_integral 1 / 2 * C) {0<..}
[PROOF STEP]
by (intro has_integral_mult_right)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. 1 / 2 * (2 * (1 + x\<^sup>2) powr a)) has_integral 1 / 2 * C) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. 1 / 2 * (2 * (1 + x\<^sup>2) powr a)) has_integral 1 / 2 * C) {0<..}

goal (1 subgoal):
 1. ((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}
[PROOF STEP]
by (simp add: C_def)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. (1 + x\<^sup>2) powr a) has_integral Beta (- a - 1 / 2) (1 / 2) / 2) {0<..}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quasi_isometry_onD:
  assumes "lambda C-quasi_isometry_on X f"
  shows "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) \<le> lambda * dist x y + C"
        "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) \<ge> (1/lambda) * dist x y - C"
        "lambda \<ge> 1" "C \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>x y. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> dist (f x) (f y) \<le> lambda * dist x y + C) &&& (\<And>x y. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> 1 / lambda * dist x y - C \<le> dist (f x) (f y))) &&& 1 \<le> lambda &&& 0 \<le> C
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
lambda C -quasi_isometry_on X f

goal (1 subgoal):
 1. ((\<And>x y. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> dist (f x) (f y) \<le> lambda * dist x y + C) &&& (\<And>x y. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> 1 / lambda * dist x y - C \<le> dist (f x) (f y))) &&& 1 \<le> lambda &&& 0 \<le> C
[PROOF STEP]
unfolding quasi_isometry_on_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> lambda \<and> 0 \<le> C \<and> (\<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) \<le> lambda * dist x y + C \<and> 1 / lambda * dist x y - C \<le> dist (f x) (f y))

goal (1 subgoal):
 1. ((\<And>x y. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> dist (f x) (f y) \<le> lambda * dist x y + C) &&& (\<And>x y. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> 1 / lambda * dist x y - C \<le> dist (f x) (f y))) &&& 1 \<le> lambda &&& 0 \<le> C
[PROOF STEP]
by auto


[STATEMENT]
lemma weak_sup_insert [simp]:
  assumes "a \<in> carrier L" "A \<subseteq> carrier L"
  shows "\<Squnion>insert a A .= a \<squnion> \<Squnion>A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>insert a A .= a \<squnion> \<Squnion>A
[PROOF STEP]
proof (rule weak_le_antisym)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<Squnion>insert a A \<sqsubseteq> a \<squnion> \<Squnion>A
 2. a \<squnion> \<Squnion>A \<sqsubseteq> \<Squnion>insert a A
 3. \<Squnion>insert a A \<in> carrier L
 4. a \<squnion> \<Squnion>A \<in> carrier L
[PROOF STEP]
show aA: "a \<squnion> \<Squnion>A \<in> carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<squnion> \<Squnion>A \<in> carrier L
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier L
A \<subseteq> carrier L

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

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

goal (3 subgoals):
 1. insert a A \<subseteq> carrier L
 2. a \<squnion> \<Squnion>A \<in> carrier L
 3. \<And>x. x \<in> insert a A \<Longrightarrow> x \<sqsubseteq> a \<squnion> \<Squnion>A
[PROOF STEP]
apply (simp_all add: aA)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x = a \<or> x \<in> A; a \<in> carrier L; A \<subseteq> carrier L\<rbrakk> \<Longrightarrow> x \<sqsubseteq> a \<squnion> \<Squnion>A
[PROOF STEP]
by (meson aA join_left join_right local.le_trans subsetCE sup_closed sup_upper)
[PROOF STATE]
proof (state)
this:
\<Squnion>insert a A \<sqsubseteq> a \<squnion> \<Squnion>A

goal (2 subgoals):
 1. a \<squnion> \<Squnion>A \<sqsubseteq> \<Squnion>insert a A
 2. \<Squnion>insert a A \<in> carrier L
[PROOF STEP]
show "a \<squnion> \<Squnion>A \<sqsubseteq> \<Squnion>insert a A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<squnion> \<Squnion>A \<sqsubseteq> \<Squnion>insert a A
[PROOF STEP]
by (simp add: assms join_le local.sup_least sup_upper)
[PROOF STATE]
proof (state)
this:
a \<squnion> \<Squnion>A \<sqsubseteq> \<Squnion>insert a A

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma indets_empty_iff_poly_deg_zero: "indets p = {} \<longleftrightarrow> poly_deg p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (indets p = {}) = (poly_deg p = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. indets p = {} \<Longrightarrow> poly_deg p = 0
 2. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
assume "indets p = {}"
[PROOF STATE]
proof (state)
this:
indets p = {}

goal (2 subgoals):
 1. indets p = {} \<Longrightarrow> poly_deg p = 0
 2. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
hence "monomial (lookup p 0) 0 = p"
[PROOF STATE]
proof (prove)
using this:
indets p = {}

goal (1 subgoal):
 1. monomial (lookup p 0) 0 = p
[PROOF STEP]
by (rule indets_empty_imp_monomial)
[PROOF STATE]
proof (state)
this:
monomial (lookup p 0) 0 = p

goal (2 subgoals):
 1. indets p = {} \<Longrightarrow> poly_deg p = 0
 2. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
monomial (lookup p 0) 0 = p

goal (2 subgoals):
 1. indets p = {} \<Longrightarrow> poly_deg p = 0
 2. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
have "poly_deg (monomial (lookup p 0) 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg (monomial (lookup p 0) 0) = (0::'c)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_deg (monomial (lookup p 0) 0) = (0::?'c1)

goal (2 subgoals):
 1. indets p = {} \<Longrightarrow> poly_deg p = 0
 2. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
monomial (lookup p 0) 0 = p
poly_deg (monomial (lookup p 0) 0) = (0::?'c1)
[PROOF STEP]
show "poly_deg p = 0"
[PROOF STATE]
proof (prove)
using this:
monomial (lookup p 0) 0 = p
poly_deg (monomial (lookup p 0) 0) = (0::?'c1)

goal (1 subgoal):
 1. poly_deg p = 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
poly_deg p = 0

goal (1 subgoal):
 1. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
assume "poly_deg p = 0"
[PROOF STATE]
proof (state)
this:
poly_deg p = 0

goal (1 subgoal):
 1. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
hence "monomial (lookup p 0) 0 = p"
[PROOF STATE]
proof (prove)
using this:
poly_deg p = 0

goal (1 subgoal):
 1. monomial (lookup p 0) 0 = p
[PROOF STEP]
by (rule poly_deg_zero_imp_monomial)
[PROOF STATE]
proof (state)
this:
monomial (lookup p 0) 0 = p

goal (1 subgoal):
 1. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
monomial (lookup p 0) 0 = p

goal (1 subgoal):
 1. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
have "indets (monomial (lookup p 0) 0) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indets (monomial (lookup p 0) 0) = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
indets (monomial (lookup p 0) 0) = {}

goal (1 subgoal):
 1. poly_deg p = 0 \<Longrightarrow> indets p = {}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
monomial (lookup p 0) 0 = p
indets (monomial (lookup p 0) 0) = {}
[PROOF STEP]
show "indets p = {}"
[PROOF STATE]
proof (prove)
using this:
monomial (lookup p 0) 0 = p
indets (monomial (lookup p 0) 0) = {}

goal (1 subgoal):
 1. indets p = {}
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
indets p = {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma countable_add:
  assumes "countable (elts A)" "countable (elts B)"
  shows "countable (elts (A+B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (elts (A + B))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. countable (elts (A + B))
[PROOF STEP]
have "vcard A \<le> \<aleph>0" "vcard B \<le> \<aleph>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard A \<le> \<aleph>0 &&& vcard B \<le> \<aleph>0
[PROOF STEP]
using assms countable_iff_le_Aleph0
[PROOF STATE]
proof (prove)
using this:
countable (elts A)
countable (elts B)
countable (elts ?A) = (vcard ?A \<le> \<aleph>0)

goal (1 subgoal):
 1. vcard A \<le> \<aleph>0 &&& vcard B \<le> \<aleph>0
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
vcard A \<le> \<aleph>0
vcard B \<le> \<aleph>0

goal (1 subgoal):
 1. countable (elts (A + B))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vcard A \<le> \<aleph>0
vcard B \<le> \<aleph>0
[PROOF STEP]
have "vcard (A+B) \<le> \<aleph>0"
[PROOF STATE]
proof (prove)
using this:
vcard A \<le> \<aleph>0
vcard B \<le> \<aleph>0

goal (1 subgoal):
 1. vcard (A + B) \<le> \<aleph>0
[PROOF STEP]
unfolding vcard_add
[PROOF STATE]
proof (prove)
using this:
vcard A \<le> \<aleph>0
vcard B \<le> \<aleph>0

goal (1 subgoal):
 1. vcard A \<oplus> vcard B \<le> \<aleph>0
[PROOF STEP]
by (metis Aleph_0 Card_\<omega> InfCard_cdouble_eq InfCard_def cadd_le_mono order_refl)
[PROOF STATE]
proof (state)
this:
vcard (A + B) \<le> \<aleph>0

goal (1 subgoal):
 1. countable (elts (A + B))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vcard (A + B) \<le> \<aleph>0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vcard (A + B) \<le> \<aleph>0

goal (1 subgoal):
 1. countable (elts (A + B))
[PROOF STEP]
by (simp add: countable_iff_le_Aleph0)
[PROOF STATE]
proof (state)
this:
countable (elts (A + B))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma encode_unary_nat_prefix_free:
  fixes u v :: nat
  assumes "prefix (encode_unary_nat u) (encode_unary_nat v)"
  shows "u = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u = v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prefix (encode_unary_nat u) (encode_unary_nat v)

goal (1 subgoal):
 1. u = v
[PROOF STEP]
proof (induction u arbitrary: v)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>v. prefix (encode_unary_nat 0) (encode_unary_nat v) \<Longrightarrow> 0 = v
 2. \<And>u v. \<lbrakk>\<And>v. prefix (encode_unary_nat u) (encode_unary_nat v) \<Longrightarrow> u = v; prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)\<rbrakk> \<Longrightarrow> Suc u = v
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
prefix (encode_unary_nat 0) (encode_unary_nat v)

goal (2 subgoals):
 1. \<And>v. prefix (encode_unary_nat 0) (encode_unary_nat v) \<Longrightarrow> 0 = v
 2. \<And>u v. \<lbrakk>\<And>v. prefix (encode_unary_nat u) (encode_unary_nat v) \<Longrightarrow> u = v; prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)\<rbrakk> \<Longrightarrow> Suc u = v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prefix (encode_unary_nat 0) (encode_unary_nat v)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
prefix (encode_unary_nat 0) (encode_unary_nat v)

goal (1 subgoal):
 1. 0 = v
[PROOF STEP]
by (cases v, simp_all)
[PROOF STATE]
proof (state)
this:
0 = v

goal (1 subgoal):
 1. \<And>u v. \<lbrakk>\<And>v. prefix (encode_unary_nat u) (encode_unary_nat v) \<Longrightarrow> u = v; prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)\<rbrakk> \<Longrightarrow> Suc u = v
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>u v. \<lbrakk>\<And>v. prefix (encode_unary_nat u) (encode_unary_nat v) \<Longrightarrow> u = v; prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)\<rbrakk> \<Longrightarrow> Suc u = v
[PROOF STEP]
case (Suc u)
[PROOF STATE]
proof (state)
this:
prefix (encode_unary_nat u) (encode_unary_nat ?v) \<Longrightarrow> u = ?v
prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)

goal (1 subgoal):
 1. \<And>u v. \<lbrakk>\<And>v. prefix (encode_unary_nat u) (encode_unary_nat v) \<Longrightarrow> u = v; prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)\<rbrakk> \<Longrightarrow> Suc u = v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prefix (encode_unary_nat u) (encode_unary_nat ?v) \<Longrightarrow> u = ?v
prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
prefix (encode_unary_nat u) (encode_unary_nat ?v) \<Longrightarrow> u = ?v
prefix (encode_unary_nat (Suc u)) (encode_unary_nat v)

goal (1 subgoal):
 1. Suc u = v
[PROOF STEP]
by (cases v, simp_all)
[PROOF STATE]
proof (state)
this:
Suc u = v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma size_fsingleton: "(size f = 1) = (\<exists>e. f = {|e|})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (size f = 1) = (\<exists>e. f = {|e|})
[PROOF STEP]
apply (insert exists_fset_of_list[of f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. f = fset_of_list l \<Longrightarrow> (size f = 1) = (\<exists>e. f = {|e|})
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. f = fset_of_list l \<Longrightarrow> (size (fset_of_list l) = 1) = (\<exists>e. fset_of_list l = {|e|})
[PROOF STEP]
apply (simp only: size_fset_of_list)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. f = fset_of_list l \<Longrightarrow> (length (remdups l) = 1) = (\<exists>e. fset_of_list l = {|e|})
[PROOF STEP]
apply (simp add: fset_of_list_def fset_both_sides Abs_fset_inverse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>l. f = Abs_fset (set l) \<Longrightarrow> (length (remdups l) = Suc 0) = (\<exists>e. set l = {e})
[PROOF STEP]
by (metis List.card_set One_nat_def card.insert card_1_singletonE card.empty empty_iff finite.intros(1))


[STATEMENT]
lemma poly_induct4:
  assumes "p \<in> carrier P"
  assumes add: "\<And>p q. q \<in> carrier P \<Longrightarrow> p \<in> carrier P \<Longrightarrow> Q p \<Longrightarrow> Q q  \<Longrightarrow> Q (p \<oplus>\<^bsub>P\<^esub> q)"
  assumes monom_zero: "\<And>a. a \<in> carrier R \<Longrightarrow> Q (monom P a 0)"
  assumes monom_Suc: "\<And>a n. a \<in> carrier R \<Longrightarrow> Q (monom P a (Suc n))"
  shows "Q p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q p
[PROOF STEP]
apply(rule poly_induct3)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. p \<in> carrier P
 2. \<And>p q. \<lbrakk>q \<in> carrier P; p \<in> carrier P; Q p; Q q\<rbrakk> \<Longrightarrow> Q (p \<oplus>\<^bsub>P\<^esub> q)
 3. \<And>a n. a \<in> carrier R \<Longrightarrow> Q (monom P a n)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P

goal (3 subgoals):
 1. p \<in> carrier P
 2. \<And>p q. \<lbrakk>q \<in> carrier P; p \<in> carrier P; Q p; Q q\<rbrakk> \<Longrightarrow> Q (p \<oplus>\<^bsub>P\<^esub> q)
 3. \<And>a n. a \<in> carrier R \<Longrightarrow> Q (monom P a n)
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>p q. \<lbrakk>q \<in> carrier P; p \<in> carrier P; Q p; Q q\<rbrakk> \<Longrightarrow> Q (p \<oplus>\<^bsub>P\<^esub> q)
 2. \<And>a n. a \<in> carrier R \<Longrightarrow> Q (monom P a n)
[PROOF STEP]
using add
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<in> carrier P; ?p \<in> carrier P; Q ?p; Q ?q\<rbrakk> \<Longrightarrow> Q (?p \<oplus>\<^bsub>P\<^esub> ?q)

goal (2 subgoals):
 1. \<And>p q. \<lbrakk>q \<in> carrier P; p \<in> carrier P; Q p; Q q\<rbrakk> \<Longrightarrow> Q (p \<oplus>\<^bsub>P\<^esub> q)
 2. \<And>a n. a \<in> carrier R \<Longrightarrow> Q (monom P a n)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a n. a \<in> carrier R \<Longrightarrow> Q (monom P a n)
[PROOF STEP]
using monom_zero monom_Suc
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier R \<Longrightarrow> Q (monom P ?a 0)
?a \<in> carrier R \<Longrightarrow> Q (monom P ?a (Suc ?n))

goal (1 subgoal):
 1. \<And>a n. a \<in> carrier R \<Longrightarrow> Q (monom P a n)
[PROOF STEP]
by (metis P_def UP_ring.monom_zero UP_ring_axioms deg_monom deg_monom_le le_0_eq le_SucE zero_induct)


[STATEMENT]
lemma is_zero_row_upt_k_suc:
  assumes "is_zero_row_upt_k i k A"
  and "A $ i $ (from_nat k) = 0"
  shows "is_zero_row_upt_k i (Suc k) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k i (Suc k) A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_zero_row_upt_k i k A
A $ i $ mod_type_class.from_nat k = (0::'b)

goal (1 subgoal):
 1. is_zero_row_upt_k i (Suc k) A
[PROOF STEP]
unfolding is_zero_row_upt_k_def
[PROOF STATE]
proof (prove)
using this:
\<forall>j. mod_type_class.to_nat j < k \<longrightarrow> A $ i $ j = (0::'b)
A $ i $ mod_type_class.from_nat k = (0::'b)

goal (1 subgoal):
 1. \<forall>j. mod_type_class.to_nat j < Suc k \<longrightarrow> A $ i $ j = (0::'b)
[PROOF STEP]
using less_SucE to_nat_from_nat
[PROOF STATE]
proof (prove)
using this:
\<forall>j. mod_type_class.to_nat j < k \<longrightarrow> A $ i $ j = (0::'b)
A $ i $ mod_type_class.from_nat k = (0::'b)
\<lbrakk>?m < Suc ?n; ?m < ?n \<Longrightarrow> ?P; ?m = ?n \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
mod_type_class.to_nat ?j = ?k \<Longrightarrow> mod_type_class.from_nat ?k = ?j

goal (1 subgoal):
 1. \<forall>j. mod_type_class.to_nat j < Suc k \<longrightarrow> A $ i $ j = (0::'b)
[PROOF STEP]
by metis


[STATEMENT]
lemma card_Mi_le_floor_div_2_NVLi:
  assumes "OSC L E \<and> matching V E M \<and> i > 1"
  shows "card (matching_i i V E M L) \<le> (N V L i) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> N V L i div 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> N V L i div 2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
OSC L E \<and> matching V E M \<and> 1 < i
[PROOF STEP]
have "card (V_i i V E M L) \<le> (N V L i)"
[PROOF STATE]
proof (prove)
using this:
OSC L E \<and> matching V E M \<and> 1 < i

goal (1 subgoal):
 1. card (V_i i V E M L) \<le> N V L i
[PROOF STEP]
by (simp add: card_Vi_le_NVLi)
[PROOF STATE]
proof (state)
this:
card (V_i i V E M L) \<le> N V L i

goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> N V L i div 2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card (V_i i V E M L) \<le> N V L i
[PROOF STEP]
have "card (V_i i V E M L) div 2 \<le> (N V L i) div 2"
[PROOF STATE]
proof (prove)
using this:
card (V_i i V E M L) \<le> N V L i

goal (1 subgoal):
 1. card (V_i i V E M L) div 2 \<le> N V L i div 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (V_i i V E M L) div 2 \<le> N V L i div 2

goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> N V L i div 2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (V_i i V E M L) div 2 \<le> N V L i div 2

goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> N V L i div 2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
OSC L E \<and> matching V E M \<and> 1 < i
[PROOF STEP]
have
    "card (matching_i i V E M L) \<le> card (V_i i V E M L) div 2"
[PROOF STATE]
proof (prove)
using this:
OSC L E \<and> matching V E M \<and> 1 < i

goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> card (V_i i V E M L) div 2
[PROOF STEP]
by (intro card_Mi_le_floor_div_2_Vi)
[PROOF STATE]
proof (state)
this:
card (matching_i i V E M L) \<le> card (V_i i V E M L) div 2

goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> N V L i div 2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (V_i i V E M L) div 2 \<le> N V L i div 2
card (matching_i i V E M L) \<le> card (V_i i V E M L) div 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (V_i i V E M L) div 2 \<le> N V L i div 2
card (matching_i i V E M L) \<le> card (V_i i V E M L) div 2

goal (1 subgoal):
 1. card (matching_i i V E M L) \<le> N V L i div 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (matching_i i V E M L) \<le> N V L i div 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lincomb_vec_diff_add:
    assumes A: "A \<subseteq> carrier_vec n"
    and BA: "B \<subseteq> A" and fin_A: "finite A"
    and f: "f \<in> A \<rightarrow> UNIV" shows "lincomb f A = lincomb f (A-B) + lincomb f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
have "A - B \<union> B = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A - B \<union> B = A
[PROOF STEP]
using BA
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A

goal (1 subgoal):
 1. A - B \<union> B = A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A - B \<union> B = A

goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
hence "lincomb f A = lincomb f (A - B \<union> B)"
[PROOF STATE]
proof (prove)
using this:
A - B \<union> B = A

goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B \<union> B)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lincomb f A = lincomb f (A - B \<union> B)

goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb f A = lincomb f (A - B \<union> B)

goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
have "... = lincomb f (A-B) + lincomb f B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb f (A - B \<union> B) = lincomb f (A - B) + lincomb f B
[PROOF STEP]
by (rule lincomb_union, insert assms, auto intro: finite_subset)
[PROOF STATE]
proof (state)
this:
lincomb f (A - B \<union> B) = lincomb f (A - B) + lincomb f B

goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lincomb f A = lincomb f (A - B) + lincomb f B

goal (1 subgoal):
 1. lincomb f A = lincomb f (A - B) + lincomb f B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lincomb f A = lincomb f (A - B) + lincomb f B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_lattice_complete_Inf_greatest:
  "\<forall>x::'a::finite_lattice_complete \<in> A. z \<le> x \<Longrightarrow> z \<le> Inf A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. z \<le> x \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
using finite [of A]
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. \<forall>x\<in>A. z \<le> x \<Longrightarrow> z \<le> Inf A
[PROOF STEP]
by (induct A) (auto simp add: finite_lattice_complete_Inf_empty finite_lattice_complete_Inf_insert)


[STATEMENT]
lemma half_largest_elements_mono: "sum_list (drop (length ds div 2) (sort ds))
    \<le> sum_list (drop (Suc (length ds) div 2) (insort (d :: nat) (sort ds)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
define n  where "n  = length ds div 2"
[PROOF STATE]
proof (state)
this:
n = length ds div 2

goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
define m  where "m  = Suc (length ds) div 2"
[PROOF STATE]
proof (state)
this:
m = Suc (length ds) div 2

goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
define xs where "xs = sort ds"
[PROOF STATE]
proof (state)
this:
xs = sort ds

goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
have xs: "sorted xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted xs
[PROOF STEP]
unfolding xs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (sort ds)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sorted xs

goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
have nm: "m \<in> {n, Suc n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<in> {n, Suc n}
[PROOF STEP]
unfolding n_def m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (length ds) div 2 \<in> {length ds div 2, Suc (length ds div 2)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m \<in> {n, Suc n}

goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))
[PROOF STEP]
unfolding n_def[symmetric] m_def[symmetric] xs_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n xs) \<le> sum_list (drop m (insort d xs))
[PROOF STEP]
using nm xs
[PROOF STATE]
proof (prove)
using this:
m \<in> {n, Suc n}
sorted xs

goal (1 subgoal):
 1. sum_list (drop n xs) \<le> sum_list (drop m (insort d xs))
[PROOF STEP]
proof (induct xs arbitrary: n m d)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n m d. \<lbrakk>m \<in> {n, Suc n}; sorted []\<rbrakk> \<Longrightarrow> sum_list (drop n []) \<le> sum_list (drop m (insort d []))
 2. \<And>a xs n m d. \<lbrakk>\<And>n m d. \<lbrakk>m \<in> {n, Suc n}; sorted xs\<rbrakk> \<Longrightarrow> sum_list (drop n xs) \<le> sum_list (drop m (insort d xs)); m \<in> {n, Suc n}; sorted (a # xs)\<rbrakk> \<Longrightarrow> sum_list (drop n (a # xs)) \<le> sum_list (drop m (insort d (a # xs)))
[PROOF STEP]
case (Cons x xs n m d)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?m \<in> {?n, Suc ?n}; sorted xs\<rbrakk> \<Longrightarrow> sum_list (drop ?n xs) \<le> sum_list (drop ?m (insort ?d xs))
m \<in> {n, Suc n}
sorted (x # xs)

goal (2 subgoals):
 1. \<And>n m d. \<lbrakk>m \<in> {n, Suc n}; sorted []\<rbrakk> \<Longrightarrow> sum_list (drop n []) \<le> sum_list (drop m (insort d []))
 2. \<And>a xs n m d. \<lbrakk>\<And>n m d. \<lbrakk>m \<in> {n, Suc n}; sorted xs\<rbrakk> \<Longrightarrow> sum_list (drop n xs) \<le> sum_list (drop m (insort d xs)); m \<in> {n, Suc n}; sorted (a # xs)\<rbrakk> \<Longrightarrow> sum_list (drop n (a # xs)) \<le> sum_list (drop m (insort d (a # xs)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
proof (cases n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
with Cons(2)
[PROOF STATE]
proof (chain)
picking this:
m \<in> {n, Suc n}
n = 0
[PROOF STEP]
have m: "m = 0 \<or> m = 1"
[PROOF STATE]
proof (prove)
using this:
m \<in> {n, Suc n}
n = 0

goal (1 subgoal):
 1. m = 0 \<or> m = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m = 0 \<or> m = 1

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
proof (cases "d \<le> x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
d \<le> x

goal (2 subgoals):
 1. d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
hence ins: "insort d (x # xs) = d # x # xs"
[PROOF STATE]
proof (prove)
using this:
d \<le> x

goal (1 subgoal):
 1. insort d (x # xs) = d # x # xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insort d (x # xs) = d # x # xs

goal (2 subgoals):
 1. d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
unfolding ins 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop 0 (x # xs)) \<le> sum_list (drop m (d # x # xs))
[PROOF STEP]
using True m
[PROOF STATE]
proof (prove)
using this:
d \<le> x
m = 0 \<or> m = 1

goal (1 subgoal):
 1. sum_list (drop 0 (x # xs)) \<le> sum_list (drop m (d # x # xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))

goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> d \<le> x

goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
hence ins: "insort d (x # xs) = x # insort d xs"
[PROOF STATE]
proof (prove)
using this:
\<not> d \<le> x

goal (1 subgoal):
 1. insort d (x # xs) = x # insort d xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insort d (x # xs) = x # insort d xs

goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
unfolding ins 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop 0 (x # xs)) \<le> sum_list (drop m (x # insort d xs))
[PROOF STEP]
using False m
[PROOF STATE]
proof (prove)
using this:
\<not> d \<le> x
m = 0 \<or> m = 1

goal (1 subgoal):
 1. sum_list (drop 0 (x # xs)) \<le> sum_list (drop m (x # insort d xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
case (Suc nn)
[PROOF STATE]
proof (state)
this:
n = Suc nn

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
with Cons(2)
[PROOF STATE]
proof (chain)
picking this:
m \<in> {n, Suc n}
n = Suc nn
[PROOF STEP]
obtain mm where m: "m = Suc mm" and mm: "mm \<in> {nn, Suc nn}"
[PROOF STATE]
proof (prove)
using this:
m \<in> {n, Suc n}
n = Suc nn

goal (1 subgoal):
 1. (\<And>mm. \<lbrakk>m = Suc mm; mm \<in> {nn, Suc nn}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m = Suc mm
mm \<in> {nn, Suc nn}

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
from Cons(3)
[PROOF STATE]
proof (chain)
picking this:
sorted (x # xs)
[PROOF STEP]
have sort: "sorted xs"
[PROOF STATE]
proof (prove)
using this:
sorted (x # xs)

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

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
note IH = Cons(1)[OF mm]
[PROOF STATE]
proof (state)
this:
sorted xs \<Longrightarrow> sum_list (drop nn xs) \<le> sum_list (drop mm (insort ?d xs))

goal (1 subgoal):
 1. \<And>nat. n = Suc nat \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
proof (cases "d \<le> x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
d \<le> x

goal (2 subgoals):
 1. d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
with Cons(3)
[PROOF STATE]
proof (chain)
picking this:
sorted (x # xs)
d \<le> x
[PROOF STEP]
have ins: "insort d (x # xs) = d # insort x xs"
[PROOF STATE]
proof (prove)
using this:
sorted (x # xs)
d \<le> x

goal (1 subgoal):
 1. insort d (x # xs) = d # insort x xs
[PROOF STEP]
by (cases xs, auto)
[PROOF STATE]
proof (state)
this:
insort d (x # xs) = d # insort x xs

goal (2 subgoals):
 1. d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
 2. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
unfolding ins Suc m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop (Suc nn) (x # xs)) \<le> sum_list (drop (Suc mm) (d # insort x xs))
[PROOF STEP]
using IH[OF sort]
[PROOF STATE]
proof (prove)
using this:
sum_list (drop nn xs) \<le> sum_list (drop mm (insort ?d xs))

goal (1 subgoal):
 1. sum_list (drop (Suc nn) (x # xs)) \<le> sum_list (drop (Suc mm) (d # insort x xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))

goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> d \<le> x

goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
hence ins: "insort d (x # xs) = x # insort d xs"
[PROOF STATE]
proof (prove)
using this:
\<not> d \<le> x

goal (1 subgoal):
 1. insort d (x # xs) = x # insort d xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insort d (x # xs) = x # insort d xs

goal (1 subgoal):
 1. \<not> d \<le> x \<Longrightarrow> sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))
[PROOF STEP]
unfolding ins Suc m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (drop (Suc nn) (x # xs)) \<le> sum_list (drop (Suc mm) (x # insort d xs))
[PROOF STEP]
using IH[OF sort] Cons(3)
[PROOF STATE]
proof (prove)
using this:
sum_list (drop nn xs) \<le> sum_list (drop mm (insort ?d xs))
sorted (x # xs)

goal (1 subgoal):
 1. sum_list (drop (Suc nn) (x # xs)) \<le> sum_list (drop (Suc mm) (x # insort d xs))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum_list (drop n (x # xs)) \<le> sum_list (drop m (insort d (x # xs)))

goal (1 subgoal):
 1. \<And>n m d. \<lbrakk>m \<in> {n, Suc n}; sorted []\<rbrakk> \<Longrightarrow> sum_list (drop n []) \<le> sum_list (drop m (insort d []))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
sum_list (drop (length ds div 2) (sort ds)) \<le> sum_list (drop (Suc (length ds) div 2) (insort d (sort ds)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bin_rep_index_0_geq:
  fixes n m:: nat
  assumes "m \<ge> 2^n" and "m < 2^(n+1)"
  shows "bin_rep (n+1) m ! 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
have "bin_rep (Suc n) m =  butlast (bin_rep_aux (Suc n) m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_rep (Suc n) m = butlast (bin_rep_aux (Suc n) m)
[PROOF STEP]
using bin_rep_def
[PROOF STATE]
proof (prove)
using this:
bin_rep ?n ?m = butlast (bin_rep_aux ?n ?m)

goal (1 subgoal):
 1. bin_rep (Suc n) m = butlast (bin_rep_aux (Suc n) m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bin_rep (Suc n) m = butlast (bin_rep_aux (Suc n) m)

goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bin_rep (Suc n) m = butlast (bin_rep_aux (Suc n) m)

goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
have "\<dots> = butlast (1 # (bin_rep_aux n (m mod 2^n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast (bin_rep_aux (Suc n) m) = butlast (1 # bin_rep_aux n (m mod 2 ^ n))
[PROOF STEP]
using assms bin_rep_aux_def
[PROOF STATE]
proof (prove)
using this:
2 ^ n \<le> m
m < 2 ^ (n + 1)
bin_rep_aux \<equiv> rec_nat (\<lambda>m. [m]) (\<lambda>n na m. m div 2 ^ n # na (m mod 2 ^ n))

goal (1 subgoal):
 1. butlast (bin_rep_aux (Suc n) m) = butlast (1 # bin_rep_aux n (m mod 2 ^ n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
butlast (bin_rep_aux (Suc n) m) = butlast (1 # bin_rep_aux n (m mod 2 ^ n))

goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
butlast (bin_rep_aux (Suc n) m) = butlast (1 # bin_rep_aux n (m mod 2 ^ n))

goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
have "\<dots> = 1 # butlast (bin_rep_aux n (m mod 2^n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. butlast (1 # bin_rep_aux n (m mod 2 ^ n)) = 1 # butlast (bin_rep_aux n (m mod 2 ^ n))
[PROOF STEP]
by (simp add: bin_rep_aux_neq_nil)
[PROOF STATE]
proof (state)
this:
butlast (1 # bin_rep_aux n (m mod 2 ^ n)) = 1 # butlast (bin_rep_aux n (m mod 2 ^ n))

goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bin_rep (Suc n) m = butlast (bin_rep_aux (Suc n) m)
butlast (bin_rep_aux (Suc n) m) = butlast (1 # bin_rep_aux n (m mod 2 ^ n))
butlast (1 # bin_rep_aux n (m mod 2 ^ n)) = 1 # butlast (bin_rep_aux n (m mod 2 ^ n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bin_rep (Suc n) m = butlast (bin_rep_aux (Suc n) m)
butlast (bin_rep_aux (Suc n) m) = butlast (1 # bin_rep_aux n (m mod 2 ^ n))
butlast (1 # bin_rep_aux n (m mod 2 ^ n)) = 1 # butlast (bin_rep_aux n (m mod 2 ^ n))

goal (1 subgoal):
 1. bin_rep (n + 1) m ! 0 = 1
[PROOF STEP]
by (simp add: bin_rep_aux_neq_nil)
[PROOF STATE]
proof (state)
this:
bin_rep (n + 1) m ! 0 = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma spectral_radius_gt_1: assumes A: "A \<in> carrier_mat n n"
  and n: "n > 0"
  and sr_1: "spectral_radius A > 1"
  shows "\<exists> v c. v \<in> carrier_vec n \<and> norm c > 1 \<and> v \<noteq> 0\<^sub>v n \<and> A ^\<^sub>m k *\<^sub>v v = c^k \<cdot>\<^sub>v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>v c. v \<in> carrier_vec n \<and> 1 < cmod c \<and> v \<noteq> 0\<^sub>v n \<and> A ^\<^sub>m k *\<^sub>v v = c ^ k \<cdot>\<^sub>v v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>v c. v \<in> carrier_vec n \<and> 1 < cmod c \<and> v \<noteq> 0\<^sub>v n \<and> A ^\<^sub>m k *\<^sub>v v = c ^ k \<cdot>\<^sub>v v
[PROOF STEP]
from sr_1 spectral_radius_mem_max[OF A n]
[PROOF STATE]
proof (chain)
picking this:
1 < spectral_radius A
spectral_radius A \<in> cmod ` spectrum A
?a \<in> cmod ` spectrum A \<Longrightarrow> ?a \<le> spectral_radius A
[PROOF STEP]
obtain ev
    where ev: "ev \<in> spectrum A" and gt: "norm ev > 1"
[PROOF STATE]
proof (prove)
using this:
1 < spectral_radius A
spectral_radius A \<in> cmod ` spectrum A
?a \<in> cmod ` spectrum A \<Longrightarrow> ?a \<le> spectral_radius A

goal (1 subgoal):
 1. (\<And>ev. \<lbrakk>ev \<in> spectrum A; 1 < cmod ev\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ev \<in> spectrum A
1 < cmod ev

goal (1 subgoal):
 1. \<exists>v c. v \<in> carrier_vec n \<and> 1 < cmod c \<and> v \<noteq> 0\<^sub>v n \<and> A ^\<^sub>m k *\<^sub>v v = c ^ k \<cdot>\<^sub>v v
[PROOF STEP]
from ev[unfolded spectrum_def eigenvalue_def[abs_def]]
[PROOF STATE]
proof (chain)
picking this:
ev \<in> {k. \<exists>v. eigenvector A v k}
[PROOF STEP]
obtain v where ev: "eigenvector A v ev"
[PROOF STATE]
proof (prove)
using this:
ev \<in> {k. \<exists>v. eigenvector A v k}

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

goal (1 subgoal):
 1. \<exists>v c. v \<in> carrier_vec n \<and> 1 < cmod c \<and> v \<noteq> 0\<^sub>v n \<and> A ^\<^sub>m k *\<^sub>v v = c ^ k \<cdot>\<^sub>v v
[PROOF STEP]
from eigenvector_pow[OF A this] this[unfolded eigenvector_def] A gt
[PROOF STATE]
proof (chain)
picking this:
A ^\<^sub>m ?i *\<^sub>v v = ev ^ ?i \<cdot>\<^sub>v v
v \<in> carrier_vec (dim_row A) \<and> v \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v v = ev \<cdot>\<^sub>v v
A \<in> carrier_mat n n
1 < cmod ev
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A ^\<^sub>m ?i *\<^sub>v v = ev ^ ?i \<cdot>\<^sub>v v
v \<in> carrier_vec (dim_row A) \<and> v \<noteq> 0\<^sub>v (dim_row A) \<and> A *\<^sub>v v = ev \<cdot>\<^sub>v v
A \<in> carrier_mat n n
1 < cmod ev

goal (1 subgoal):
 1. \<exists>v c. v \<in> carrier_vec n \<and> 1 < cmod c \<and> v \<noteq> 0\<^sub>v n \<and> A ^\<^sub>m k *\<^sub>v v = c ^ k \<cdot>\<^sub>v v
[PROOF STEP]
by (intro exI[of _ v], intro exI[of _ ev], auto)
[PROOF STATE]
proof (state)
this:
\<exists>v c. v \<in> carrier_vec n \<and> 1 < cmod c \<and> v \<noteq> 0\<^sub>v n \<and> A ^\<^sub>m k *\<^sub>v v = c ^ k \<cdot>\<^sub>v v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_closedin_preimage:
  assumes "continuous_on S f" and "closed T"
  shows "closedin (top_of_set S) (S \<inter> f -` T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` T)
[PROOF STEP]
have *: "(S \<inter> f -` T) = (S \<inter> f -` (T \<inter> f ` S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> f -` T = S \<inter> f -` (T \<inter> f ` S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<inter> f -` T = S \<inter> f -` (T \<inter> f ` S)

goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` T)
[PROOF STEP]
have "closedin (top_of_set (f ` S)) (T \<inter> f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set (f ` S)) (T \<inter> f ` S)
[PROOF STEP]
using closedin_closed_Int[of T "f ` S", OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
closedin (top_of_set (f ` S)) (f ` S \<inter> T)

goal (1 subgoal):
 1. closedin (top_of_set (f ` S)) (T \<inter> f ` S)
[PROOF STEP]
by (simp add: Int_commute)
[PROOF STATE]
proof (state)
this:
closedin (top_of_set (f ` S)) (T \<inter> f ` S)

goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
closedin (top_of_set (f ` S)) (T \<inter> f ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closedin (top_of_set (f ` S)) (T \<inter> f ` S)

goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` T)
[PROOF STEP]
using assms(1)[unfolded continuous_on_closed, THEN spec[where x="T \<inter> f ` S"]]
[PROOF STATE]
proof (prove)
using this:
closedin (top_of_set (f ` S)) (T \<inter> f ` S)
closedin (top_of_set (f ` S)) (T \<inter> f ` S) \<longrightarrow> closedin (top_of_set S) (S \<inter> f -` (T \<inter> f ` S))

goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` T)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
closedin (top_of_set (f ` S)) (T \<inter> f ` S)
closedin (top_of_set (f ` S)) (T \<inter> f ` S) \<longrightarrow> closedin (top_of_set S) (S \<inter> f -` (T \<inter> f ` S))
S \<inter> f -` T = S \<inter> f -` (T \<inter> f ` S)

goal (1 subgoal):
 1. closedin (top_of_set S) (S \<inter> f -` T)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
closedin (top_of_set S) (S \<inter> f -` T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_elem_dvd_prod_mset:
  assumes p: "prime_elem p" and pA: "p dvd prod_mset A" shows "\<exists>a \<in># A. p dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>#A. p dvd a
[PROOF STEP]
proof(insert pA, induct A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p dvd \<Prod>\<^sub># {#} \<Longrightarrow> Multiset.Bex {#} ((dvd) p)
 2. \<And>x A. \<lbrakk>p dvd \<Prod>\<^sub># A \<Longrightarrow> Multiset.Bex A ((dvd) p); p dvd \<Prod>\<^sub># (add_mset x A)\<rbrakk> \<Longrightarrow> Multiset.Bex (add_mset x A) ((dvd) p)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
p dvd \<Prod>\<^sub># {#}

goal (2 subgoals):
 1. p dvd \<Prod>\<^sub># {#} \<Longrightarrow> Multiset.Bex {#} ((dvd) p)
 2. \<And>x A. \<lbrakk>p dvd \<Prod>\<^sub># A \<Longrightarrow> Multiset.Bex A ((dvd) p); p dvd \<Prod>\<^sub># (add_mset x A)\<rbrakk> \<Longrightarrow> Multiset.Bex (add_mset x A) ((dvd) p)
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
prime_elem p
p dvd \<Prod>\<^sub># {#}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
prime_elem p
p dvd \<Prod>\<^sub># {#}

goal (1 subgoal):
 1. \<exists>a\<in>#{#}. p dvd a
[PROOF STEP]
by (simp add: prime_elem_not_unit)
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>#{#}. p dvd a

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>p dvd \<Prod>\<^sub># A \<Longrightarrow> Multiset.Bex A ((dvd) p); p dvd \<Prod>\<^sub># (add_mset x A)\<rbrakk> \<Longrightarrow> Multiset.Bex (add_mset x A) ((dvd) p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x A. \<lbrakk>p dvd \<Prod>\<^sub># A \<Longrightarrow> Multiset.Bex A ((dvd) p); p dvd \<Prod>\<^sub># (add_mset x A)\<rbrakk> \<Longrightarrow> Multiset.Bex (add_mset x A) ((dvd) p)
[PROOF STEP]
case (add a A)
[PROOF STATE]
proof (state)
this:
p dvd \<Prod>\<^sub># A \<Longrightarrow> \<exists>a\<in>#A. p dvd a
p dvd \<Prod>\<^sub># (add_mset a A)

goal (1 subgoal):
 1. \<And>x A. \<lbrakk>p dvd \<Prod>\<^sub># A \<Longrightarrow> Multiset.Bex A ((dvd) p); p dvd \<Prod>\<^sub># (add_mset x A)\<rbrakk> \<Longrightarrow> Multiset.Bex (add_mset x A) ((dvd) p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd \<Prod>\<^sub># A \<Longrightarrow> \<exists>a\<in>#A. p dvd a
p dvd \<Prod>\<^sub># (add_mset a A)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
p dvd \<Prod>\<^sub># A \<Longrightarrow> \<exists>a\<in>#A. p dvd a
p dvd \<Prod>\<^sub># (add_mset a A)

goal (1 subgoal):
 1. \<exists>a\<in>#add_mset a A. p dvd a
[PROOF STEP]
by (auto simp: prime_elem_dvd_mult_iff[OF p])
[PROOF STATE]
proof (state)
this:
\<exists>a\<in>#add_mset a A. p dvd a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bigo_mult7: "\<forall>x. f x \<noteq> 0 \<Longrightarrow> O(f * g) \<subseteq> O(f) * O(g)"
  for f :: "'a \<Rightarrow> 'b::linordered_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> O(f * g) \<subseteq> O(f) * O(g)
[PROOF STEP]
apply (subst bigo_mult6)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> \<forall>x. f x \<noteq> (0::'b)
 2. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> f *o O(g) \<subseteq> O(f) * O(g)
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> f *o O(g) \<subseteq> O(f) * O(g)
[PROOF STEP]
apply (rule set_times_mono3)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<noteq> (0::'b) \<Longrightarrow> f \<in> O(f)
[PROOF STEP]
apply (rule bigo_refl)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma count_roots_interval_rat_code[code]:
  "count_roots_interval_rat p = (let rp = map_poly rat_of_int p; ps = sturm_rat rp
    in Root_Info
      (\<lambda> a b. sign_changes_rat ps a - sign_changes_rat ps b + (if poly rp a = 0 then 1 else 0))
      (\<lambda> a. sign_changes_neg_number_rootat ps - sign_changes_rat ps a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_roots_interval_rat p = (let rp = of_int_poly p; ps = sturm_rat rp in Root_Info (\<lambda>a b. sign_changes_rat ps a - sign_changes_rat ps b + (if poly rp a = 0 then 1 else 0)) (\<lambda>a. sign_changes_neg_number_rootat ps - sign_changes_rat ps a))
[PROOF STEP]
unfolding count_roots_interval_rat_def Let_def count_roots_interval_def split of_rat_of_int_poly[symmetric, where 'a = real]
    sturm_rat sign_changes_rat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Root_Info (\<lambda>a b. sign_changes_rat (sturm_rat (of_int_poly p)) a - sign_changes_rat (sturm_rat (of_int_poly p)) b + (if poly (real_of_rat_poly (of_int_poly p)) (real_of_rat a) = 0 then 1 else 0)) (\<lambda>a. sign_changes_neg_inf (map real_of_rat_poly (sturm_rat (of_int_poly p))) - sign_changes_rat (sturm_rat (of_int_poly p)) a) = Root_Info (\<lambda>a b. sign_changes_rat (sturm_rat (of_int_poly p)) a - sign_changes_rat (sturm_rat (of_int_poly p)) b + (if ipoly p a = 0 then 1 else 0)) (\<lambda>a. sign_changes_neg_number_rootat (sturm_rat (of_int_poly p)) - sign_changes_rat (sturm_rat (of_int_poly p)) a)
[PROOF STEP]
by (simp add: sign_changes_neg_number_rootat)


[STATEMENT]
lemma abs_of_diff_eq: "(abs_of_diff x y = 0) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (abs_of_diff x y = 0) = (x = y)
[PROOF STEP]
by (simp add: abs_of_diff_def, arith)


[STATEMENT]
theorem smn_theorem:
  assumes "n > 0"
  shows "\<exists>s. prim_recfn (Suc m) s \<and>
    (\<forall>p cs xs. length cs = m \<and> length xs = n \<longrightarrow>
        eval (r_universal (m + n)) (p # cs @ xs) =
        eval (r_universal n) ((the (eval s (p # cs))) # xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s. prim_recfn (Suc m) s \<and> (\<forall>p cs xs. length cs = m \<and> length xs = n \<longrightarrow> eval (r_universal (m + n)) (p # cs @ xs) = eval (r_universal n) (the (eval s (p # cs)) # xs))
[PROOF STEP]
using smn_lemma exI[of _ "r_smn n m"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?n; length ?cs = ?m; length ?xs = ?n\<rbrakk> \<Longrightarrow> eval (r_universal (?m + ?n)) (?p # ?cs @ ?xs) = eval (r_universal ?n) (the (eval (r_smn ?n ?m) (?p # ?cs)) # ?xs)
?P (r_smn n m) \<Longrightarrow> \<exists>x. ?P x
0 < n

goal (1 subgoal):
 1. \<exists>s. prim_recfn (Suc m) s \<and> (\<forall>p cs xs. length cs = m \<and> length xs = n \<longrightarrow> eval (r_universal (m + n)) (p # cs @ xs) = eval (r_universal n) (the (eval s (p # cs)) # xs))
[PROOF STEP]
by simp


[STATEMENT]
lemma int_pow_0: "(a::int)^0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a ^ 0 = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma "add (succ (succ (succ zero))) (succ (succ zero)) =
    succ (succ (succ (succ (succ zero))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add (succ (succ (succ zero))) (succ (succ zero)) = succ (succ (succ (succ (succ zero))))
[PROOF STEP]
by simp


[STATEMENT]
lemma frontier_box:
  fixes a b :: "'a::euclidean_space"
  shows "frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
proof (cases "box a b = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. box a b = {} \<Longrightarrow> frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
 2. box a b \<noteq> {} \<Longrightarrow> frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
box a b = {}

goal (2 subgoals):
 1. box a b = {} \<Longrightarrow> frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
 2. box a b \<noteq> {} \<Longrightarrow> frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
box a b = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
box a b = {}

goal (1 subgoal):
 1. frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
using frontier_empty
[PROOF STATE]
proof (prove)
using this:
box a b = {}
frontier {} = {}

goal (1 subgoal):
 1. frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)

goal (1 subgoal):
 1. box a b \<noteq> {} \<Longrightarrow> frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. box a b \<noteq> {} \<Longrightarrow> frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
box a b \<noteq> {}

goal (1 subgoal):
 1. box a b \<noteq> {} \<Longrightarrow> frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
box a b \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
box a b \<noteq> {}

goal (1 subgoal):
 1. frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
unfolding frontier_def and closure_box[OF False] and interior_open[OF open_box]
[PROOF STATE]
proof (prove)
using this:
box a b \<noteq> {}

goal (1 subgoal):
 1. cbox a b - box a b = (if box a b = {} then {} else cbox a b - box a b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
frontier (box a b) = (if box a b = {} then {} else cbox a b - box a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_diff_triangle_ineq: "norm ((a + b) - (c + d)) \<le> norm (a - c) + norm (b - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
have "norm ((a + b) - (c + d)) = norm ((a - c) + (b - d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a + b - (c + d)) = norm (a - c + (b - d))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
norm (a + b - (c + d)) = norm (a - c + (b - d))

goal (1 subgoal):
 1. norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (a + b - (c + d)) = norm (a - c + (b - d))

goal (1 subgoal):
 1. norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
have "\<dots> \<le> norm (a - c) + norm (b - d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (a - c + (b - d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
by (rule norm_triangle_ineq)
[PROOF STATE]
proof (state)
this:
norm (a - c + (b - d)) \<le> norm (a - c) + norm (b - d)

goal (1 subgoal):
 1. norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)

goal (1 subgoal):
 1. norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (a + b - (c + d)) \<le> norm (a - c) + norm (b - d)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_prod_monic:
  assumes "\<And> i. i < n \<Longrightarrow> degree (f i :: 'a :: comm_semiring_1 poly) = 1"
    and "\<And> i. i < n \<Longrightarrow> coeff (f i) 1 = 1"
  shows "degree (prod f {0 ..< n}) = n \<and> coeff (prod f {0 ..< n}) n = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod f {0..<n}) = n \<and> coeff (prod f {0..<n}) n = (1::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (prod f {0..<n}) = n \<and> coeff (prod f {0..<n}) n = (1::'a)
[PROOF STEP]
from degree_prod_sum_monic[of "{0 ..< n}" f]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>finite {0..<n}; 0 \<notin> (degree \<circ> f) ` {0..<n}; \<And>a. a \<in> {0..<n} \<Longrightarrow> monic (f a)\<rbrakk> \<Longrightarrow> degree (prod f {0..<n}) = sum (degree \<circ> f) {0..<n} \<and> coeff (prod f {0..<n}) (sum (degree \<circ> f) {0..<n}) = (1::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {0..<n}; 0 \<notin> (degree \<circ> f) ` {0..<n}; \<And>a. a \<in> {0..<n} \<Longrightarrow> monic (f a)\<rbrakk> \<Longrightarrow> degree (prod f {0..<n}) = sum (degree \<circ> f) {0..<n} \<and> coeff (prod f {0..<n}) (sum (degree \<circ> f) {0..<n}) = (1::'a)

goal (1 subgoal):
 1. degree (prod f {0..<n}) = n \<and> coeff (prod f {0..<n}) n = (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {0..<n}; 0 \<notin> (degree \<circ> f) ` {0..<n}; \<And>a. a \<in> {0..<n} \<Longrightarrow> monic (f a)\<rbrakk> \<Longrightarrow> degree (prod f {0..<n}) = sum (degree \<circ> f) {0..<n} \<and> coeff (prod f {0..<n}) (sum (degree \<circ> f) {0..<n}) = (1::'a)
?i < n \<Longrightarrow> degree (f ?i) = 1
?i < n \<Longrightarrow> coeff (f ?i) 1 = (1::'a)

goal (1 subgoal):
 1. degree (prod f {0..<n}) = n \<and> coeff (prod f {0..<n}) n = (1::'a)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
degree (prod f {0..<n}) = n \<and> coeff (prod f {0..<n}) n = (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gauss_int_dvd_same_norm_imp_associated:
  assumes "z1 dvd z2" "gauss_int_norm z1 = gauss_int_norm z2"
  shows   "normalize z1 = normalize z2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize z1 = normalize z2
[PROOF STEP]
proof (cases "z1 = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z1 = 0 \<Longrightarrow> normalize z1 = normalize z2
 2. z1 \<noteq> 0 \<Longrightarrow> normalize z1 = normalize z2
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
z1 \<noteq> 0

goal (2 subgoals):
 1. z1 = 0 \<Longrightarrow> normalize z1 = normalize z2
 2. z1 \<noteq> 0 \<Longrightarrow> normalize z1 = normalize z2
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
z1 dvd z2
[PROOF STEP]
obtain u where u: "z2 = z1 * u"
[PROOF STATE]
proof (prove)
using this:
z1 dvd z2

goal (1 subgoal):
 1. (\<And>u. z2 = z1 * u \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
z2 = z1 * u

goal (2 subgoals):
 1. z1 = 0 \<Longrightarrow> normalize z1 = normalize z2
 2. z1 \<noteq> 0 \<Longrightarrow> normalize z1 = normalize z2
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
z1 dvd z2
gauss_int_norm z1 = gauss_int_norm z2
[PROOF STEP]
have "gauss_int_norm u = 1"
[PROOF STATE]
proof (prove)
using this:
z1 dvd z2
gauss_int_norm z1 = gauss_int_norm z2

goal (1 subgoal):
 1. gauss_int_norm u = 1
[PROOF STEP]
by (auto simp: gauss_int_norm_mult u)
[PROOF STATE]
proof (state)
this:
gauss_int_norm u = 1

goal (2 subgoals):
 1. z1 = 0 \<Longrightarrow> normalize z1 = normalize z2
 2. z1 \<noteq> 0 \<Longrightarrow> normalize z1 = normalize z2
[PROOF STEP]
hence "is_unit u"
[PROOF STATE]
proof (prove)
using this:
gauss_int_norm u = 1

goal (1 subgoal):
 1. is_unit u
[PROOF STEP]
by (simp add: is_unit_gauss_int_iff')
[PROOF STATE]
proof (state)
this:
is_unit u

goal (2 subgoals):
 1. z1 = 0 \<Longrightarrow> normalize z1 = normalize z2
 2. z1 \<noteq> 0 \<Longrightarrow> normalize z1 = normalize z2
[PROOF STEP]
with u
[PROOF STATE]
proof (chain)
picking this:
z2 = z1 * u
is_unit u
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
z2 = z1 * u
is_unit u

goal (1 subgoal):
 1. normalize z1 = normalize z2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalize z1 = normalize z2

goal (1 subgoal):
 1. z1 = 0 \<Longrightarrow> normalize z1 = normalize z2
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma group_card_non_zero_groups_of_size_min:
  assumes "g \<in> \<G>"
  assumes "card g = a"
  shows "groups_of_size a \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> groups_of_size a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 \<le> groups_of_size a
[PROOF STEP]
have "g \<in> {G \<in> \<G> . card G = a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<in> {G \<in> \<G>. card G = a}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
g \<in> \<G>
card g = a

goal (1 subgoal):
 1. g \<in> {G \<in> \<G>. card G = a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g \<in> {G \<in> \<G>. card G = a}

goal (1 subgoal):
 1. 1 \<le> groups_of_size a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g \<in> {G \<in> \<G>. card G = a}
[PROOF STEP]
have "{G \<in> \<G> . card G = a} \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
g \<in> {G \<in> \<G>. card G = a}

goal (1 subgoal):
 1. {G \<in> \<G>. card G = a} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{G \<in> \<G>. card G = a} \<noteq> {}

goal (1 subgoal):
 1. 1 \<le> groups_of_size a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{G \<in> \<G>. card G = a} \<noteq> {}
[PROOF STEP]
have "card {G \<in> \<G> . card G = a} \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
{G \<in> \<G>. card G = a} \<noteq> {}

goal (1 subgoal):
 1. card {G \<in> \<G>. card G = a} \<noteq> 0
[PROOF STEP]
by (simp add: groups_finite)
[PROOF STATE]
proof (state)
this:
card {G \<in> \<G>. card G = a} \<noteq> 0

goal (1 subgoal):
 1. 1 \<le> groups_of_size a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
card {G \<in> \<G>. card G = a} \<noteq> 0

goal (1 subgoal):
 1. 1 \<le> groups_of_size a
[PROOF STEP]
unfolding groups_of_size_def
[PROOF STATE]
proof (prove)
using this:
card {G \<in> \<G>. card G = a} \<noteq> 0

goal (1 subgoal):
 1. 1 \<le> card {G \<in> \<G>. card G = a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> groups_of_size a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_to_1_nat:
  fixes a :: nat
  assumes "[a = 1] (mod n)"
  shows "n dvd (a - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n dvd a - 1
[PROOF STEP]
proof (cases "a = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<Longrightarrow> n dvd a - 1
 2. a \<noteq> 0 \<Longrightarrow> n dvd a - 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = 0

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> n dvd a - 1
 2. a \<noteq> 0 \<Longrightarrow> n dvd a - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = 0

goal (1 subgoal):
 1. n dvd a - 1
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
n dvd a - 1

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> n dvd a - 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> n dvd a - 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> n dvd a - 1
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
[a = 1] (mod n)
a \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[a = 1] (mod n)
a \<noteq> 0

goal (1 subgoal):
 1. n dvd a - 1
[PROOF STEP]
by (metis cong_altdef_nat leI less_one)
[PROOF STATE]
proof (state)
this:
n dvd a - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma max_list_non_empty_map: assumes hom: "\<And> x y. max (f x) (f y) = f (max x y)"
  shows "xs \<noteq> [] \<Longrightarrow> max_list_non_empty (map f xs) = f (max_list_non_empty xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> max_list_non_empty (map f xs) = f (max_list_non_empty xs)
[PROOF STEP]
by (induct xs rule: max_list_non_empty.induct, auto simp: hom)


[STATEMENT]
lemma open_segment_linear_image:
    "\<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> open_segment (f a) (f b) = f ` (open_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>linear f; inj f\<rbrakk> \<Longrightarrow> open_segment (f a) (f b) = f ` open_segment a b
[PROOF STEP]
by (force simp: open_segment_def closed_segment_linear_image inj_on_def)


[STATEMENT]
lemma one_minus_one_minus_q_x_n_nn_integral:
  fixes q::real
  assumes "q \<in> {0<..<1}"
  shows "set_nn_integral lborel {0..} (\<lambda>x. (1 - (1 - q powr x) ^ n)) =
        LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n)
[PROOF STEP]
have "set_nn_integral  lborel {0..} (\<lambda>x. (1 - (1 - q powr x) ^ n)) =
        nn_integral lborel (\<lambda>x. indicator (einterval 0 \<infinity>) x *  (1 - (1 - q powr x) ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n)) \<partial>lborel
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
q \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n)) \<partial>lborel
[PROOF STEP]
by (intro nn_integral_cong_AE eventually_mono[OF AE_lborel_singleton[of 0]])
      (auto simp add: indicator_def einterval_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n)) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = \<integral>\<^sup>+ x. ennreal (indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n)) \<partial>lborel

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n)
[PROOF STEP]
have "\<dots> = ennreal (LBINT x. indicator (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n)) \<partial>lborel = ennreal (LBINT x. indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n))
[PROOF STEP]
using one_minus_one_minus_q_x_n_integral assms
[PROOF STATE]
proof (prove)
using this:
?q \<in> {0<..<1} \<Longrightarrow> set_integrable lborel (einterval 0 \<infinity>) (\<lambda>x. 1 - (1 - ?q powr x) ^ ?n)
?q \<in> {0<..<1} \<Longrightarrow> LBINT x=0..\<infinity>. 1 - (1 - ?q powr x) ^ ?n = - harm ?n / ln ?q
q \<in> {0<..<1}

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n)) \<partial>lborel = ennreal (LBINT x. indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n))
[PROOF STEP]
by(intro nn_integral_eq_integral)
    (auto simp add: indicator_def einterval_def set_integrable_def
      intro!: eventuallyI power_le_one powr_le1)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. ennreal (indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n)) \<partial>lborel = ennreal (LBINT x. indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x. indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x. indicat_real (einterval 0 \<infinity>) x * (1 - (1 - q powr x) ^ n))

goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n)
[PROOF STEP]
by (simp add: interval_lebesgue_integral_def set_lebesgue_integral_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>{0..}. ennreal (1 - (1 - q powr x) ^ n)\<partial>lborel = ennreal (LBINT x=0..\<infinity>. 1 - (1 - q powr x) ^ n)

goal:
No subgoals!
[PROOF STEP]
qed