[STATEMENT]
lemma ac_inv'':
  assumes "x \<in> nonzero Q\<^sub>p"
  assumes "n > 0"
  shows " (ac n x) \<otimes>\<^bsub>Zp_res_ring n\<^esub> ac n (inv x)= \<one>\<^bsub>Zp_res_ring n\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n (inv x) = \<one>\<^bsub>residue_ring (p ^ n)\<^esub>
[PROOF STEP]
using ac_inv' assms(1) assms(2) residue_mult_comm
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> nonzero Q\<^sub>p; 0 < ?n\<rbrakk> \<Longrightarrow> ac ?n (inv ?x) \<otimes>\<^bsub>residue_ring (p ^ ?n)\<^esub> ac ?n ?x = \<one>\<^bsub>residue_ring (p ^ ?n)\<^esub>
x \<in> nonzero Q\<^sub>p
0 < n
?x \<otimes>\<^bsub>residue_ring (p ^ ?k)\<^esub> ?y = ?y \<otimes>\<^bsub>residue_ring (p ^ ?k)\<^esub> ?x

goal (1 subgoal):
 1. ac n x \<otimes>\<^bsub>residue_ring (p ^ n)\<^esub> ac n (inv x) = \<one>\<^bsub>residue_ring (p ^ n)\<^esub>
[PROOF STEP]
by auto


[STATEMENT]
lemma harm_at_top: "filterlim (harm :: nat \<Rightarrow> real) at_top sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim harm at_top sequentially
[PROOF STEP]
proof (rule filterlim_at_top_mono)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. filterlim ?f at_top sequentially
 2. \<forall>\<^sub>F x in sequentially. ?f x \<le> harm x
[PROOF STEP]
show "eventually (\<lambda>n. harm n \<ge> ln (real (Suc n))) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ln (real (Suc n)) \<le> harm n
[PROOF STEP]
using ln_le_harm
[PROOF STATE]
proof (prove)
using this:
ln (real ?n + 1) \<le> harm ?n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ln (real (Suc n)) \<le> harm n
[PROOF STEP]
by (intro always_eventually allI) (simp_all add: add_ac)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. ln (real (Suc n)) \<le> harm n

goal (1 subgoal):
 1. LIM x sequentially. ln (real (Suc x)) :> at_top
[PROOF STEP]
show "filterlim (\<lambda>n. ln (real (Suc n))) at_top sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM n sequentially. ln (real (Suc n)) :> at_top
[PROOF STEP]
by (intro filterlim_compose[OF ln_at_top] filterlim_compose[OF filterlim_real_sequentially]
              filterlim_Suc)
[PROOF STATE]
proof (state)
this:
LIM n sequentially. ln (real (Suc n)) :> at_top

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma witness_length: "length (witness X n) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (witness X n) = n
[PROOF STEP]
apply(induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (witness X 0) = 0
 2. \<And>n. length (witness X n) = n \<Longrightarrow> length (witness X (Suc n)) = Suc n
[PROOF STEP]
by auto


[STATEMENT]
lemma multiplicity_times_same_power:
  assumes "x \<noteq> 0" "\<not>is_unit p" "p \<noteq> 0"
  shows   "multiplicity p (p ^ k * x) = multiplicity p x + k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (p ^ k * x) = multiplicity p x + k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
\<not> is_unit p
p \<noteq> (0::'a)

goal (1 subgoal):
 1. multiplicity p (p ^ k * x) = multiplicity p x + k
[PROOF STEP]
by (induction k) (simp_all add: multiplicity_times_same mult.assoc)


[STATEMENT]
lemma zeroset_eqI: "0 \<in> A \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> a = 0) \<Longrightarrow> A = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<in> A; \<And>a. a \<in> A \<Longrightarrow> a = (0::'a)\<rbrakk> \<Longrightarrow> A = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma neg_numeral_in_nonpos_Ints [simp,intro]: "-numeral n \<in> \<int>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - numeral n \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
unfolding nonpos_Ints_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - numeral n \<in> {of_int n |n. n \<le> 0}
[PROOF STEP]
by (auto intro!: exI[of _ "-numeral n::int"])


[STATEMENT]
lemma set_measurable_continuous_on_ivl:
  assumes "continuous_on {a..b} (f :: real \<Rightarrow> real)"
  shows "set_borel_measurable borel {a..b} f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_borel_measurable borel {a..b} f
[PROOF STEP]
unfolding set_borel_measurable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. indicat_real {a..b} x *\<^sub>R f x) \<in> borel_measurable borel
[PROOF STEP]
by (rule borel_measurable_continuous_on_indicator[OF _ assms]) simp


[STATEMENT]
lemma ideal_generated_0: "ideal_generated {0} = {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal_generated {0::'a} = {0::'a}
[PROOF STEP]
unfolding ideal_generated_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> {I. ideal I \<and> {0::'a} \<subseteq> I} = {0::'a}
[PROOF STEP]
using ideal_0
[PROOF STATE]
proof (prove)
using this:
ideal {0::'a}

goal (1 subgoal):
 1. \<Inter> {I. ideal I \<and> {0::'a} \<subseteq> I} = {0::'a}
[PROOF STEP]
by auto


[STATEMENT]
lemma list_constr_append:
  "list_constr a n \<and> list_constr b n \<longrightarrow> list_constr (a@b) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_constr a n \<and> list_constr b n \<longrightarrow> list_constr (a @ b) n
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_constr a n; list_constr b n\<rbrakk> \<Longrightarrow> list_constr (a @ b) n
[PROOF STEP]
unfolding list_constr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>list_all (\<lambda>x. x < n) a; list_all (\<lambda>x. x < n) b\<rbrakk> \<Longrightarrow> list_all (\<lambda>x. x < n) (a @ b)
[PROOF STEP]
using list_all_append
[PROOF STATE]
proof (prove)
using this:
list_all ?P (?xs @ ?ys) = (list_all ?P ?xs \<and> list_all ?P ?ys)

goal (1 subgoal):
 1. \<lbrakk>list_all (\<lambda>x. x < n) a; list_all (\<lambda>x. x < n) b\<rbrakk> \<Longrightarrow> list_all (\<lambda>x. x < n) (a @ b)
[PROOF STEP]
by blast


[STATEMENT]
lemma eventually_nonzero_at_top:
  assumes "filterlim (f :: 'a \<Rightarrow> 'b :: {linordered_field, real_normed_field}) at_top F"
  shows   "eventually_nonzero F f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually_nonzero F f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eventually_nonzero F f
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
filterlim f at_top F
[PROOF STEP]
have "eventually (\<lambda>x. f x \<ge> 1) F"
[PROOF STATE]
proof (prove)
using this:
filterlim f at_top F

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. (1::'b) \<le> f x
[PROOF STEP]
by (simp add: filterlim_at_top)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. (1::'b) \<le> f x

goal (1 subgoal):
 1. eventually_nonzero F f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. (1::'b) \<le> f x

goal (1 subgoal):
 1. eventually_nonzero F f
[PROOF STEP]
unfolding eventually_nonzero_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. (1::'b) \<le> f x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<noteq> (0::'b)
[PROOF STEP]
by eventually_elim auto
[PROOF STATE]
proof (state)
this:
eventually_nonzero F f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lexext_total: "(\<forall>y \<in> B. \<forall>x \<in> A. gt y x \<or> gt x y \<or> y = x) \<Longrightarrow> ys \<in> lists B \<Longrightarrow> xs \<in> lists A \<Longrightarrow>
  lexext gt ys xs \<or> lexext gt xs ys \<or> ys = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>y\<in>B. \<forall>x\<in>A. gt y x \<or> gt x y \<or> y = x; ys \<in> lists B; xs \<in> lists A\<rbrakk> \<Longrightarrow> lexext gt ys xs \<or> lexext gt xs ys \<or> ys = xs
[PROOF STEP]
by (induct ys xs rule: list_induct2') auto


[STATEMENT]
lemma unat_mod_distrib:
  \<open>unat (v mod w) = unat v mod unat w\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unat (v mod w) = unat v mod unat w
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v w. (nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) v mod take_bit LENGTH('a) w) = (nat \<circ> take_bit LENGTH('a)) v mod (nat \<circ> take_bit LENGTH('a)) w
[PROOF STEP]
fix k l
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v w. (nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) v mod take_bit LENGTH('a) w) = (nat \<circ> take_bit LENGTH('a)) v mod (nat \<circ> take_bit LENGTH('a)) w
[PROOF STEP]
have \<open>nat (take_bit LENGTH('a) k) mod nat (take_bit LENGTH('a) l) \<le> nat (take_bit LENGTH('a) k)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (take_bit LENGTH('a) k) mod nat (take_bit LENGTH('a) l) \<le> nat (take_bit LENGTH('a) k)
[PROOF STEP]
by (rule mod_less_eq_dividend)
[PROOF STATE]
proof (state)
this:
nat (take_bit LENGTH('a) k) mod nat (take_bit LENGTH('a) l) \<le> nat (take_bit LENGTH('a) k)

goal (1 subgoal):
 1. \<And>v w. (nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) v mod take_bit LENGTH('a) w) = (nat \<circ> take_bit LENGTH('a)) v mod (nat \<circ> take_bit LENGTH('a)) w
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat (take_bit LENGTH('a) k) mod nat (take_bit LENGTH('a) l) \<le> nat (take_bit LENGTH('a) k)

goal (1 subgoal):
 1. \<And>v w. (nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) v mod take_bit LENGTH('a) w) = (nat \<circ> take_bit LENGTH('a)) v mod (nat \<circ> take_bit LENGTH('a)) w
[PROOF STEP]
have \<open>nat (take_bit LENGTH('a) k) < 2 ^ LENGTH('a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (take_bit LENGTH('a) k) < 2 ^ LENGTH('a)
[PROOF STEP]
by (simp add: nat_less_iff)
[PROOF STATE]
proof (state)
this:
nat (take_bit LENGTH('a) k) < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. \<And>v w. (nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) v mod take_bit LENGTH('a) w) = (nat \<circ> take_bit LENGTH('a)) v mod (nat \<circ> take_bit LENGTH('a)) w
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
nat (take_bit LENGTH('a) k) mod nat (take_bit LENGTH('a) l) < 2 ^ LENGTH('a)
[PROOF STEP]
show \<open>(nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) k mod take_bit LENGTH('a) l) =
    (nat \<circ> take_bit LENGTH('a)) k mod (nat \<circ> take_bit LENGTH('a)) l\<close>
[PROOF STATE]
proof (prove)
using this:
nat (take_bit LENGTH('a) k) mod nat (take_bit LENGTH('a) l) < 2 ^ LENGTH('a)

goal (1 subgoal):
 1. (nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) k mod take_bit LENGTH('a) l) = (nat \<circ> take_bit LENGTH('a)) k mod (nat \<circ> take_bit LENGTH('a)) l
[PROOF STEP]
by (simp add: nat_take_bit_eq mod_int_pos_iff less_le nat_mod_distrib take_bit_nat_eq_self_iff)
[PROOF STATE]
proof (state)
this:
(nat \<circ> take_bit LENGTH('a)) (take_bit LENGTH('a) k mod take_bit LENGTH('a) l) = (nat \<circ> take_bit LENGTH('a)) k mod (nat \<circ> take_bit LENGTH('a)) l

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Amicable_pair_abundant: assumes "m > n" and  "m Amic n"
  shows "abundant_number n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abundant_number n
[PROOF STEP]
using assms abundant_number_def Amicable_pair_def
[PROOF STATE]
proof (prove)
using this:
n < m
m Amic n
abundant_number ?n \<equiv> ?n < aliquot_sum ?n
?m Amic ?n \<equiv> ?m = aliquot_sum ?n \<and> ?n = aliquot_sum ?m

goal (1 subgoal):
 1. abundant_number n
[PROOF STEP]
by metis


[STATEMENT]
lemma vec_of_list_coeffs_replicate_nth_0:
assumes i: "i \<in> {..<degree u}"
shows "vec_of_list (coeffs 0 @ replicate (degree u - length (coeffs 0)) 0) $ i = coeff 0 i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_list (coeffs 0 @ replicate (degree u - length (coeffs 0)) (0::'c)) $ i = coeff 0 i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> {..<degree u}

goal (1 subgoal):
 1. vec_of_list (coeffs 0 @ replicate (degree u - length (coeffs 0)) (0::'c)) $ i = coeff 0 i
[PROOF STEP]
by (transfer', auto simp add: mk_vec_def)


[STATEMENT]
lemma Example2_lemma2_aux2:
  "!!b. j\<le> s \<Longrightarrow> (\<Sum>i::nat=0..<j. (b (s:=t)) i) = (\<Sum>i=0..<j. b i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. j \<le> s \<Longrightarrow> sum (b(s := t)) {0..<j} = sum b {0..<j}
[PROOF STEP]
apply(induct j)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. 0 \<le> s \<Longrightarrow> sum (b(s := t)) {0..<0} = sum b {0..<0}
 2. \<And>j b. \<lbrakk>\<And>b. j \<le> s \<Longrightarrow> sum (b(s := t)) {0..<j} = sum b {0..<j}; Suc j \<le> s\<rbrakk> \<Longrightarrow> sum (b(s := t)) {0..<Suc j} = sum b {0..<Suc j}
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma log_le_one_cancel_iff[simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> log a x \<le> 1 \<longleftrightarrow> x \<le> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x\<rbrakk> \<Longrightarrow> (log a x \<le> 1) = (x \<le> a)
[PROOF STEP]
using log_le_cancel_iff[of a x a]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < a; 0 < x; 0 < a\<rbrakk> \<Longrightarrow> (log a x \<le> log a a) = (x \<le> a)

goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x\<rbrakk> \<Longrightarrow> (log a x \<le> 1) = (x \<le> a)
[PROOF STEP]
by simp


[STATEMENT]
lemma compact_sup_maxdistance:
  fixes S :: "'a::metric_space set"
  assumes "compact S"
    and "S \<noteq> {}"
  shows "\<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
have "compact (S \<times> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (S \<times> S)
[PROOF STEP]
using \<open>compact S\<close>
[PROOF STATE]
proof (prove)
using this:
compact S

goal (1 subgoal):
 1. compact (S \<times> S)
[PROOF STEP]
by (intro compact_Times)
[PROOF STATE]
proof (state)
this:
compact (S \<times> S)

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
compact (S \<times> S)

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
have "S \<times> S \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<times> S \<noteq> {}
[PROOF STEP]
using \<open>S \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {}

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

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S \<times> S \<noteq> {}

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
have "continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))
[PROOF STEP]
by (intro continuous_at_imp_continuous_on ballI continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
compact (S \<times> S)
S \<times> S \<noteq> {}
continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
compact (S \<times> S)
S \<times> S \<noteq> {}
continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
using continuous_attains_sup[of "S \<times> S" "\<lambda>x. dist (fst x) (snd x)"]
[PROOF STATE]
proof (prove)
using this:
compact (S \<times> S)
S \<times> S \<noteq> {}
continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))
\<lbrakk>compact (S \<times> S); S \<times> S \<noteq> {}; continuous_on (S \<times> S) (\<lambda>x. dist (fst x) (snd x))\<rbrakk> \<Longrightarrow> \<exists>x\<in>S \<times> S. \<forall>y\<in>S \<times> S. dist (fst y) (snd y) \<le> dist (fst x) (snd x)

goal (1 subgoal):
 1. \<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>S. \<exists>y\<in>S. \<forall>u\<in>S. \<forall>v\<in>S. dist u v \<le> dist x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiplicity_eq_zero_iff:
  shows   "multiplicity p x = 0 \<longleftrightarrow> \<not>p dvd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (multiplicity p x = 0) = (\<not> p dvd x)
[PROOF STEP]
using power_dvd_iff_le_multiplicity[of 1]
[PROOF STATE]
proof (prove)
using this:
(p ^ 1 dvd x) = (1 \<le> multiplicity p x)

goal (1 subgoal):
 1. (multiplicity p x = 0) = (\<not> p dvd x)
[PROOF STEP]
by auto


[STATEMENT]
lemma word_of_int_eq_0_iff:
  \<open>word_of_int k = (0 :: 'a::len word) \<longleftrightarrow> 2 ^ LENGTH('a) dvd k\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_of_int k = 0) = (2 ^ LENGTH('a) dvd k)
[PROOF STEP]
using word_of_int_eq_iff [where ?'a = 'a, of k 0]
[PROOF STATE]
proof (prove)
using this:
(word_of_int k = word_of_int 0) = (take_bit LENGTH('a) k = take_bit LENGTH('a) 0)

goal (1 subgoal):
 1. (word_of_int k = 0) = (2 ^ LENGTH('a) dvd k)
[PROOF STEP]
by (simp add: take_bit_eq_0_iff)


[STATEMENT]
lemma limsup_obtain:
  fixes u::"nat \<Rightarrow> 'a :: complete_linorder"
  assumes "limsup u > c"
  shows "\<exists>n \<ge> N. u n > c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n\<ge>N. c < u n
[PROOF STEP]
using Limsup_obtain'[OF assms, of "\<lambda>n. n \<ge> N"]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) N) sequentially \<Longrightarrow> \<exists>n\<ge>N. c < u n

goal (1 subgoal):
 1. \<exists>n\<ge>N. c < u n
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<exists>Na. \<forall>n\<ge>Na. N \<le> n \<Longrightarrow> \<exists>n\<ge>N. c < u n

goal (1 subgoal):
 1. \<exists>n\<ge>N. c < u n
[PROOF STEP]
by auto


[STATEMENT]
lemma multiplicity_eq_int:
  fixes x y :: int
  assumes "x > 0" "y > 0" "\<And>p. prime p \<Longrightarrow> multiplicity p x = multiplicity p y"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using multiplicity_eq_imp_eq[of x y] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<noteq> 0; y \<noteq> 0; \<And>p. prime p \<Longrightarrow> multiplicity p x = multiplicity p y\<rbrakk> \<Longrightarrow> normalize x = normalize y
0 < x
0 < y
prime ?p \<Longrightarrow> multiplicity ?p x = multiplicity ?p y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by simp


[STATEMENT]
lemma Sup_dual_upset_var: "(\<Inter>x \<in> X. \<up>x) = \<up>(\<Squnion>X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter> (\<up> ` X) = \<up> (\<Squnion> X)
[PROOF STEP]
by (simp add: dual_complete_lattice.Inf_pres_downset_var dual_upset)


[STATEMENT]
lemma poly_squarefree_decomp:
  fixes p :: "'a::field_char_0 poly"
  assumes "pderiv p \<noteq> 0"
    and "p = q * d"
    and "pderiv p = e * d"
    and "d = r * p + s * pderiv p"
  shows "rsquarefree q \<and> (\<forall>a. poly q a = 0 \<longleftrightarrow> poly p a = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rsquarefree q \<and> (\<forall>a. (poly q a = (0::'a)) = (poly p a = (0::'a)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rsquarefree q \<and> (\<forall>a. (poly q a = (0::'a)) = (poly p a = (0::'a)))
[PROOF STEP]
from \<open>pderiv p \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
pderiv p \<noteq> 0
[PROOF STEP]
have "p \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
pderiv p \<noteq> 0

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

goal (1 subgoal):
 1. rsquarefree q \<and> (\<forall>a. (poly q a = (0::'a)) = (poly p a = (0::'a)))
[PROOF STEP]
with \<open>p = q * d\<close>
[PROOF STATE]
proof (chain)
picking this:
p = q * d
p \<noteq> 0
[PROOF STEP]
have "q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p = q * d
p \<noteq> 0

goal (1 subgoal):
 1. q \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

goal (1 subgoal):
 1. rsquarefree q \<and> (\<forall>a. (poly q a = (0::'a)) = (poly p a = (0::'a)))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pderiv p \<noteq> 0
p = q * d
pderiv p = e * d
d = r * p + s * pderiv p
[PROOF STEP]
have "\<forall>a. order a q = (if order a p = 0 then 0 else 1)"
[PROOF STATE]
proof (prove)
using this:
pderiv p \<noteq> 0
p = q * d
pderiv p = e * d
d = r * p + s * pderiv p

goal (1 subgoal):
 1. \<forall>a. order a q = (if order a p = 0 then 0 else 1)
[PROOF STEP]
by (rule poly_squarefree_decomp_order2)
[PROOF STATE]
proof (state)
this:
\<forall>a. order a q = (if order a p = 0 then 0 else 1)

goal (1 subgoal):
 1. rsquarefree q \<and> (\<forall>a. (poly q a = (0::'a)) = (poly p a = (0::'a)))
[PROOF STEP]
with \<open>p \<noteq> 0\<close> \<open>q \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
q \<noteq> 0
\<forall>a. order a q = (if order a p = 0 then 0 else 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
q \<noteq> 0
\<forall>a. order a q = (if order a p = 0 then 0 else 1)

goal (1 subgoal):
 1. rsquarefree q \<and> (\<forall>a. (poly q a = (0::'a)) = (poly p a = (0::'a)))
[PROOF STEP]
by (simp add: rsquarefree_def order_root)
[PROOF STATE]
proof (state)
this:
rsquarefree q \<and> (\<forall>a. (poly q a = (0::'a)) = (poly p a = (0::'a)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem lfinite_prepend_induct[consumes 1, case_names LNil prepend]:
  assumes "lfinite xs"
    and LNil: "P LNil"
    and prepend: "\<And>xs. lfinite xs \<Longrightarrow> (\<And>zs. (\<exists>ys. xs = prepend ys zs \<and> ys \<noteq> []) \<Longrightarrow> P zs) \<Longrightarrow> P xs"
  shows "P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P xs
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
lfinite xs

goal (1 subgoal):
 1. P xs
[PROOF STEP]
proof (induct xs rule: lfinite_less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>lfinite xs; \<And>zs. llength zs < llength xs \<Longrightarrow> P zs\<rbrakk> \<Longrightarrow> P xs
[PROOF STEP]
case (less xs)
[PROOF STATE]
proof (state)
this:
lfinite xs
llength ?zs < llength xs \<Longrightarrow> P ?zs

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>lfinite xs; \<And>zs. llength zs < llength xs \<Longrightarrow> P zs\<rbrakk> \<Longrightarrow> P xs
[PROOF STEP]
from less(1)
[PROOF STATE]
proof (chain)
picking this:
lfinite xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
lfinite xs

goal (1 subgoal):
 1. P xs
[PROOF STEP]
by (cases xs)
      (force simp: LNil neq_Nil_conv dest: lfinite_llength_enat intro!: prepend[of "LCons _ _"] intro: less)+
[PROOF STATE]
proof (state)
this:
P xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma circlepath_add_half: "circlepath z r (x + 1/2) = circlepath z r (x - 1/2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circlepath z r (x + 1 / 2) = circlepath z r (x - 1 / 2)
[PROOF STEP]
using circlepath_add1 [of z r "x-1/2"]
[PROOF STATE]
proof (prove)
using this:
circlepath z r (x - 1 / 2 + 1) = circlepath z r (x - 1 / 2)

goal (1 subgoal):
 1. circlepath z r (x + 1 / 2) = circlepath z r (x - 1 / 2)
[PROOF STEP]
by (simp add: add.commute)


[STATEMENT]
lemma lower_triangular_pow:
  assumes "lower_triangular_mat X"
  shows "lower_triangular_mat (matpow X i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lower_triangular_mat (matpow X i)
[PROOF STEP]
using assms lower_triangular_mult lower_triangular_mat_mat
[PROOF STATE]
proof (prove)
using this:
lower_triangular_mat X
\<lbrakk>lower_triangular_mat ?X; lower_triangular_mat ?Y\<rbrakk> \<Longrightarrow> lower_triangular_mat (?X ** ?Y)
lower_triangular_mat (mat ?x)

goal (1 subgoal):
 1. lower_triangular_mat (matpow X i)
[PROOF STEP]
by (induction i) auto


[STATEMENT]
lemma sorted_quicksort [simp]: "sorted (quicksort xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (quicksort xs)
[PROOF STEP]
by(simp add: quicksort_def sorted_quicksort_acc)


[STATEMENT]
lemma bounded_by_mult:
  assumes sP: "sound P" and bP: "bounded_by a P"
      and sQ: "sound Q" and bQ: "bounded_by b Q"
  shows "bounded_by (a * b) (\<lambda>s. P s * Q s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_by (a * b) (\<lambda>s. P s * Q s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sound P
bounded_by a P
sound Q
bounded_by b Q

goal (1 subgoal):
 1. bounded_by (a * b) (\<lambda>s. P s * Q s)
[PROOF STEP]
by(intro bounded_byI, auto intro:mult_mono)


[STATEMENT]
lemma l2product_lmult:
   "\<lbrakk>f square_integrable S; g square_integrable S\<rbrakk>
    \<Longrightarrow> l2product S (\<lambda>x. c * f x) g = c * l2product S f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f square_integrable S; g square_integrable S\<rbrakk> \<Longrightarrow> l2product S (\<lambda>x. c * f x) g = c * l2product S f g
[PROOF STEP]
by (simp add: l2product_def algebra_simps)


[STATEMENT]
theorem wp2_is_weakestprePotential: "(\<forall>s. wp\<^sub>2 c Q s \<le> P s) \<longleftrightarrow> \<Turnstile>\<^sub>2 {P}c{Q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>s. wp\<^sub>2 c Q s \<le> P s) = (\<Turnstile>\<^sub>2 {P} c {Q})
[PROOF STEP]
using   wp2_is_weakestprePotential2  wp2_is_weakestprePotential1
[PROOF STATE]
proof (prove)
using this:
\<forall>s. wp\<^sub>2 ?c ?Q s \<le> ?P s \<Longrightarrow> \<Turnstile>\<^sub>2 {?P} ?c {?Q}
\<Turnstile>\<^sub>2 {?P} ?c {?Q} \<Longrightarrow> \<forall>s. wp\<^sub>2 ?c ?Q s \<le> ?P s

goal (1 subgoal):
 1. (\<forall>s. wp\<^sub>2 c Q s \<le> P s) = (\<Turnstile>\<^sub>2 {P} c {Q})
[PROOF STEP]
by metis


[STATEMENT]
lemma det_echelon_form_of_det:
  fixes A::"'a::{bezout_domain}^'n::{mod_type}^'n::{mod_type}"
  assumes ib: "is_bezout_ext bezout"
  shows "(fst (echelon_form_of_det A bezout)) * det A = det (snd (echelon_form_of_det A bezout))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_det A bezout) * det A = det (snd (echelon_form_of_det A bezout))
[PROOF STEP]
using det_echelon_form_of_upt_k_det ib
[PROOF STATE]
proof (prove)
using this:
is_bezout_ext ?bezout \<Longrightarrow> fst (echelon_form_of_upt_k_det ?bezout (1::?'a, ?A) ?k) * det ?A = det (snd (echelon_form_of_upt_k_det ?bezout (1::?'a, ?A) ?k))
is_bezout_ext bezout

goal (1 subgoal):
 1. fst (echelon_form_of_det A bezout) * det A = det (snd (echelon_form_of_det A bezout))
[PROOF STEP]
unfolding echelon_form_of_det_def
[PROOF STATE]
proof (prove)
using this:
is_bezout_ext ?bezout \<Longrightarrow> fst (echelon_form_of_upt_k_det ?bezout (1::?'a, ?A) ?k) * det ?A = det (snd (echelon_form_of_upt_k_det ?bezout (1::?'a, ?A) ?k))
is_bezout_ext bezout

goal (1 subgoal):
 1. fst (echelon_form_of_upt_k_det bezout (1::'a, A) (ncols A - 1)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (ncols A - 1)))
[PROOF STEP]
by simp


[STATEMENT]
lemma distinct_image_mset_inj:
  \<open>inj_on f (set_mset M) \<Longrightarrow> distinct_mset (image_mset f M) \<longleftrightarrow> distinct_mset M\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f (set_mset M) \<Longrightarrow> distinct_mset (image_mset f M) = distinct_mset M
[PROOF STEP]
by (induction M) (auto simp: inj_on_def)


[STATEMENT]
lemma type_to_set:
  assumes type_def: "\<exists>(Rep :: 'b \<Rightarrow> int) Abs. type_definition Rep Abs {0 ..< m :: int}"
  shows "class.nontriv (TYPE('b))" (is ?a) and "m = int CARD('b)" (is ?b)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.nontriv TYPE('b) &&& m = int CARD('b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = int CARD('b)
[PROOF STEP]
from type_def
[PROOF STATE]
proof (chain)
picking this:
\<exists>Rep Abs. type_definition Rep Abs {0..<m}
[PROOF STEP]
obtain rep :: "'b \<Rightarrow> int" and abs :: "int \<Rightarrow> 'b" where t: "type_definition rep abs {0 ..< m}"
[PROOF STATE]
proof (prove)
using this:
\<exists>Rep Abs. type_definition Rep Abs {0..<m}

goal (1 subgoal):
 1. (\<And>rep abs. type_definition rep abs {0..<m} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
type_definition rep abs {0..<m}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = int CARD('b)
[PROOF STEP]
have "card (UNIV :: 'b set) = card {0 ..< m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('b) = card {0..<m}
[PROOF STEP]
using t
[PROOF STATE]
proof (prove)
using this:
type_definition rep abs {0..<m}

goal (1 subgoal):
 1. CARD('b) = card {0..<m}
[PROOF STEP]
by (rule type_definition.card)
[PROOF STATE]
proof (state)
this:
CARD('b) = card {0..<m}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = int CARD('b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
CARD('b) = card {0..<m}

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = int CARD('b)
[PROOF STEP]
have "\<dots> = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (card {0..<m}) = m
[PROOF STEP]
using m1
[PROOF STATE]
proof (prove)
using this:
1 < m

goal (1 subgoal):
 1. int (card {0..<m}) = m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
int (card {0..<m}) = m

goal (2 subgoals):
 1. class.nontriv TYPE('b)
 2. m = int CARD('b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
int CARD('b) = m
[PROOF STEP]
show ?b
[PROOF STATE]
proof (prove)
using this:
int CARD('b) = m

goal (1 subgoal):
 1. m = int CARD('b)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
m = int CARD('b)

goal (1 subgoal):
 1. class.nontriv TYPE('b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = int CARD('b)
[PROOF STEP]
show ?a
[PROOF STATE]
proof (prove)
using this:
m = int CARD('b)

goal (1 subgoal):
 1. class.nontriv TYPE('b)
[PROOF STEP]
unfolding class.nontriv_def
[PROOF STATE]
proof (prove)
using this:
m = int CARD('b)

goal (1 subgoal):
 1. 1 < CARD('b)
[PROOF STEP]
using m1
[PROOF STATE]
proof (prove)
using this:
m = int CARD('b)
1 < m

goal (1 subgoal):
 1. 1 < CARD('b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
class.nontriv TYPE('b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lead_coeff_mult:
  assumes "f \<in> carrier (mult_of P)"
  assumes "g \<in> carrier (mult_of P)"
  shows "lead_coeff (f \<otimes>\<^bsub>P\<^esub> g) = lead_coeff f \<otimes> lead_coeff g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (f \<otimes>\<^bsub>P\<^esub> g) = lead_coeff f \<otimes> lead_coeff g
[PROOF STEP]
unfolding univ_poly_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (poly_mult f g) = lead_coeff f \<otimes> lead_coeff g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Ring_Divisibility.mult_of P)
g \<in> carrier (Ring_Divisibility.mult_of P)

goal (1 subgoal):
 1. lead_coeff (poly_mult f g) = lead_coeff f \<otimes> lead_coeff g
[PROOF STEP]
using univ_poly_carrier[where R="R" and K="carrier R"]
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Ring_Divisibility.mult_of P)
g \<in> carrier (Ring_Divisibility.mult_of P)
polynomial (carrier R) ?p = (?p \<in> carrier P)

goal (1 subgoal):
 1. lead_coeff (poly_mult f g) = lead_coeff f \<otimes> lead_coeff g
[PROOF STEP]
by (subst poly_mult_lead_coeff) (simp_all add:univ_poly_zero)


[STATEMENT]
lemma square_one_cong_one:
  assumes "[x = 1](mod n)"
  shows "[x^2 = 1](mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x\<^sup>2 = 1::'a] (mod n)
[PROOF STEP]
using assms cong_pow
[PROOF STATE]
proof (prove)
using this:
[x = 1::'a] (mod n)
[?b = ?c] (mod ?a) \<Longrightarrow> [?b ^ ?n = ?c ^ ?n] (mod ?a)

goal (1 subgoal):
 1. [x\<^sup>2 = 1::'a] (mod n)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma derived_set_of_subtopology:
   "(subtopology X U) derived_set_of S = U \<inter> (X derived_set_of (U \<inter> S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology X U derived_set_of S = U \<inter> X derived_set_of (U \<inter> S)
[PROOF STEP]
by (simp add: derived_set_of_def openin_subtopology) blast


[STATEMENT]
lemma orientable_2_implies_1:
  "orientable_2 x \<Longrightarrow> orientable_1 x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. orientable_2 x \<Longrightarrow> orientable_1 x
[PROOF STEP]
using loop_super_orientable_def
[PROOF STATE]
proof (prove)
using this:
orientable_1 ?x \<equiv> \<exists>y. loop_super_orientation ?x y

goal (1 subgoal):
 1. orientable_2 x \<Longrightarrow> orientable_1 x
[PROOF STEP]
by auto


[STATEMENT]
lemma hnorm_one [simp]: "hnorm (1::'a::real_normed_div_algebra star) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hnorm 1 = 1
[PROOF STEP]
by transfer (rule norm_one)


[STATEMENT]
lemma isomorphic_designs_implies_bij: "(\<V>, \<B>) \<cong>\<^sub>D (\<V>', \<B>') \<Longrightarrow> \<exists> \<pi> . bij_betw \<pi> \<V> \<V>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<V>, \<B>) \<cong>\<^sub>D (\<V>', \<B>') \<Longrightarrow> \<exists>\<pi>. bij_betw \<pi> \<V> \<V>'
[PROOF STEP]
using incidence_system_isomorphism.bij isomorphic_designs_def
[PROOF STATE]
proof (prove)
using this:
incidence_system_isomorphism ?\<V> ?\<B> ?\<V>' ?\<B>' ?bij_map \<Longrightarrow> bij_betw ?bij_map ?\<V> ?\<V>'
(?\<D> \<cong>\<^sub>D ?\<D>') = (\<exists>\<pi>. design_isomorphism (fst ?\<D>) (snd ?\<D>) (fst ?\<D>') (snd ?\<D>') \<pi>)

goal (1 subgoal):
 1. (\<V>, \<B>) \<cong>\<^sub>D (\<V>', \<B>') \<Longrightarrow> \<exists>\<pi>. bij_betw \<pi> \<V> \<V>'
[PROOF STEP]
by (metis design_isomorphism.axioms(1) fst_conv)


[STATEMENT]
lemma coeff_xy_power:
  assumes "k \<le> n"
  shows  "coeff (x_y ^ n :: 'a :: comm_ring_1 poly poly) k =
          monom (of_nat (n choose (n - k)) * (- 1) ^ k) (n - k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
define X :: "'a poly poly" where "X = monom (monom 1 1) 0"
[PROOF STATE]
proof (state)
this:
X = monom (monom (1::'a) 1) 0

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
define Y :: "'a poly poly" where "Y = monom (-1) 1"
[PROOF STATE]
proof (state)
this:
Y = monom (- 1) 1

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
have [simp]: "monom 1 b * (-1) ^ k = monom ((-1)^k :: 'a) b" for b k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (1::'a) b * (- 1) ^ k = monom ((- (1::'a)) ^ k) b
[PROOF STEP]
by (auto simp: monom_altdef minus_one_power_iff)
[PROOF STATE]
proof (state)
this:
monom (1::'a) ?b * (- 1) ^ ?k = monom ((- (1::'a)) ^ ?k) ?b

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
have "(X + Y) ^ n = (\<Sum>i\<le>n. of_nat (n choose i) * X ^ i * Y ^ (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X + Y) ^ n = (\<Sum>i\<le>n. of_nat (n choose i) * X ^ i * Y ^ (n - i))
[PROOF STEP]
by (subst binomial_ring) auto
[PROOF STATE]
proof (state)
this:
(X + Y) ^ n = (\<Sum>i\<le>n. of_nat (n choose i) * X ^ i * Y ^ (n - i))

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(X + Y) ^ n = (\<Sum>i\<le>n. of_nat (n choose i) * X ^ i * Y ^ (n - i))

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>n. of_nat (n choose i) * monom (monom ((-1) ^ (n - i)) i) (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. of_nat (n choose i) * X ^ i * Y ^ (n - i)) = (\<Sum>i\<le>n. of_nat (n choose i) * monom (monom ((- (1::'a)) ^ (n - i)) i) (n - i))
[PROOF STEP]
by (simp add: X_def Y_def monom_power mult_monom mult.assoc)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (n choose i) * X ^ i * Y ^ (n - i)) = (\<Sum>i\<le>n. of_nat (n choose i) * monom (monom ((- (1::'a)) ^ (n - i)) i) (n - i))

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (n choose i) * X ^ i * Y ^ (n - i)) = (\<Sum>i\<le>n. of_nat (n choose i) * monom (monom ((- (1::'a)) ^ (n - i)) i) (n - i))

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>n. monom (monom (of_nat (n choose i) * (-1) ^ (n - i)) i) (n - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. of_nat (n choose i) * monom (monom ((- (1::'a)) ^ (n - i)) i) (n - i)) = (\<Sum>i\<le>n. monom (monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i) (n - i))
[PROOF STEP]
by (simp add: of_nat_poly smult_monom)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (n choose i) * monom (monom ((- (1::'a)) ^ (n - i)) i) (n - i)) = (\<Sum>i\<le>n. monom (monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i) (n - i))

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. of_nat (n choose i) * monom (monom ((- (1::'a)) ^ (n - i)) i) (n - i)) = (\<Sum>i\<le>n. monom (monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i) (n - i))

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
have "coeff \<dots> k =
    (\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- 1) ^ (n - i)) i else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff (\<Sum>i\<le>n. monom (monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i) (n - i)) k = (\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i else 0)
[PROOF STEP]
by (simp add: of_nat_poly coeff_sum)
[PROOF STATE]
proof (state)
this:
coeff (\<Sum>i\<le>n. monom (monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i) (n - i)) k = (\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i else 0)

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
coeff (\<Sum>i\<le>n. monom (monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i) (n - i)) k = (\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i else 0)

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<in>{n-k}. monom (of_nat (n choose i) * (- 1) ^ (n - i)) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i else 0) = (\<Sum>i\<in>{n - k}. monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i)
[PROOF STEP]
using \<open>k \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
k \<le> n

goal (1 subgoal):
 1. (\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i else 0) = (\<Sum>i\<in>{n - k}. monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i)
[PROOF STEP]
by (intro sum.mono_neutral_cong_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i else 0) = (\<Sum>i\<in>{n - k}. monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i)

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. if n - i = k then monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i else 0) = (\<Sum>i\<in>{n - k}. monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i)

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
have "X + Y = x_y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X + Y = x_y
[PROOF STEP]
by (simp add: X_def Y_def x_y_def monom_altdef)
[PROOF STATE]
proof (state)
this:
X + Y = x_y

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
coeff (x_y ^ n) k = (\<Sum>i\<in>{n - k}. monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (x_y ^ n) k = (\<Sum>i\<in>{n - k}. monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i)

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
using \<open>k \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
coeff (x_y ^ n) k = (\<Sum>i\<in>{n - k}. monom (of_nat (n choose i) * (- (1::'a)) ^ (n - i)) i)
k \<le> n

goal (1 subgoal):
 1. coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff (x_y ^ n) k = monom (of_nat (n choose (n - k)) * (- (1::'a)) ^ k) (n - k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_Un [simp]:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes "f integrable_on S" "f integrable_on T" "negligible (S \<inter> T)"
  shows "integral (S \<union> T) f = integral S f + integral T f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (S \<union> T) f = integral S f + integral T f
[PROOF STEP]
by (simp add: has_integral_Un assms integrable_integral integral_unique)


[STATEMENT]
lemma ntcf_rcomp_Hom_component_ArrVal_vdomain[cat_cs_simps]:
  assumes "\<psi> : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>" and "a \<in>\<^sub>\<circ> op_cat \<CC>\<lparr>Obj\<rparr>"
  shows "\<D>\<^sub>\<circ> (ntcf_rcomp_Hom_component \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (ntcf_rcomp_Hom_component \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (ntcf_rcomp_Hom_component \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)
[PROOF STEP]
interpret \<psi>: is_ntcf \<alpha> \<BB> \<CC> \<FF> \<GG> \<psi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<psi> : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (ntcf_rcomp_Hom_component \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (ntcf_rcomp_Hom_component \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<psi> : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
a \<in>\<^sub>\<circ> op_cat \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (ntcf_rcomp_Hom_component \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)
[PROOF STEP]
unfolding cat_op_simps ntcf_rcomp_Hom_component_def \<psi>.ntcf_NTDGCod
[PROOF STATE]
proof (prove)
using this:
\<psi> : \<FF> \<mapsto>\<^sub>C\<^sub>F \<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
a \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (ntcf_Hom_component (ntcf_id (dghm_id \<CC>)) \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)
[PROOF STEP]
by (cs_concl cs_simp: cat_cs_simps cs_intro: cat_cs_intros)
[PROOF STATE]
proof (state)
this:
\<D>\<^sub>\<circ> (ntcf_rcomp_Hom_component \<psi> a b\<lparr>ArrVal\<rparr>) = Hom \<CC> a (\<FF>\<lparr>ObjMap\<rparr>\<lparr>b\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_degree_bound: assumes x: "x \<ge> (1 :: 'a :: poly_carrier)"
  and c: "c \<ge> poly_coeff_sum p"
  and d: "d \<ge> poly_degree p"
  shows "c * (x ^ d) \<ge> eval_poly (\<lambda> _. x) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_poly (\<lambda>_. x) p \<le> c * x ^ d
[PROOF STEP]
by (rule ge_trans[OF ge_trans[OF
    times_left_mono[OF pow_ge_zero[OF ge_trans[OF x one_ge_zero]] c]
    times_right_mono[OF poly_coeff_sum pow_mono_exp[OF x d]]] poly_degree[OF x]])


[STATEMENT]
lemma log_base_powr: "a \<noteq> 0 \<Longrightarrow> log (a powr b) x = log a x / b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> log (a powr b) x = log a x / b
[PROOF STEP]
by (simp add: log_def ln_powr)


[STATEMENT]
lemma supremum_sound:
  assumes "finite S"
  shows "\<And> t. t \<in> S \<Longrightarrow> less_eq t (supremum S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. t \<in> S \<Longrightarrow> less_eq t (supremum S)
[PROOF STEP]
using assms sup_l sup_r trans
[PROOF STATE]
proof (prove)
using this:
finite S
less_eq ?x (f ?x ?y)
less_eq ?y (f ?x ?y)
\<lbrakk>less_eq ?x ?y; less_eq ?y ?z\<rbrakk> \<Longrightarrow> less_eq ?x ?z

goal (1 subgoal):
 1. \<And>t. t \<in> S \<Longrightarrow> less_eq t (supremum S)
[PROOF STEP]
by induct (auto, blast)


[STATEMENT]
lemma size_Un_Int: "size A + size B = size (A \<union># B) + size (A \<inter># B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size A + size B = size (A \<union># B) + size (A \<inter># B)
[PROOF STEP]
by (metis inter_subset_eq_union size_union subset_mset.diff_add union_diff_inter_eq_sup)


[STATEMENT]
lemma nat_power_minus_less:
  "a < 2 ^ (x - n) \<Longrightarrow> (a :: nat) < 2 ^ x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < 2 ^ (x - n) \<Longrightarrow> a < 2 ^ x
[PROOF STEP]
by (erule order_less_le_trans) simp


[STATEMENT]
lemma
  mtf2_forward_effect4': "q \<in> set xs \<Longrightarrow> distinct xs \<Longrightarrow> index xs x < index xs q - n
      \<Longrightarrow> index (mtf2 n q xs) (xs!index xs x) = index xs (xs!index xs x) \<and> index (mtf2 n q xs) (xs!index xs x) < index xs q - n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>q \<in> set xs; distinct xs; index xs x < index xs q - n\<rbrakk> \<Longrightarrow> index (mtf2 n q xs) (xs ! index xs x) = index xs (xs ! index xs x) \<and> index (mtf2 n q xs) (xs ! index xs x) < index xs q - n
[PROOF STEP]
using mtf2_forward_effect4[where xs=xs and i="index xs x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q \<in> set xs; distinct xs; index xs x < index xs ?q - ?n\<rbrakk> \<Longrightarrow> index (mtf2 ?n ?q xs) (xs ! index xs x) = index xs (xs ! index xs x) \<and> index (mtf2 ?n ?q xs) (xs ! index xs x) < index xs ?q - ?n

goal (1 subgoal):
 1. \<lbrakk>q \<in> set xs; distinct xs; index xs x < index xs q - n\<rbrakk> \<Longrightarrow> index (mtf2 n q xs) (xs ! index xs x) = index xs (xs ! index xs x) \<and> index (mtf2 n q xs) (xs ! index xs x) < index xs q - n
[PROOF STEP]
by fast


[STATEMENT]
theorem hta_union_correct:
  assumes TA: "hashedTa H1" "hashedTa H2"
  shows
    "ta_lang (hta_\<alpha> (hta_union H1 H2))
     = ta_lang (hta_\<alpha> H1) \<union> ta_lang (hta_\<alpha> H2)" (is ?T1)
    "hashedTa (hta_union H1 H2)" (is ?T2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_lang (hta_\<alpha> (hta_union H1 H2)) = ta_lang (hta_\<alpha> H1) \<union> ta_lang (hta_\<alpha> H2) &&& hashedTa (hta_union H1 H2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ta_lang (hta_\<alpha> (hta_union H1 H2)) = ta_lang (hta_\<alpha> H1) \<union> ta_lang (hta_\<alpha> H2)
 2. hashedTa (hta_union H1 H2)
[PROOF STEP]
interpret a1: hashedTa H1 + a2: hashedTa H2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hashedTa H1 &&& hashedTa H2
[PROOF STEP]
using TA
[PROOF STATE]
proof (prove)
using this:
hashedTa H1
hashedTa H2

goal (1 subgoal):
 1. hashedTa H1 &&& hashedTa H2
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ta_lang (hta_\<alpha> (hta_union H1 H2)) = ta_lang (hta_\<alpha> H1) \<union> ta_lang (hta_\<alpha> H2)
 2. hashedTa (hta_union H1 H2)
[PROOF STEP]
show ?T1 ?T2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_lang (hta_\<alpha> (hta_union H1 H2)) = ta_lang (hta_\<alpha> H1) \<union> ta_lang (hta_\<alpha> H2) &&& hashedTa (hta_union H1 H2)
[PROOF STEP]
by (simp_all add: hta_union_correct'[OF TA] ta_union_wrap_correct)
[PROOF STATE]
proof (state)
this:
ta_lang (hta_\<alpha> (hta_union H1 H2)) = ta_lang (hta_\<alpha> H1) \<union> ta_lang (hta_\<alpha> H2)
hashedTa (hta_union H1 H2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma num_params_split_by_degree_le: "num_params (fst (split_by_degree ord x)) \<le> K"
  "num_params (snd (split_by_degree ord x)) \<le> K"
  if "num_params x \<le> K" for x::"float poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. num_params (fst (split_by_degree ord x)) \<le> K &&& num_params (snd (split_by_degree ord x)) \<le> K
[PROOF STEP]
using split_by_degree_correct_insertion(3,4)[of ord x, OF surjective_pairing] that
[PROOF STATE]
proof (prove)
using this:
num_params (fst (split_by_degree ord x)) \<le> num_params x
num_params (snd (split_by_degree ord x)) \<le> num_params x
num_params x \<le> K

goal (1 subgoal):
 1. num_params (fst (split_by_degree ord x)) \<le> K &&& num_params (snd (split_by_degree ord x)) \<le> K
[PROOF STEP]
by auto


[STATEMENT]
lemma mapping_of_pmf_pmf_of_list:
  assumes "\<And>x. x \<in> snd ` set xs \<Longrightarrow> x > 0" "sum_list (map snd xs) = 1"
  shows   "mapping_of_pmf (pmf_of_list xs) =
             Mapping.tabulate (remdups (map fst xs))
               (\<lambda>x. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mapping_of_pmf (pmf_of_list xs) = Mapping.tabulate (remdups (map fst xs)) (\<lambda>x. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mapping_of_pmf (pmf_of_list xs) = Mapping.tabulate (remdups (map fst xs)) (\<lambda>x. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
?x \<in> snd ` set xs \<Longrightarrow> 0 < ?x
sum_list (map snd xs) = 1
[PROOF STEP]
have wf: "pmf_of_list_wf xs"
[PROOF STATE]
proof (prove)
using this:
?x \<in> snd ` set xs \<Longrightarrow> 0 < ?x
sum_list (map snd xs) = 1

goal (1 subgoal):
 1. pmf_of_list_wf xs
[PROOF STEP]
by (intro pmf_of_list_wfI) force
[PROOF STATE]
proof (state)
this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. mapping_of_pmf (pmf_of_list xs) = Mapping.tabulate (remdups (map fst xs)) (\<lambda>x. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
?x \<in> snd ` set xs \<Longrightarrow> 0 < ?x
sum_list (map snd xs) = 1
pmf_of_list_wf xs
[PROOF STEP]
have "set_pmf (pmf_of_list xs) = fst ` set xs"
[PROOF STATE]
proof (prove)
using this:
?x \<in> snd ` set xs \<Longrightarrow> 0 < ?x
sum_list (map snd xs) = 1
pmf_of_list_wf xs

goal (1 subgoal):
 1. set_pmf (pmf_of_list xs) = fst ` set xs
[PROOF STEP]
by (intro set_pmf_of_list_eq) auto
[PROOF STATE]
proof (state)
this:
set_pmf (pmf_of_list xs) = fst ` set xs

goal (1 subgoal):
 1. mapping_of_pmf (pmf_of_list xs) = Mapping.tabulate (remdups (map fst xs)) (\<lambda>x. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
with wf
[PROOF STATE]
proof (chain)
picking this:
pmf_of_list_wf xs
set_pmf (pmf_of_list xs) = fst ` set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs
set_pmf (pmf_of_list xs) = fst ` set xs

goal (1 subgoal):
 1. mapping_of_pmf (pmf_of_list xs) = Mapping.tabulate (remdups (map fst xs)) (\<lambda>x. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
by (intro mapping_of_pmfI) (auto simp: lookup_tabulate pmf_pmf_of_list)
[PROOF STATE]
proof (state)
this:
mapping_of_pmf (pmf_of_list xs) = Mapping.tabulate (remdups (map fst xs)) (\<lambda>x. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma face_of_Int_supporting_hyperplane_ge_strong:
   "\<lbrakk>convex(S \<inter> {x. a \<bullet> x = b}); \<And>x. x \<in> S \<Longrightarrow> a \<bullet> x \<ge> b\<rbrakk>
    \<Longrightarrow> (S \<inter> {x. a \<bullet> x = b}) face_of S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>convex (S \<inter> {x. a \<bullet> x = b}); \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> S \<inter> {x. a \<bullet> x = b} face_of S
[PROOF STEP]
using face_of_Int_supporting_hyperplane_le_strong [of S "-a" "-b"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>convex (S \<inter> {x. - a \<bullet> x = - b}); \<And>x. x \<in> S \<Longrightarrow> - a \<bullet> x \<le> - b\<rbrakk> \<Longrightarrow> S \<inter> {x. - a \<bullet> x = - b} face_of S

goal (1 subgoal):
 1. \<lbrakk>convex (S \<inter> {x. a \<bullet> x = b}); \<And>x. x \<in> S \<Longrightarrow> b \<le> a \<bullet> x\<rbrakk> \<Longrightarrow> S \<inter> {x. a \<bullet> x = b} face_of S
[PROOF STEP]
by simp


[STATEMENT]
lemma (in ceuclidean_space) ceuclidean_cinner: "cinner x y = (\<Sum>b\<in>CBasis. cinner x b * cnj (cinner y b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<bullet>\<^sub>C y = (\<Sum>b\<in>CBasis. x \<bullet>\<^sub>C b * cnj (y \<bullet>\<^sub>C b))
[PROOF STEP]
apply (subst (1 2) ceuclidean_representation [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>CBasis. (b \<bullet>\<^sub>C x) *\<^sub>C b) \<bullet>\<^sub>C (\<Sum>b\<in>CBasis. (b \<bullet>\<^sub>C y) *\<^sub>C b) = (\<Sum>b\<in>CBasis. x \<bullet>\<^sub>C b * cnj (y \<bullet>\<^sub>C b))
[PROOF STEP]
apply (simp add: cinner_sum_right cinner_CBasis ac_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>CBasis. b \<bullet>\<^sub>C y * cnj (b \<bullet>\<^sub>C x)) = (\<Sum>b\<in>CBasis. x \<bullet>\<^sub>C b * cnj (y \<bullet>\<^sub>C b))
[PROOF STEP]
by (metis local.cinner_commute mult.commute)


[STATEMENT]
lemma fixes rhs n
  defines "rhs \<equiv> List.maps (\<lambda>x. [Suc 0..<sum_list_cons (replicate_prod x) x]) [2..<n]"
  shows "(concat (map (\<lambda>x. [1..<sum_list (replicate x x)]) [2..<n])) = rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>x. [1..<sum_list (replicate x x)]) [2..<n]) = rhs
[PROOF STEP]
using [[simproc add: stream_fusion, stream_fusion_trace]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat (map (\<lambda>x. [1..<sum_list (replicate x x)]) [2..<n]) = rhs
[PROOF STEP]
apply(simp add: concat_map_maps) \<comment> \<open>fuses partially\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.maps (\<lambda>x. [Suc 0..<sum_list_cons (replicate_prod x) x]) [2..<n] = rhs
[PROOF STEP]
by(unfold rhs_def) rule


[STATEMENT]
theorem strong_Nullstellensatz:
  assumes "finite X" and "F \<subseteq> P[X]"
  shows "\<I> (\<V> F) = \<surd>ideal (F::((_::{countable,linorder} \<Rightarrow>\<^sub>0 nat) \<Rightarrow>\<^sub>0 _::alg_closed_field) set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<I> (\<V> F) = \<surd>ideal F
[PROOF STEP]
proof (intro subset_antisym subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> \<I> (\<V> F) \<Longrightarrow> x \<in> \<surd>ideal F
 2. \<And>x. x \<in> \<surd>ideal F \<Longrightarrow> x \<in> \<I> (\<V> F)
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> \<I> (\<V> F) \<Longrightarrow> x \<in> \<surd>ideal F
 2. \<And>x. x \<in> \<surd>ideal F \<Longrightarrow> x \<in> \<I> (\<V> F)
[PROOF STEP]
assume "f \<in> \<I> (\<V> F)"
[PROOF STATE]
proof (state)
this:
f \<in> \<I> (\<V> F)

goal (2 subgoals):
 1. \<And>x. x \<in> \<I> (\<V> F) \<Longrightarrow> x \<in> \<surd>ideal F
 2. \<And>x. x \<in> \<surd>ideal F \<Longrightarrow> x \<in> \<I> (\<V> F)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite X
F \<subseteq> P[X]
f \<in> \<I> (\<V> F)
[PROOF STEP]
show "f \<in> \<surd>ideal F"
[PROOF STATE]
proof (prove)
using this:
finite X
F \<subseteq> P[X]
f \<in> \<I> (\<V> F)

goal (1 subgoal):
 1. f \<in> \<surd>ideal F
[PROOF STEP]
by (rule Nullstellensatz)
[PROOF STATE]
proof (state)
this:
f \<in> \<surd>ideal F

goal (1 subgoal):
 1. \<And>x. x \<in> \<surd>ideal F \<Longrightarrow> x \<in> \<I> (\<V> F)
[PROOF STEP]
qed (metis ideal_ofI variety_ofD variety_of_radical_ideal)


[STATEMENT]
lemma omg_n_2_min1:  "\<omega>^(n div 2) = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<omega> ^ (n div 2) = - 1
[PROOF STEP]
by (metis n_lst2 n_min1_2 n_min1_gr2 nat_less_le numeral_Bit0_div_2 numerals(1) power_one_right)


[STATEMENT]
lemma product_atMost_eq_Un: "A \<times> {..m} = (SIGMA i:A.{..m - i}) \<union> (SIGMA i:A.{m - i<..m})"
  for m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<times> {..m} = (SIGMA i:A. {..m - i}) \<union> (SIGMA i:A. {m - i<..m})
[PROOF STEP]
by auto


[STATEMENT]
lemma qbs_prob_integral_def2:
  "qbs_prob_integral (s::'a qbs_prob_space) f = integral\<^sup>L (qbs_prob_measure s) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_prob_integral s f = qbs_prob_measure_prob_space.expectation s f
[PROOF STEP]
proof(transfer,auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a aa b f. qbs_prob_eq (a, aa, b) (a, aa, b) \<Longrightarrow> qbs_prob_t_integral (a, aa, b) f = integral\<^sup>L (qbs_prob_t_measure (a, aa, b)) f
[PROOF STEP]
fix X :: "'a quasi_borel" and \<mu> \<alpha> f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a aa b f. qbs_prob_eq (a, aa, b) (a, aa, b) \<Longrightarrow> qbs_prob_t_integral (a, aa, b) f = integral\<^sup>L (qbs_prob_t_measure (a, aa, b)) f
[PROOF STEP]
assume "qbs_prob_eq (X,\<alpha>,\<mu>) (X,\<alpha>,\<mu>)"
[PROOF STATE]
proof (state)
this:
qbs_prob_eq (X, \<alpha>, \<mu>) (X, \<alpha>, \<mu>)

goal (1 subgoal):
 1. \<And>a aa b f. qbs_prob_eq (a, aa, b) (a, aa, b) \<Longrightarrow> qbs_prob_t_integral (a, aa, b) f = integral\<^sup>L (qbs_prob_t_measure (a, aa, b)) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
qbs_prob_eq (X, \<alpha>, \<mu>) (X, \<alpha>, \<mu>)
[PROOF STEP]
interpret qp : qbs_prob X \<alpha> \<mu>
[PROOF STATE]
proof (prove)
using this:
qbs_prob_eq (X, \<alpha>, \<mu>) (X, \<alpha>, \<mu>)

goal (1 subgoal):
 1. qbs_prob X \<alpha> \<mu>
[PROOF STEP]
by(simp add: qbs_prob_eq_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a aa b f. qbs_prob_eq (a, aa, b) (a, aa, b) \<Longrightarrow> qbs_prob_t_integral (a, aa, b) f = integral\<^sup>L (qbs_prob_t_measure (a, aa, b)) f
[PROOF STEP]
show "qbs_prob_t_integral (X,\<alpha>,\<mu>) f = integral\<^sup>L (qbs_prob_t_measure (X,\<alpha>,\<mu>)) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qbs_prob_t_integral (X, \<alpha>, \<mu>) f = integral\<^sup>L (qbs_prob_t_measure (X, \<alpha>, \<mu>)) f
[PROOF STEP]
using qp.qbs_prob_integral_def2
[PROOF STATE]
proof (prove)
using this:
qbs_prob_integral (qbs_prob_space (X, \<alpha>, \<mu>)) ?f = integral\<^sup>L (distr \<mu> (qbs_to_measure X) \<alpha>) ?f

goal (1 subgoal):
 1. qbs_prob_t_integral (X, \<alpha>, \<mu>) f = integral\<^sup>L (qbs_prob_t_measure (X, \<alpha>, \<mu>)) f
[PROOF STEP]
by(simp add: qbs_prob_t_measure_def qbs_prob_integral.abs_eq)
[PROOF STATE]
proof (state)
this:
qbs_prob_t_integral (X, \<alpha>, \<mu>) f = integral\<^sup>L (qbs_prob_t_measure (X, \<alpha>, \<mu>)) f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fix_ind_k_skip:
  fixes k::nat
  assumes k_1: "k \<ge> 1"
  assumes adm: "adm P"
  assumes base_k_steps: "\<forall>i<k. P (iterate i\<cdot>f\<cdot>\<bottom>)"
  assumes step: "\<And>x. P x \<Longrightarrow> P (iterate k\<cdot>f\<cdot>x)"
  shows "P (fix\<cdot>f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (fix\<cdot>f)
[PROOF STEP]
unfolding fix_def2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (\<Squnion>i. iterate i\<cdot>f\<cdot>\<bottom>)
[PROOF STEP]
apply (rule admD [OF adm chain_iterate])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. P (iterate i\<cdot>f\<cdot>\<bottom>)
[PROOF STEP]
apply(rule nat_k_skip_induct[of k])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. 1 \<le> k
 2. \<And>i. \<forall>i<k. P (iterate i\<cdot>f\<cdot>\<bottom>)
 3. \<And>i. \<forall>n\<^sub>0. P (iterate n\<^sub>0\<cdot>f\<cdot>\<bottom>) \<longrightarrow> P (iterate (n\<^sub>0 + k)\<cdot>f\<cdot>\<bottom>)
[PROOF STEP]
using k_1 base_k_steps
[PROOF STATE]
proof (prove)
using this:
1 \<le> k
\<forall>i<k. P (iterate i\<cdot>f\<cdot>\<bottom>)

goal (3 subgoals):
 1. \<And>i. 1 \<le> k
 2. \<And>i. \<forall>i<k. P (iterate i\<cdot>f\<cdot>\<bottom>)
 3. \<And>i. \<forall>n\<^sub>0. P (iterate n\<^sub>0\<cdot>f\<cdot>\<bottom>) \<longrightarrow> P (iterate (n\<^sub>0 + k)\<cdot>f\<cdot>\<bottom>)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n\<^sub>0. \<lbrakk>Suc 0 \<le> k; \<forall>i<k. P (iterate i\<cdot>f\<cdot>\<bottom>); P (iterate n\<^sub>0\<cdot>f\<cdot>\<bottom>)\<rbrakk> \<Longrightarrow> P (iterate (n\<^sub>0 + k)\<cdot>f\<cdot>\<bottom>)
[PROOF STEP]
using step
[PROOF STATE]
proof (prove)
using this:
P ?x \<Longrightarrow> P (iterate k\<cdot>f\<cdot>?x)

goal (1 subgoal):
 1. \<And>n\<^sub>0. \<lbrakk>Suc 0 \<le> k; \<forall>i<k. P (iterate i\<cdot>f\<cdot>\<bottom>); P (iterate n\<^sub>0\<cdot>f\<cdot>\<bottom>)\<rbrakk> \<Longrightarrow> P (iterate (n\<^sub>0 + k)\<cdot>f\<cdot>\<bottom>)
[PROOF STEP]
by (subst add.commute, unfold iterate_iterate[symmetric]) blast


[STATEMENT]
lemma sorted_map_strict:
  assumes "strict_mono_on {0..<n} g"
  shows "sorted (map g [0..<n])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (map g [0..<n])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_mono_on {0..<n} g

goal (1 subgoal):
 1. sorted (map g [0..<n])
[PROOF STEP]
by (induct n, auto simp add: sorted_append strict_mono_on_def less_imp_le)


[STATEMENT]
lemma Lim_in_closed_set:
  assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) F" "F \<noteq> bot" "(f \<longlongrightarrow> l) F"
  shows "l \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l \<in> S
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
assume "l \<notin> S"
[PROOF STATE]
proof (state)
this:
l \<notin> S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with \<open>closed S\<close>
[PROOF STATE]
proof (chain)
picking this:
closed S
l \<notin> S
[PROOF STEP]
have "open (- S)" "l \<in> - S"
[PROOF STATE]
proof (prove)
using this:
closed S
l \<notin> S

goal (1 subgoal):
 1. open (- S) &&& l \<in> - S
[PROOF STEP]
by (simp_all add: open_Compl)
[PROOF STATE]
proof (state)
this:
open (- S)
l \<in> - S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(4)
[PROOF STATE]
proof (chain)
picking this:
(f \<longlongrightarrow> l) F
open (- S)
l \<in> - S
[PROOF STEP]
have "eventually (\<lambda>x. f x \<in> - S) F"
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> l) F
open (- S)
l \<in> - S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. f x \<in> - S
[PROOF STEP]
by (rule topological_tendstoD)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. f x \<in> - S

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in F. f x \<in> S
\<forall>\<^sub>F x in F. f x \<in> - S
[PROOF STEP]
have "eventually (\<lambda>x. False) F"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. f x \<in> S
\<forall>\<^sub>F x in F. f x \<in> - S

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. False
[PROOF STEP]
by (rule eventually_elim2) simp
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in F. False

goal (1 subgoal):
 1. l \<notin> S \<Longrightarrow> False
[PROOF STEP]
with assms(3)
[PROOF STATE]
proof (chain)
picking this:
F \<noteq> bot
\<forall>\<^sub>F x in F. False
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
F \<noteq> bot
\<forall>\<^sub>F x in F. False

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in linordered_semidom) prod_mono_strict':
  assumes "i \<in> A"
  assumes "finite A"
  assumes "\<And>i. i \<in> A \<Longrightarrow> 0 \<le> f i \<and> f i \<le> g i"
  assumes "\<And>i. i \<in> A \<Longrightarrow> 0 < g i"
  assumes "f i < g i"
  shows   "prod f A < prod g A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
have "prod f A = f i * prod f (A - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f A = f i * prod f (A - {i})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> A
finite A
?i1 \<in> A \<Longrightarrow> (0::'a) \<le> f ?i1 \<and> f ?i1 \<le> g ?i1
?i1 \<in> A \<Longrightarrow> (0::'a) < g ?i1
f i < g i

goal (1 subgoal):
 1. prod f A = f i * prod f (A - {i})
[PROOF STEP]
by (intro prod.remove)
[PROOF STATE]
proof (state)
this:
prod f A = f i * prod f (A - {i})

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f A = f i * prod f (A - {i})

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
have "\<dots> \<le> f i * prod g (A - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i * prod f (A - {i}) \<le> f i * prod g (A - {i})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> A
finite A
?i1 \<in> A \<Longrightarrow> (0::'a) \<le> f ?i1 \<and> f ?i1 \<le> g ?i1
?i1 \<in> A \<Longrightarrow> (0::'a) < g ?i1
f i < g i

goal (1 subgoal):
 1. f i * prod f (A - {i}) \<le> f i * prod g (A - {i})
[PROOF STEP]
by (intro mult_left_mono prod_mono) auto
[PROOF STATE]
proof (state)
this:
f i * prod f (A - {i}) \<le> f i * prod g (A - {i})

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f i * prod f (A - {i}) \<le> f i * prod g (A - {i})

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
have "\<dots> < g i * prod g (A - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i * prod g (A - {i}) < g i * prod g (A - {i})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> A
finite A
?i1 \<in> A \<Longrightarrow> (0::'a) \<le> f ?i1 \<and> f ?i1 \<le> g ?i1
?i1 \<in> A \<Longrightarrow> (0::'a) < g ?i1
f i < g i

goal (1 subgoal):
 1. f i * prod g (A - {i}) < g i * prod g (A - {i})
[PROOF STEP]
by (intro mult_strict_right_mono prod_pos) auto
[PROOF STATE]
proof (state)
this:
f i * prod g (A - {i}) < g i * prod g (A - {i})

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f i * prod g (A - {i}) < g i * prod g (A - {i})

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
have "\<dots> = prod g A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g i * prod g (A - {i}) = prod g A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i \<in> A
finite A
?i1 \<in> A \<Longrightarrow> (0::'a) \<le> f ?i1 \<and> f ?i1 \<le> g ?i1
?i1 \<in> A \<Longrightarrow> (0::'a) < g ?i1
f i < g i

goal (1 subgoal):
 1. g i * prod g (A - {i}) = prod g A
[PROOF STEP]
by (intro prod.remove [symmetric])
[PROOF STATE]
proof (state)
this:
g i * prod g (A - {i}) = prod g A

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod f A < prod g A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod f A < prod g A

goal (1 subgoal):
 1. prod f A < prod g A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prod f A < prod g A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_cpoly_gcd_eq:
  assumes "pR\<noteq>0 \<or> pI\<noteq>0"
  shows "order t (cpoly_of pR pI) = order t (gcd pR pI)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
define g where "g = gcd pR pI"
[PROOF STATE]
proof (state)
this:
g = gcd pR pI

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
have [simp]:"g\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<noteq> 0
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd pR pI \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pR \<noteq> 0 \<or> pI \<noteq> 0

goal (1 subgoal):
 1. gcd pR pI \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g \<noteq> 0

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
obtain pr pi where pri: "pR = pr * g" "pI = pi * g" "coprime pr pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>pr pi. \<lbrakk>pR = pr * g; pI = pi * g; coprime pr pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>pr pi. \<lbrakk>pR = pr * gcd pR pI; pI = pi * gcd pR pI; coprime pr pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(1) gcd_coprime_exists \<open>g \<noteq> 0\<close> g_def
[PROOF STATE]
proof (prove)
using this:
pR \<noteq> 0 \<or> pI \<noteq> 0
gcd ?a ?b \<noteq> (0::?'a) \<Longrightarrow> \<exists>a' b'. ?a = a' * gcd ?a ?b \<and> ?b = b' * gcd ?a ?b \<and> coprime a' b'
g \<noteq> 0
g = gcd pR pI

goal (1 subgoal):
 1. (\<And>pr pi. \<lbrakk>pR = pr * gcd pR pI; pI = pi * gcd pR pI; coprime pr pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
pR = pr * g
pI = pi * g
coprime pr pi

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pR = pr * g
pI = pi * g
coprime pr pi
[PROOF STEP]
have "pr \<noteq>0 \<or> pi \<noteq>0"
[PROOF STATE]
proof (prove)
using this:
pR = pr * g
pI = pi * g
coprime pr pi

goal (1 subgoal):
 1. pr \<noteq> 0 \<or> pi \<noteq> 0
[PROOF STEP]
using assms mult_zero_left
[PROOF STATE]
proof (prove)
using this:
pR = pr * g
pI = pi * g
coprime pr pi
pR \<noteq> 0 \<or> pI \<noteq> 0
(0::?'a) * ?a = (0::?'a)

goal (1 subgoal):
 1. pr \<noteq> 0 \<or> pi \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
pr \<noteq> 0 \<or> pi \<noteq> 0

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
have "order t (cpoly_of pR pI) = order t (cpoly_of pr pi * (map_poly of_real g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g)
[PROOF STEP]
unfolding pri cpoly_of_dist_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g) = order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pR pI) = order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g)

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pR pI) = order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g)

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
have "... = order t (cpoly_of pr pi) + order t g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g) = order (complex_of_real t) (cpoly_of pr pi) + order t g
[PROOF STEP]
apply (subst order_mult)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. cpoly_of pr pi * map_poly complex_of_real g \<noteq> 0
 2. order (complex_of_real t) (cpoly_of pr pi) + order (complex_of_real t) (map_poly complex_of_real g) = order (complex_of_real t) (cpoly_of pr pi) + order t g
[PROOF STEP]
using \<open>pr \<noteq>0 \<or> pi \<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
pr \<noteq> 0 \<or> pi \<noteq> 0

goal (2 subgoals):
 1. cpoly_of pr pi * map_poly complex_of_real g \<noteq> 0
 2. order (complex_of_real t) (cpoly_of pr pi) + order (complex_of_real t) (map_poly complex_of_real g) = order (complex_of_real t) (cpoly_of pr pi) + order t g
[PROOF STEP]
by (auto simp:map_poly_order_of_real)
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g) = order (complex_of_real t) (cpoly_of pr pi) + order t g

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pr pi * map_poly complex_of_real g) = order (complex_of_real t) (cpoly_of pr pi) + order t g

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
have "... = order t g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi) + order t g = order t g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi) + order t g = order t g
[PROOF STEP]
have "poly (cpoly_of pr pi) t \<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly (cpoly_of pr pi) (complex_of_real t) \<noteq> 0
[PROOF STEP]
unfolding poly_cpoly_of_real_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (poly pr t = 0 \<and> poly pi t = 0)
[PROOF STEP]
using \<open>coprime pr pi\<close> coprime_poly_0
[PROOF STATE]
proof (prove)
using this:
coprime pr pi
coprime ?p ?q \<Longrightarrow> poly ?p ?x \<noteq> (0::?'a) \<or> poly ?q ?x \<noteq> (0::?'a)

goal (1 subgoal):
 1. \<not> (poly pr t = 0 \<and> poly pi t = 0)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
poly (cpoly_of pr pi) (complex_of_real t) \<noteq> 0

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi) + order t g = order t g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly (cpoly_of pr pi) (complex_of_real t) \<noteq> 0
[PROOF STEP]
have "order t (cpoly_of pr pi) = 0"
[PROOF STATE]
proof (prove)
using this:
poly (cpoly_of pr pi) (complex_of_real t) \<noteq> 0

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi) = 0
[PROOF STEP]
by (simp add: order_0I)
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pr pi) = 0

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi) + order t g = order t g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
order (complex_of_real t) (cpoly_of pr pi) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
order (complex_of_real t) (cpoly_of pr pi) = 0

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pr pi) + order t g = order t g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pr pi) + order t g = order t g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pr pi) + order t g = order t g

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
order (complex_of_real t) (cpoly_of pR pI) = order t g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
order (complex_of_real t) (cpoly_of pR pI) = order t g

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)

goal (1 subgoal):
 1. order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
order (complex_of_real t) (cpoly_of pR pI) = order t (gcd pR pI)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem while_option_rule:
  assumes step: "!!s. P s ==> b s ==> P (c s)"
    and result: "while_option b c s = Some t"
    and init: "P s"
  shows "P t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P t
[PROOF STEP]
define k where "k = (LEAST k. \<not> b ((c ^^ k) s))"
[PROOF STATE]
proof (state)
this:
k = (LEAST k. \<not> b ((c ^^ k) s))

goal (1 subgoal):
 1. P t
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>P ?s; b ?s\<rbrakk> \<Longrightarrow> P (c ?s)
while_option b c s = Some t
P s
[PROOF STEP]
have t: "t = (c ^^ k) s"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>P ?s; b ?s\<rbrakk> \<Longrightarrow> P (c ?s)
while_option b c s = Some t
P s

goal (1 subgoal):
 1. t = (c ^^ k) s
[PROOF STEP]
by (simp add: while_option_def k_def split: if_splits)
[PROOF STATE]
proof (state)
this:
t = (c ^^ k) s

goal (1 subgoal):
 1. P t
[PROOF STEP]
have 1: "\<forall>i<k. b ((c ^^ i) s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<k. b ((c ^^ i) s)
[PROOF STEP]
by (auto simp: k_def dest: not_less_Least)
[PROOF STATE]
proof (state)
this:
\<forall>i<k. b ((c ^^ i) s)

goal (1 subgoal):
 1. P t
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
\<forall>i<k. b ((c ^^ i) s)

goal (1 subgoal):
 1. P t
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P t
[PROOF STEP]
assume "i \<le> k"
[PROOF STATE]
proof (state)
this:
i \<le> k

goal (1 subgoal):
 1. P t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<le> k
[PROOF STEP]
have "P ((c ^^ i) s)"
[PROOF STATE]
proof (prove)
using this:
i \<le> k

goal (1 subgoal):
 1. P ((c ^^ i) s)
[PROOF STEP]
by (induct i) (auto simp: init step 1)
[PROOF STATE]
proof (state)
this:
P ((c ^^ i) s)

goal (1 subgoal):
 1. P t
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 \<le> k \<Longrightarrow> P ((c ^^ ?i2) s)

goal (1 subgoal):
 1. P t
[PROOF STEP]
thus "P t"
[PROOF STATE]
proof (prove)
using this:
?i2 \<le> k \<Longrightarrow> P ((c ^^ ?i2) s)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prod_rev_ffact_nat:
  fixes m :: nat
  assumes "n \<le> m"
  shows "(\<Prod>i = 1..n. m - n + i) = ffact n m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
have "inj_on (\<lambda>i. i + 1) {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>i. i + 1) {0..<n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>i. i + 1) {0..<n}

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>i. i + 1) {0..<n}

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
have "{1..n} = (\<lambda>i. i + 1) ` {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {1..n} = (\<lambda>i. i + 1) ` {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{1..n} = (\<lambda>i. i + 1) ` {0..<n}

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
{1..n} = (\<lambda>i. i + 1) ` {0..<n}

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
have "m - n + (i + 1) = m + 1 - n + i" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m - n + (i + 1) = m + 1 - n + i
[PROOF STEP]
using  \<open>n \<le> m\<close>
[PROOF STATE]
proof (prove)
using this:
n \<le> m

goal (1 subgoal):
 1. m - n + (i + 1) = m + 1 - n + i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
m - n + (?i + 1) = m + 1 - n + ?i

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>i. i + 1) {0..<n}
{1..n} = (\<lambda>i. i + 1) ` {0..<n}
m - n + (?i + 1) = m + 1 - n + ?i
[PROOF STEP]
have "(\<Prod>i = 1..n. m - n + i) = (\<Prod>i = 0..<n. m + 1 - n + i)"
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>i. i + 1) {0..<n}
{1..n} = (\<lambda>i. i + 1) ` {0..<n}
m - n + (?i + 1) = m + 1 - n + ?i

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = prod ((+) (m + 1 - n)) {0..<n}
[PROOF STEP]
by (rule prod.reindex_cong)
[PROOF STATE]
proof (state)
this:
prod ((+) (m - n)) {1..n} = prod ((+) (m + 1 - n)) {0..<n}

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
prod ((+) (m - n)) {1..n} = prod ((+) (m + 1 - n)) {0..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod ((+) (m - n)) {1..n} = prod ((+) (m + 1 - n)) {0..<n}

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = ffact n m
[PROOF STEP]
unfolding ffact_def
[PROOF STATE]
proof (prove)
using this:
prod ((+) (m - n)) {1..n} = prod ((+) (m + 1 - n)) {0..<n}

goal (1 subgoal):
 1. prod ((+) (m - n)) {1..n} = pochhammer (m + 1 - of_nat n) n
[PROOF STEP]
by (simp only: pochhammer_prod of_nat_id)
[PROOF STATE]
proof (state)
this:
prod ((+) (m - n)) {1..n} = ffact n m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma periodic_set_multiple:
  assumes "k\<noteq>0"
  shows "periodic_set S \<delta> \<longleftrightarrow> periodic_set S (of_int k*\<delta>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. periodic_set S \<delta> = periodic_set S (real_of_int k * \<delta>)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. periodic_set S \<delta> \<Longrightarrow> periodic_set S (real_of_int k * \<delta>)
 2. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
assume asm:"periodic_set S \<delta> "
[PROOF STATE]
proof (state)
this:
periodic_set S \<delta>

goal (2 subgoals):
 1. periodic_set S \<delta> \<Longrightarrow> periodic_set S (real_of_int k * \<delta>)
 2. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
periodic_set S \<delta>
[PROOF STEP]
obtain B1 where "finite B1" and B1_def:"\<forall>x\<in>S. \<exists>b\<in>B1. (\<exists>k::int. x = b + k * \<delta>)"
[PROOF STATE]
proof (prove)
using this:
periodic_set S \<delta>

goal (1 subgoal):
 1. (\<And>B1. \<lbrakk>finite B1; \<forall>x\<in>S. \<exists>b\<in>B1. \<exists>xa. x = b + real_of_int xa * \<delta>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding periodic_set_def
[PROOF STATE]
proof (prove)
using this:
\<exists>B. finite B \<and> (\<forall>x\<in>S. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * \<delta>)

goal (1 subgoal):
 1. (\<And>B1. \<lbrakk>finite B1; \<forall>x\<in>S. \<exists>b\<in>B1. \<exists>xa. x = b + real_of_int xa * \<delta>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
finite B1
\<forall>x\<in>S. \<exists>b\<in>B1. \<exists>xa. x = b + real_of_int xa * \<delta>

goal (2 subgoals):
 1. periodic_set S \<delta> \<Longrightarrow> periodic_set S (real_of_int k * \<delta>)
 2. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
define B where "B = B1 \<union> {b+i*\<delta> | b i. b\<in>B1 \<and> i\<in>{0..<\<bar>k\<bar>}}"
[PROOF STATE]
proof (state)
this:
B = B1 \<union> {b + real_of_int i * \<delta> |b i. b \<in> B1 \<and> i \<in> {0..<\<bar>k\<bar>}}

goal (2 subgoals):
 1. periodic_set S \<delta> \<Longrightarrow> periodic_set S (real_of_int k * \<delta>)
 2. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
have "\<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)" when "x\<in>S" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
obtain b1 and k1::int where "b1\<in>B1" and x_\<delta>:"x = b1 + k1 * \<delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b1 k1. \<lbrakk>b1 \<in> B1; x = b1 + real_of_int k1 * \<delta>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using B1_def[rule_format, OF \<open>x\<in>S\<close>]
[PROOF STATE]
proof (prove)
using this:
\<exists>b\<in>B1. \<exists>xa. x = b + real_of_int xa * \<delta>

goal (1 subgoal):
 1. (\<And>b1 k1. \<lbrakk>b1 \<in> B1; x = b1 + real_of_int k1 * \<delta>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b1 \<in> B1
x = b1 + real_of_int k1 * \<delta>

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
define r d where "r= k1 mod \<bar>k\<bar>" and "d = k1 div \<bar>k\<bar>"
[PROOF STATE]
proof (state)
this:
r = k1 mod \<bar>k\<bar>
d = k1 div \<bar>k\<bar>

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
define b kk where "b=b1+r*\<delta>" and "kk = (if k>0 then d else -d)"
[PROOF STATE]
proof (state)
this:
b = b1 + real_of_int r * \<delta>
kk = (if 0 < k then d else - d)

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
have "x = b1 + (r+\<bar>k\<bar>*d)*\<delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = b1 + real_of_int (r + \<bar>k\<bar> * d) * \<delta>
[PROOF STEP]
using x_\<delta>
[PROOF STATE]
proof (prove)
using this:
x = b1 + real_of_int k1 * \<delta>

goal (1 subgoal):
 1. x = b1 + real_of_int (r + \<bar>k\<bar> * d) * \<delta>
[PROOF STEP]
unfolding r_def d_def
[PROOF STATE]
proof (prove)
using this:
x = b1 + real_of_int k1 * \<delta>

goal (1 subgoal):
 1. x = b1 + real_of_int (k1 mod \<bar>k\<bar> + \<bar>k\<bar> * (k1 div \<bar>k\<bar>)) * \<delta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = b1 + real_of_int (r + \<bar>k\<bar> * d) * \<delta>

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = b1 + real_of_int (r + \<bar>k\<bar> * d) * \<delta>
[PROOF STEP]
have "x = b + kk*(k*\<delta>)"
[PROOF STATE]
proof (prove)
using this:
x = b1 + real_of_int (r + \<bar>k\<bar> * d) * \<delta>

goal (1 subgoal):
 1. x = b + real_of_int kk * (real_of_int k * \<delta>)
[PROOF STEP]
unfolding b_def kk_def
[PROOF STATE]
proof (prove)
using this:
x = b1 + real_of_int (r + \<bar>k\<bar> * d) * \<delta>

goal (1 subgoal):
 1. x = b1 + real_of_int r * \<delta> + real_of_int (if 0 < k then d else - d) * (real_of_int k * \<delta>)
[PROOF STEP]
using \<open>k\<noteq>0\<close>
[PROOF STATE]
proof (prove)
using this:
x = b1 + real_of_int (r + \<bar>k\<bar> * d) * \<delta>
k \<noteq> 0

goal (1 subgoal):
 1. x = b1 + real_of_int r * \<delta> + real_of_int (if 0 < k then d else - d) * (real_of_int k * \<delta>)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
x = b + real_of_int kk * (real_of_int k * \<delta>)

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = b + real_of_int kk * (real_of_int k * \<delta>)

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
have "b\<in>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<in> B
[PROOF STEP]
have "r \<in> {0..<\<bar>k\<bar>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in> {0..<\<bar>k\<bar>}
[PROOF STEP]
unfolding r_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k1 mod \<bar>k\<bar> \<in> {0..<\<bar>k\<bar>}
[PROOF STEP]
by (simp add: \<open>k\<noteq>0\<close>)
[PROOF STATE]
proof (state)
this:
r \<in> {0..<\<bar>k\<bar>}

goal (1 subgoal):
 1. b \<in> B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r \<in> {0..<\<bar>k\<bar>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r \<in> {0..<\<bar>k\<bar>}

goal (1 subgoal):
 1. b \<in> B
[PROOF STEP]
unfolding b_def B_def
[PROOF STATE]
proof (prove)
using this:
r \<in> {0..<\<bar>k\<bar>}

goal (1 subgoal):
 1. b1 + real_of_int r * \<delta> \<in> B1 \<union> {b + real_of_int i * \<delta> |b i. b \<in> B1 \<and> i \<in> {0..<\<bar>k\<bar>}}
[PROOF STEP]
using \<open>b1\<in>B1\<close>
[PROOF STATE]
proof (prove)
using this:
r \<in> {0..<\<bar>k\<bar>}
b1 \<in> B1

goal (1 subgoal):
 1. b1 + real_of_int r * \<delta> \<in> B1 \<union> {b + real_of_int i * \<delta> |b i. b \<in> B1 \<and> i \<in> {0..<\<bar>k\<bar>}}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
b \<in> B

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = b + real_of_int kk * (real_of_int k * \<delta>)
b \<in> B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = b + real_of_int kk * (real_of_int k * \<delta>)
b \<in> B

goal (1 subgoal):
 1. \<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>b\<in>B. \<exists>k'. x = b + real_of_int k' * (real_of_int k * \<delta>)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> \<exists>b\<in>B. \<exists>k'. ?x = b + real_of_int k' * (real_of_int k * \<delta>)

goal (2 subgoals):
 1. periodic_set S \<delta> \<Longrightarrow> periodic_set S (real_of_int k * \<delta>)
 2. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> \<exists>b\<in>B. \<exists>k'. ?x = b + real_of_int k' * (real_of_int k * \<delta>)

goal (2 subgoals):
 1. periodic_set S \<delta> \<Longrightarrow> periodic_set S (real_of_int k * \<delta>)
 2. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
have "finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite B
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (B1 \<union> {b + real_of_int i * \<delta> |b i. b \<in> B1 \<and> i \<in> {0..<\<bar>k\<bar>}})
[PROOF STEP]
using \<open>finite B1\<close>
[PROOF STATE]
proof (prove)
using this:
finite B1

goal (1 subgoal):
 1. finite (B1 \<union> {b + real_of_int i * \<delta> |b i. b \<in> B1 \<and> i \<in> {0..<\<bar>k\<bar>}})
[PROOF STEP]
by (simp add: finite_image_set2)
[PROOF STATE]
proof (state)
this:
finite B

goal (2 subgoals):
 1. periodic_set S \<delta> \<Longrightarrow> periodic_set S (real_of_int k * \<delta>)
 2. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?x \<in> S \<Longrightarrow> \<exists>b\<in>B. \<exists>k'. ?x = b + real_of_int k' * (real_of_int k * \<delta>)
finite B
[PROOF STEP]
show "periodic_set S (real_of_int k * \<delta>)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>b\<in>B. \<exists>k'. ?x = b + real_of_int k' * (real_of_int k * \<delta>)
finite B

goal (1 subgoal):
 1. periodic_set S (real_of_int k * \<delta>)
[PROOF STEP]
unfolding periodic_set_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> S \<Longrightarrow> \<exists>b\<in>B. \<exists>k'. ?x = b + real_of_int k' * (real_of_int k * \<delta>)
finite B

goal (1 subgoal):
 1. \<exists>B. finite B \<and> (\<forall>x\<in>S. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (real_of_int k * \<delta>))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
periodic_set S (real_of_int k * \<delta>)

goal (1 subgoal):
 1. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
assume "periodic_set S (real_of_int k * \<delta>)"
[PROOF STATE]
proof (state)
this:
periodic_set S (real_of_int k * \<delta>)

goal (1 subgoal):
 1. periodic_set S (real_of_int k * \<delta>) \<Longrightarrow> periodic_set S \<delta>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
periodic_set S (real_of_int k * \<delta>)
[PROOF STEP]
show "periodic_set S \<delta>"
[PROOF STATE]
proof (prove)
using this:
periodic_set S (real_of_int k * \<delta>)

goal (1 subgoal):
 1. periodic_set S \<delta>
[PROOF STEP]
unfolding periodic_set_def
[PROOF STATE]
proof (prove)
using this:
\<exists>B. finite B \<and> (\<forall>x\<in>S. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * (real_of_int k * \<delta>))

goal (1 subgoal):
 1. \<exists>B. finite B \<and> (\<forall>x\<in>S. \<exists>b\<in>B. \<exists>xa. x = b + real_of_int xa * \<delta>)
[PROOF STEP]
by (metis mult.commute mult.left_commute of_int_mult)
[PROOF STATE]
proof (state)
this:
periodic_set S \<delta>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_diff_le_max: "degree (p - q) \<le> max (degree p) (degree q)"
  for p q :: "'a::ab_group_add poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p - q) \<le> max (degree p) (degree q)
[PROOF STEP]
using degree_add_le [where p=p and q="-q"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>degree p \<le> ?n; degree (- q) \<le> ?n\<rbrakk> \<Longrightarrow> degree (p + - q) \<le> ?n

goal (1 subgoal):
 1. degree (p - q) \<le> max (degree p) (degree q)
[PROOF STEP]
by simp


[STATEMENT]
lemma bounded_clinear_eq_on:
  fixes A B :: "'a::complex_normed_vector \<Rightarrow> 'b::complex_normed_vector"
  assumes \<open>bounded_clinear A\<close> and \<open>bounded_clinear B\<close> and
    eq: \<open>\<And>x. x \<in> G \<Longrightarrow> A x = B x\<close> and t: \<open>t \<in> closure (cspan G)\<close>
  shows \<open>A t = B t\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
have eq': \<open>A t = B t\<close> if \<open>t \<in> cspan G\<close> for t
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
using _ _ that eq
[PROOF STATE]
proof (prove)
using this:
PROP ?psi \<Longrightarrow> PROP ?psi
PROP ?psi \<Longrightarrow> PROP ?psi
t \<in> cspan G
?x \<in> G \<Longrightarrow> A ?x = B ?x

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
apply (rule complex_vector.linear_eq_on)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. clinear A
 2. clinear B
 3. \<And>b. b \<in> G \<Longrightarrow> b \<in> G
[PROOF STEP]
by (auto simp: assms bounded_clinear.clinear)
[PROOF STATE]
proof (state)
this:
?t \<in> cspan G \<Longrightarrow> A ?t = B ?t

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
have \<open>A t - B t = 0\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A t - B t = (0::'b)
[PROOF STEP]
using _ _ t
[PROOF STATE]
proof (prove)
using this:
PROP ?psi \<Longrightarrow> PROP ?psi
PROP ?psi \<Longrightarrow> PROP ?psi
t \<in> closure (cspan G)

goal (1 subgoal):
 1. A t - B t = (0::'b)
[PROOF STEP]
apply (rule continuous_constant_on_closure)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. continuous_on (closure (cspan G)) (\<lambda>a. A a - B a)
 2. \<And>x. x \<in> cspan G \<Longrightarrow> A x - B x = (0::'b)
[PROOF STEP]
by (auto simp add: eq' assms(1) assms(2) clinear_continuous_at continuous_at_imp_continuous_on)
[PROOF STATE]
proof (state)
this:
A t - B t = (0::'b)

goal (1 subgoal):
 1. A t = B t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A t - B t = (0::'b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
A t - B t = (0::'b)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_offset:
  fixes p :: "'a::comm_ring_1 poly"
  shows "\<exists>q. psize q = psize p \<and> (\<forall>x. poly q x = poly p (a + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q. psize q = psize p \<and> (\<forall>x. poly q x = poly p (a + x))
[PROOF STEP]
proof (intro exI conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. psize ?q = psize p
 2. \<forall>x. poly ?q x = poly p (a + x)
[PROOF STEP]
show "psize (offset_poly p a) = psize p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. psize (offset_poly p a) = psize p
[PROOF STEP]
unfolding psize_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if offset_poly p a = 0 then 0 else Suc (degree (offset_poly p a))) = (if p = 0 then 0 else Suc (degree p))
[PROOF STEP]
by (simp add: offset_poly_eq_0_iff degree_offset_poly)
[PROOF STATE]
proof (state)
this:
psize (offset_poly p a) = psize p

goal (1 subgoal):
 1. \<forall>x. poly (offset_poly p a) x = poly p (a + x)
[PROOF STEP]
show "\<forall>x. poly (offset_poly p a) x = poly p (a + x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. poly (offset_poly p a) x = poly p (a + x)
[PROOF STEP]
by (simp add: poly_offset_poly)
[PROOF STATE]
proof (state)
this:
\<forall>x. poly (offset_poly p a) x = poly p (a + x)

goal:
No subgoals!
[PROOF STEP]
qed