[STATEMENT]
lemma  jordan_block_constant_bound2:
"\<exists>p. norm (a :: 'a :: real_normed_field) < 1 \<longrightarrow>
    (\<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. norm a < 1 \<longrightarrow> (\<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p)
[PROOF STEP]
using jordan_block_constant_bound
[PROOF STATE]
proof (prove)
using this:
norm a < 1 \<Longrightarrow> \<exists>p. \<forall>i j k. i < ?n \<longrightarrow> j < ?n \<longrightarrow> norm ((jordan_block ?n a ^\<^sub>m k) $$ (i, j)) \<le> p

goal (1 subgoal):
 1. \<exists>p. norm a < 1 \<longrightarrow> (\<forall>i j k. i < n \<longrightarrow> j < n \<longrightarrow> norm ((jordan_block n a ^\<^sub>m k) $$ (i, j)) \<le> p)
[PROOF STEP]
by auto


[STATEMENT]
lemma finite_space[simp]:"finite space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite local.space
[PROOF STEP]
unfolding space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (bounded_degree_polynomials R k)
[PROOF STEP]
using fin_degree_bounded finite_carrier
[PROOF STATE]
proof (prove)
using this:
finite (carrier R) \<Longrightarrow> finite (bounded_degree_polynomials R ?n)
finite (carrier R)

goal (1 subgoal):
 1. finite (bounded_degree_polynomials R k)
[PROOF STEP]
by simp


[STATEMENT]
lemma ffb_if_then_else[simp]:
  "fb\<^sub>\<F> (IF T THEN X ELSE Y) Q = {s. T s \<longrightarrow> s \<in> fb\<^sub>\<F> X Q} \<inter> {s. \<not> T s \<longrightarrow> s \<in> fb\<^sub>\<F> Y Q}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fb\<^sub>\<F> (IF T THEN X ELSE Y) Q = {s. T s \<longrightarrow> s2p (fb\<^sub>\<F> X Q) s} \<inter> {s. \<not> T s \<longrightarrow> s2p (fb\<^sub>\<F> Y Q) s}
[PROOF STEP]
unfolding ffb_eq ifthenelse_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {s. \<forall>s'. s2p (if T s then X s else Y s) s' \<longrightarrow> s2p Q s'} = {s. T s \<longrightarrow> s2p {s. \<forall>s'. s2p (X s) s' \<longrightarrow> s2p Q s'} s} \<inter> {s. \<not> T s \<longrightarrow> s2p {s. \<forall>s'. s2p (Y s) s' \<longrightarrow> s2p Q s'} s}
[PROOF STEP]
by auto


[STATEMENT]
lemma left_inverse_linear:
  assumes lf: "linear scale scale f"
    and gf: "g \<circ> f = id"
  shows "linear scale scale g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear (*s) (*s) g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linear (*s) (*s) g
[PROOF STEP]
from gf
[PROOF STATE]
proof (chain)
picking this:
g \<circ> f = id
[PROOF STEP]
have fi: "inj f"
[PROOF STATE]
proof (prove)
using this:
g \<circ> f = id

goal (1 subgoal):
 1. inj f
[PROOF STEP]
by (auto simp add: inj_on_def o_def id_def fun_eq_iff) metis
[PROOF STATE]
proof (state)
this:
inj f

goal (1 subgoal):
 1. linear (*s) (*s) g
[PROOF STEP]
interpret finite_dimensional_vector_space_pair scale Basis scale Basis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_dimensional_vector_space_pair (*s) Basis (*s) Basis
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. linear (*s) (*s) g
[PROOF STEP]
from linear_injective_isomorphism[OF lf fi]
[PROOF STATE]
proof (chain)
picking this:
dim UNIV = dim UNIV \<Longrightarrow> \<exists>f'. linear (*s) (*s) f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)
[PROOF STEP]
obtain h :: "'b \<Rightarrow> 'b" where "linear scale scale h" and h: "\<forall>x. h (f x) = x" "\<forall>x. f (h x) = x"
[PROOF STATE]
proof (prove)
using this:
dim UNIV = dim UNIV \<Longrightarrow> \<exists>f'. linear (*s) (*s) f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)

goal (1 subgoal):
 1. (\<And>h. \<lbrakk>linear (*s) (*s) h; \<forall>x. h (f x) = x; \<forall>x. f (h x) = x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linear (*s) (*s) h
\<forall>x. h (f x) = x
\<forall>x. f (h x) = x

goal (1 subgoal):
 1. linear (*s) (*s) g
[PROOF STEP]
have "h = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h = g
[PROOF STEP]
by (metis gf h isomorphism_expand left_right_inverse_eq)
[PROOF STATE]
proof (state)
this:
h = g

goal (1 subgoal):
 1. linear (*s) (*s) g
[PROOF STEP]
with \<open>linear scale scale h\<close>
[PROOF STATE]
proof (chain)
picking this:
linear (*s) (*s) h
h = g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linear (*s) (*s) h
h = g

goal (1 subgoal):
 1. linear (*s) (*s) g
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
linear (*s) (*s) g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma imp_compat_eqv:
assumes "\<phi>1 \<in> fmla" and "\<phi>2 \<in> fmla" and "\<chi>1 \<in> fmla" and "\<chi>2 \<in> fmla"
assumes "prv (eqv \<phi>1 \<phi>2)" and "prv (eqv \<chi>1 \<chi>2)"
shows "prv (eqv (imp \<phi>1 \<chi>1) (imp \<phi>2 \<chi>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (eqv (imp \<phi>1 \<chi>1) (imp \<phi>2 \<chi>2))
[PROOF STEP]
using assms prv_imp_mp imp_imp_compat_eqv
[PROOF STATE]
proof (prove)
using this:
\<phi>1 \<in> fmla
\<phi>2 \<in> fmla
\<chi>1 \<in> fmla
\<chi>2 \<in> fmla
prv (eqv \<phi>1 \<phi>2)
prv (eqv \<chi>1 \<chi>2)
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; prv (imp ?\<phi> ?\<chi>); prv ?\<phi>\<rbrakk> \<Longrightarrow> prv ?\<chi>
\<lbrakk>?\<phi>1.0 \<in> fmla; ?\<phi>2.0 \<in> fmla; ?\<chi>1.0 \<in> fmla; ?\<chi>2.0 \<in> fmla\<rbrakk> \<Longrightarrow> prv (imp (eqv ?\<phi>1.0 ?\<phi>2.0) (imp (eqv ?\<chi>1.0 ?\<chi>2.0) (eqv (imp ?\<phi>1.0 ?\<chi>1.0) (imp ?\<phi>2.0 ?\<chi>2.0))))

goal (1 subgoal):
 1. prv (eqv (imp \<phi>1 \<chi>1) (imp \<phi>2 \<chi>2))
[PROOF STEP]
by (metis eqv imp)


[STATEMENT]
lemma prv_all_neg_imp_neg_exi:
  assumes x: "x \<in> var" and \<phi>: "\<phi> \<in> fmla"
  shows "prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))
[PROOF STEP]
have 0: "prv (imp (all x (neg \<phi>)) (imp \<phi> fls))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (imp \<phi> fls))
[PROOF STEP]
using prv_all_inst[OF x, of "neg \<phi>" "Var x",simplified] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>neg \<phi> \<in> fmla; Var x \<in> trm\<rbrakk> \<Longrightarrow> prv (imp (all x (neg \<phi>)) (subst (neg \<phi>) (Var x) x))
x \<in> var
\<phi> \<in> fmla

goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (imp \<phi> fls))
[PROOF STEP]
by (auto simp: neg_def)
[PROOF STATE]
proof (state)
this:
prv (imp (all x (neg \<phi>)) (imp \<phi> fls))

goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))
[PROOF STEP]
have 1: "prv (imp \<phi> (imp (all x (neg \<phi>)) fls))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<phi> (imp (all x (neg \<phi>)) fls))
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
prv (imp (all x (neg \<phi>)) (imp \<phi> fls))

goal (1 subgoal):
 1. prv (imp \<phi> (imp (all x (neg \<phi>)) fls))
[PROOF STEP]
by (simp add: assms  prv_imp_com)
[PROOF STATE]
proof (state)
this:
prv (imp \<phi> (imp (all x (neg \<phi>)) fls))

goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))
[PROOF STEP]
have 2: "prv (imp (exi x \<phi>) (imp (all x (neg \<phi>)) fls))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp (exi x \<phi>) (imp (all x (neg \<phi>)) fls))
[PROOF STEP]
using 1 assms
[PROOF STATE]
proof (prove)
using this:
prv (imp \<phi> (imp (all x (neg \<phi>)) fls))
x \<in> var
\<phi> \<in> fmla

goal (1 subgoal):
 1. prv (imp (exi x \<phi>) (imp (all x (neg \<phi>)) fls))
[PROOF STEP]
by (intro prv_exi_imp_gen) auto
[PROOF STATE]
proof (state)
this:
prv (imp (exi x \<phi>) (imp (all x (neg \<phi>)) fls))

goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
prv (imp (exi x \<phi>) (imp (all x (neg \<phi>)) fls))

goal (1 subgoal):
 1. prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))
[PROOF STEP]
by (simp add: assms  neg_def prv_imp_com)
[PROOF STATE]
proof (state)
this:
prv (imp (all x (neg \<phi>)) (neg (exi x \<phi>)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compress_zero: "compress d 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compress d 0 = 0
[PROOF STEP]
unfolding compress_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round (real_of_int (2 ^ d * 0) / real_of_int q) mod 2 ^ d = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma Im7_tendsto_upperbound:
   "\<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im7 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im7 limit \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im7 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im7 limit \<le> b
[PROOF STEP]
by (blast intro: tendsto_upperbound [OF tendsto_Im7])


[STATEMENT]
lemma downset_setp_upset_setp_dual: "upclosed_set \<circ> (`) \<partial> = downclosed_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upclosed_set \<circ> (`) \<partial> = downclosed_set
[PROOF STEP]
unfolding downclosed_set_def upclosed_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>X. X \<in> upsets) \<circ> (`) \<partial> = (\<lambda>X. X \<in> downsets)
[PROOF STEP]
using downsets_upsets_dual
[PROOF STATE]
proof (prove)
using this:
(?X \<in> downsets) = (\<partial> ` ?X \<in> upsets)

goal (1 subgoal):
 1. (\<lambda>X. X \<in> upsets) \<circ> (`) \<partial> = (\<lambda>X. X \<in> downsets)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma lassocr_inverse: "rassocl\<^sub>C \<odot> lassocr\<^sub>C = 1\<^sub>C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rassocl\<^sub>C \<odot> lassocr\<^sub>C = 1\<^sub>C
[PROOF STEP]
unfolding rassocl\<^sub>C_def lassocr\<^sub>C_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_converter lsumr rsuml id id 1\<^sub>C \<odot> map_converter rsuml lsumr id id 1\<^sub>C = 1\<^sub>C
[PROOF STEP]
apply(simp add: comp_converter_map1_out comp_converter_map_converter2 comp_converter_id_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_converter lsumr rsuml rsuml lsumr 1\<^sub>C = 1\<^sub>C
[PROOF STEP]
apply(subst map_converter_id_move_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_converter id id (rsuml \<circ> lsumr) (rsuml \<circ> lsumr) 1\<^sub>C = 1\<^sub>C
[PROOF STEP]
apply(simp add: o_def id_def[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ta_union_sig [simp]:
  "ta_sig (ta_union \<A> \<B>) = ta_sig \<A> |\<union>| ta_sig \<B>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_sig (ta_union \<A> \<B>) = ta_sig \<A> |\<union>| ta_sig \<B>
[PROOF STEP]
by (auto simp: ta_union_def ta_sig_def)


[STATEMENT]
lemma interleave_map: "w\<in>w1\<otimes>w2 \<Longrightarrow> map f w \<in> map f w1 \<otimes> map f w2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<in> w1 \<otimes> w2 \<Longrightarrow> map f w \<in> map f w1 \<otimes> map f w2
[PROOF STEP]
by (induct rule: interleave_elem_induct) (auto intro!: interleave_cons)


[STATEMENT]
lemma list_nth_append9:
assumes "i - Suc (length x) < Suc (length y)"
shows    "i < Suc (Suc (length x + length y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < Suc (Suc (length x + length y))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i - Suc (length x) < Suc (length y)

goal (1 subgoal):
 1. i < Suc (Suc (length x + length y))
[PROOF STEP]
by arith


[STATEMENT]
lemma guarantees_wx_eq: "(X guarantees Y) = wx(-X \<union> Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X guarantees Y = wx (- X \<union> Y)
[PROOF STEP]
by (simp add: guar_def wx_equiv)


[STATEMENT]
lemma image_mset_eq_plusD:
  "image_mset f A = B + C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f A = B + C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
proof (induction A arbitrary: B C)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B C. image_mset f {#} = B + C \<Longrightarrow> \<exists>B' C'. {#} = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
 2. \<And>x A B C. \<lbrakk>\<And>B C. image_mset f A = B + C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'; image_mset f (add_mset x A) = B + C\<rbrakk> \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
image_mset f {#} = B + C

goal (2 subgoals):
 1. \<And>B C. image_mset f {#} = B + C \<Longrightarrow> \<exists>B' C'. {#} = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
 2. \<And>x A B C. \<lbrakk>\<And>B C. image_mset f A = B + C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'; image_mset f (add_mset x A) = B + C\<rbrakk> \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
image_mset f {#} = B + C

goal (1 subgoal):
 1. \<exists>B' C'. {#} = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>B' C'. {#} = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'

goal (1 subgoal):
 1. \<And>x A B C. \<lbrakk>\<And>B C. image_mset f A = B + C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'; image_mset f (add_mset x A) = B + C\<rbrakk> \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x A B C. \<lbrakk>\<And>B C. image_mset f A = B + C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'; image_mset f (add_mset x A) = B + C\<rbrakk> \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
case (add x A)
[PROOF STATE]
proof (state)
this:
image_mset f A = ?B + ?C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> ?B = image_mset f B' \<and> ?C = image_mset f C'
image_mset f (add_mset x A) = B + C

goal (1 subgoal):
 1. \<And>x A B C. \<lbrakk>\<And>B C. image_mset f A = B + C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'; image_mset f (add_mset x A) = B + C\<rbrakk> \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
proof (cases "f x \<in># B")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f x \<in># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
 2. f x \<notin># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f x \<in># B

goal (2 subgoals):
 1. f x \<in># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
 2. f x \<notin># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
with add.prems
[PROOF STATE]
proof (chain)
picking this:
image_mset f (add_mset x A) = B + C
f x \<in># B
[PROOF STEP]
have "image_mset f A = (B - {#f x#}) + C"
[PROOF STATE]
proof (prove)
using this:
image_mset f (add_mset x A) = B + C
f x \<in># B

goal (1 subgoal):
 1. image_mset f A = B - {#f x#} + C
[PROOF STEP]
by (metis add_mset_remove_trivial image_mset_add_mset mset_subset_eq_single
          subset_mset.add_diff_assoc2)
[PROOF STATE]
proof (state)
this:
image_mset f A = B - {#f x#} + C

goal (2 subgoals):
 1. f x \<in># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
 2. f x \<notin># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
image_mset f A = B - {#f x#} + C

goal (1 subgoal):
 1. \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
using add.IH add.prems
[PROOF STATE]
proof (prove)
using this:
image_mset f A = B - {#f x#} + C
image_mset f A = ?B + ?C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> ?B = image_mset f B' \<and> ?C = image_mset f C'
image_mset f (add_mset x A) = B + C

goal (1 subgoal):
 1. \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'

goal (1 subgoal):
 1. f x \<notin># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f x \<notin># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f x \<notin># B

goal (1 subgoal):
 1. f x \<notin># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
with add.prems
[PROOF STATE]
proof (chain)
picking this:
image_mset f (add_mset x A) = B + C
f x \<notin># B
[PROOF STEP]
have "image_mset f A = B + (C - {#f x#})"
[PROOF STATE]
proof (prove)
using this:
image_mset f (add_mset x A) = B + C
f x \<notin># B

goal (1 subgoal):
 1. image_mset f A = B + (C - {#f x#})
[PROOF STEP]
by (metis diff_single_eq_union diff_union_single_conv image_mset_add_mset union_iff
          union_single_eq_member)
[PROOF STATE]
proof (state)
this:
image_mset f A = B + (C - {#f x#})

goal (1 subgoal):
 1. f x \<notin># B \<Longrightarrow> \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
image_mset f A = B + (C - {#f x#})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
image_mset f A = B + (C - {#f x#})

goal (1 subgoal):
 1. \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
using add.IH add.prems
[PROOF STATE]
proof (prove)
using this:
image_mset f A = B + (C - {#f x#})
image_mset f A = ?B + ?C \<Longrightarrow> \<exists>B' C'. A = B' + C' \<and> ?B = image_mset f B' \<and> ?C = image_mset f C'
image_mset f (add_mset x A) = B + C

goal (1 subgoal):
 1. \<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>B' C'. add_mset x A = B' + C' \<and> B = image_mset f B' \<and> C = image_mset f C'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma alternating_order2_cancel_2left:
  "s+s=0 \<Longrightarrow> t+t=0 \<Longrightarrow>
    sum_list (t # s # (alternating_list (Suc (Suc n)) s t)) =
      sum_list (alternating_list n s t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s + s = (0::'a); t + t = (0::'a)\<rbrakk> \<Longrightarrow> sum_list (t # s # alternating_list (Suc (Suc n)) s t) = sum_list (alternating_list n s t)
[PROOF STEP]
using alternating_order2_cancel_1left[of s "Suc n"]
          alternating_order2_cancel_1left[of t n]
[PROOF STATE]
proof (prove)
using this:
s + s = (0::'a) \<Longrightarrow> sum_list (s # alternating_list (Suc (Suc n)) s ?t) = sum_list (alternating_list (Suc n) ?t s)
t + t = (0::'a) \<Longrightarrow> sum_list (t # alternating_list (Suc n) t ?t) = sum_list (alternating_list n ?t t)

goal (1 subgoal):
 1. \<lbrakk>s + s = (0::'a); t + t = (0::'a)\<rbrakk> \<Longrightarrow> sum_list (t # s # alternating_list (Suc (Suc n)) s t) = sum_list (alternating_list n s t)
[PROOF STEP]
by    simp


[STATEMENT]
lemma symp_circline_eq_cmat: "symp circline_eq_cmat"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symp circline_eq_cmat
[PROOF STEP]
unfolding symp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. circline_eq_cmat x y \<longrightarrow> circline_eq_cmat y x
[PROOF STEP]
proof ((rule allI)+, rule impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. circline_eq_cmat x y \<Longrightarrow> circline_eq_cmat y x
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. circline_eq_cmat x y \<Longrightarrow> circline_eq_cmat y x
[PROOF STEP]
assume "circline_eq_cmat x y"
[PROOF STATE]
proof (state)
this:
circline_eq_cmat x y

goal (1 subgoal):
 1. \<And>x y. circline_eq_cmat x y \<Longrightarrow> circline_eq_cmat y x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
circline_eq_cmat x y
[PROOF STEP]
obtain k where "k \<noteq> 0 \<and> y = cor k *\<^sub>s\<^sub>m x"
[PROOF STATE]
proof (prove)
using this:
circline_eq_cmat x y

goal (1 subgoal):
 1. (\<And>k. k \<noteq> 0 \<and> y = cor k *\<^sub>s\<^sub>m x \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k \<noteq> 0 \<and> y = cor k *\<^sub>s\<^sub>m x

goal (1 subgoal):
 1. \<And>x y. circline_eq_cmat x y \<Longrightarrow> circline_eq_cmat y x
[PROOF STEP]
hence  "1 / k \<noteq> 0 \<and> x = cor (1 / k) *\<^sub>s\<^sub>m y"
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0 \<and> y = cor k *\<^sub>s\<^sub>m x

goal (1 subgoal):
 1. 1 / k \<noteq> 0 \<and> x = cor (1 / k) *\<^sub>s\<^sub>m y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / k \<noteq> 0 \<and> x = cor (1 / k) *\<^sub>s\<^sub>m y

goal (1 subgoal):
 1. \<And>x y. circline_eq_cmat x y \<Longrightarrow> circline_eq_cmat y x
[PROOF STEP]
thus "circline_eq_cmat y x"
[PROOF STATE]
proof (prove)
using this:
1 / k \<noteq> 0 \<and> x = cor (1 / k) *\<^sub>s\<^sub>m y

goal (1 subgoal):
 1. circline_eq_cmat y x
[PROOF STEP]
unfolding circline_eq_cmat_def
[PROOF STATE]
proof (prove)
using this:
1 / k \<noteq> 0 \<and> x = cor (1 / k) *\<^sub>s\<^sub>m y

goal (1 subgoal):
 1. \<exists>k. k \<noteq> 0 \<and> x = cor k *\<^sub>s\<^sub>m y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
circline_eq_cmat y x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma star_n_le: "star_n X \<le> star_n Y = eventually (\<lambda>n. X n \<le> Y n) \<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_n X \<le> star_n Y) = (\<forall>\<^sub>F n in \<U>. X n \<le> Y n)
[PROOF STEP]
by (simp only: star_le_def starP2_star_n)


[STATEMENT]
lemma schroeder_2: "y ; x \<cdot> z = 0 \<longleftrightarrow> y \<cdot> z ; x\<^sup>\<smile> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y ; x \<cdot> z = 0) = (y \<cdot> z ; x\<^sup>\<smile> = 0)
[PROOF STEP]
by (metis conv_invol peirce schroeder_1)


[STATEMENT]
lemma measurable_cong':
  assumes "\<And>w. w \<in> space M =simp=> f w = g w"
  shows "f \<in> measurable M M' \<longleftrightarrow> g \<in> measurable M M'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> M \<rightarrow>\<^sub>M M') = (g \<in> M \<rightarrow>\<^sub>M M')
[PROOF STEP]
unfolding measurable_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> {f \<in> space M \<rightarrow> space M'. \<forall>y\<in>sets M'. f -` y \<inter> space M \<in> sets M}) = (g \<in> {f \<in> space M \<rightarrow> space M'. \<forall>y\<in>sets M'. f -` y \<inter> space M \<in> sets M})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?w \<in> space M =simp=> f ?w = g ?w

goal (1 subgoal):
 1. (f \<in> {f \<in> space M \<rightarrow> space M'. \<forall>y\<in>sets M'. f -` y \<inter> space M \<in> sets M}) = (g \<in> {f \<in> space M \<rightarrow> space M'. \<forall>y\<in>sets M'. f -` y \<inter> space M \<in> sets M})
[PROOF STEP]
by (simp cong: vimage_inter_cong Pi_cong add: simp_implies_def)


[STATEMENT]
lemma cos_Arccos [simp]: "cos(Arccos z) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (Arccos z) = z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos (Arccos z) = z
[PROOF STEP]
have "z*2 + \<i> * (2 * csqrt (1 - z\<^sup>2)) = 0 \<longleftrightarrow> z*2 + \<i> * csqrt (1 - z\<^sup>2)*2 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z * 2 + \<i> * (2 * csqrt (1 - z\<^sup>2)) = 0) = (z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0)
[PROOF STEP]
by (simp add: algebra_simps)  \<comment> \<open>Cancelling a factor of 2\<close>
[PROOF STATE]
proof (state)
this:
(z * 2 + \<i> * (2 * csqrt (1 - z\<^sup>2)) = 0) = (z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0)

goal (1 subgoal):
 1. cos (Arccos z) = z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(z * 2 + \<i> * (2 * csqrt (1 - z\<^sup>2)) = 0) = (z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0)

goal (1 subgoal):
 1. cos (Arccos z) = z
[PROOF STEP]
have "\<dots> \<longleftrightarrow> z + \<i> * csqrt (1 - z\<^sup>2) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0) = (z + \<i> * csqrt (1 - z\<^sup>2) = 0)
[PROOF STEP]
by (metis distrib_right mult_eq_0_iff zero_neq_numeral)
[PROOF STATE]
proof (state)
this:
(z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0) = (z + \<i> * csqrt (1 - z\<^sup>2) = 0)

goal (1 subgoal):
 1. cos (Arccos z) = z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(z * 2 + \<i> * (2 * csqrt (1 - z\<^sup>2)) = 0) = (z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0)
(z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0) = (z + \<i> * csqrt (1 - z\<^sup>2) = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(z * 2 + \<i> * (2 * csqrt (1 - z\<^sup>2)) = 0) = (z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0)
(z * 2 + \<i> * csqrt (1 - z\<^sup>2) * 2 = 0) = (z + \<i> * csqrt (1 - z\<^sup>2) = 0)

goal (1 subgoal):
 1. cos (Arccos z) = z
[PROOF STEP]
by (simp add: cos_exp_eq Arccos_def Arccos_body_lemma exp_minus field_simps flip: power2_eq_square)
[PROOF STATE]
proof (state)
this:
cos (Arccos z) = z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unfoldr_rbt_entries_generator_aux:
  "list.unfoldr rbt_entries_generator (kts, t) =
  RBT_Impl.entries t @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.unfoldr rbt_entries_generator (kts, t) = RBT_Impl.entries t @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
proof(induct "(kts, t)" arbitrary: kts t taking: Pair rule: rbt_generator_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. list.unfoldr rbt_entries_generator ([], rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) [])
 2. \<And>k t kts. list.unfoldr rbt_entries_generator (kts, t) = RBT_Impl.entries t @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts) \<Longrightarrow> list.unfoldr rbt_entries_generator ((k, t) # kts, rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) ((k, t) # kts))
 3. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. list.unfoldr rbt_entries_generator ([], rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) [])
 2. \<And>k t kts. list.unfoldr rbt_entries_generator (kts, t) = RBT_Impl.entries t @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts) \<Longrightarrow> list.unfoldr rbt_entries_generator ((k, t) # kts, rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) ((k, t) # kts))
 3. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.unfoldr rbt_entries_generator ([], rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) [])
[PROOF STEP]
by(simp add: list.unfoldr.simps)
[PROOF STATE]
proof (state)
this:
list.unfoldr rbt_entries_generator ([], rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) [])

goal (2 subgoals):
 1. \<And>k t kts. list.unfoldr rbt_entries_generator (kts, t) = RBT_Impl.entries t @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts) \<Longrightarrow> list.unfoldr rbt_entries_generator ((k, t) # kts, rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) ((k, t) # kts))
 2. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>k t kts. list.unfoldr rbt_entries_generator (kts, t) = RBT_Impl.entries t @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts) \<Longrightarrow> list.unfoldr rbt_entries_generator ((k, t) # kts, rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) ((k, t) # kts))
 2. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
case split
[PROOF STATE]
proof (state)
this:
list.unfoldr rbt_entries_generator (kts_, t_) = RBT_Impl.entries t_ @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts_)

goal (2 subgoals):
 1. \<And>k t kts. list.unfoldr rbt_entries_generator (kts, t) = RBT_Impl.entries t @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts) \<Longrightarrow> list.unfoldr rbt_entries_generator ((k, t) # kts, rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) ((k, t) # kts))
 2. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
list.unfoldr rbt_entries_generator (kts_, t_) = RBT_Impl.entries t_ @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts_)

goal (1 subgoal):
 1. list.unfoldr rbt_entries_generator ((k_, t_) # kts_, rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) ((k_, t_) # kts_))
[PROOF STEP]
by(subst list.unfoldr.simps) simp
[PROOF STATE]
proof (state)
this:
list.unfoldr rbt_entries_generator ((k_, t_) # kts_, rbt.Empty) = RBT_Impl.entries rbt.Empty @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) ((k_, t_) # kts_))

goal (1 subgoal):
 1. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
case shuffle
[PROOF STATE]
proof (state)
this:
list.unfoldr rbt_entries_generator (((k_, v_), r_) # kts_, l_) = RBT_Impl.entries l_ @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k_, v_), r_) # kts_))

goal (1 subgoal):
 1. \<And>kts c l k v r. list.unfoldr rbt_entries_generator (((k, v), r) # kts, l) = RBT_Impl.entries l @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k, v), r) # kts)) \<Longrightarrow> list.unfoldr rbt_entries_generator (kts, Branch c l k v r) = RBT_Impl.entries (Branch c l k v r) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
list.unfoldr rbt_entries_generator (((k_, v_), r_) # kts_, l_) = RBT_Impl.entries l_ @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) (((k_, v_), r_) # kts_))

goal (1 subgoal):
 1. list.unfoldr rbt_entries_generator (kts_, Branch c_ l_ k_ v_ r_) = RBT_Impl.entries (Branch c_ l_ k_ v_ r_) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts_)
[PROOF STEP]
by(subst list.unfoldr.simps)(subst (asm) list.unfoldr.simps, simp)
[PROOF STATE]
proof (state)
this:
list.unfoldr rbt_entries_generator (kts_, Branch c_ l_ k_ v_ r_) = RBT_Impl.entries (Branch c_ l_ k_ v_ r_) @ concat (map (\<lambda>(k, t). k # RBT_Impl.entries t) kts_)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_sum_mset [simp]:
  "of_nat (sum_mset A) = sum_mset (image_mset of_nat A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (\<Sum>\<^sub># A) = \<Sum>\<^sub># (image_mset of_nat A)
[PROOF STEP]
by (induction A) auto


[STATEMENT]
lemma map_of_Some_filter_not_in:
  "\<lbrakk> map_of xs k = Some v; \<not> P (k, v); distinct (map fst xs) \<rbrakk> \<Longrightarrow> map_of (filter P xs) k = None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>map_of xs k = Some v; \<not> P (k, v); distinct (map fst xs)\<rbrakk> \<Longrightarrow> map_of (filter P xs) k = None
[PROOF STEP]
apply(induct xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>map_of [] k = Some v; \<not> P (k, v); distinct (map fst [])\<rbrakk> \<Longrightarrow> map_of (filter P []) k = None
 2. \<And>a xs. \<lbrakk>\<lbrakk>map_of xs k = Some v; \<not> P (k, v); distinct (map fst xs)\<rbrakk> \<Longrightarrow> map_of (filter P xs) k = None; map_of (a # xs) k = Some v; \<not> P (k, v); distinct (map fst (a # xs))\<rbrakk> \<Longrightarrow> map_of (filter P (a # xs)) k = None
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>(k, v) \<in> set xs \<Longrightarrow> map_of (filter P xs) k = None; \<not> P (k, v); k \<notin> fst ` set xs; distinct (map fst xs)\<rbrakk> \<Longrightarrow> map_of (filter P xs) k = None
[PROOF STEP]
apply(auto simp add: map_of_eq_None_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_sinh [continuous_intros]:
  fixes f :: "_ \<Rightarrow>'a::{real_normed_field,banach}"
  assumes "continuous F f"
  shows   "continuous F (\<lambda>x. sinh (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. sinh (f x))
[PROOF STEP]
unfolding sinh_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F (\<lambda>x. (exp (f x) - exp (- f x)) /\<^sub>R 2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous F f

goal (1 subgoal):
 1. continuous F (\<lambda>x. (exp (f x) - exp (- f x)) /\<^sub>R 2)
[PROOF STEP]
by (intro continuous_intros)


[STATEMENT]
lemma critical_set_oSuc_lemma:
"critical_set A (oSuc n) =
  critical_set A n \<inter> range (oDeriv (ordering (critical_set A n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. critical_set A (oSuc n) = critical_set A n \<inter> range (oDeriv (OrdinalVeblen.ordering (critical_set A n)))
[PROOF STEP]
by (unfold critical_set_def, rule ordinal_rec0_oSuc)


[STATEMENT]
lemma apx_meet:
  assumes "has_apx_meet x y"
    shows "is_apx_meet x y (x \<triangle> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_apx_meet x y (x \<triangle> y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. is_apx_meet x y (x \<triangle> y)
[PROOF STEP]
have "is_apx_meet x y (THE z . is_apx_meet x y z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_apx_meet x y (THE z. is_apx_meet x y z)
[PROOF STEP]
by (metis apx_meet_unique assms theI)
[PROOF STATE]
proof (state)
this:
is_apx_meet x y (THE z. is_apx_meet x y z)

goal (1 subgoal):
 1. is_apx_meet x y (x \<triangle> y)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
is_apx_meet x y (THE z. is_apx_meet x y z)

goal (1 subgoal):
 1. is_apx_meet x y (x \<triangle> y)
[PROOF STEP]
by (simp add: the_apx_meet_def)
[PROOF STATE]
proof (state)
this:
is_apx_meet x y (x \<triangle> y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma basis_subspace_exists:
  assumes "subspace S"
  obtains B where "finite B" "B \<subseteq> S" "independent B" "span B = S" "card B = dim S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>finite B; B \<subseteq> S; independent B; span B = S; card B = dim S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis assms span_subspace basis_exists finiteI_independent)


[STATEMENT]
lemma (in aGroup) ag_eq_diffzero1:"\<lbrakk>a \<in> carrier A; b \<in> carrier A\<rbrakk> \<Longrightarrow>
                       (a = b) = ((-\<^sub>a a) \<plusminus> b = \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A\<rbrakk> \<Longrightarrow> (a = b) = (-\<^sub>a a \<plusminus> b = \<zero>)
[PROOF STEP]
apply (frule ag_mOp_closed[of a],
       simp add:ag_pOp_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> (a = b) = (b \<plusminus> -\<^sub>a a = \<zero>)
[PROOF STEP]
apply (subst ag_eq_diffzero[THEN sym], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A; -\<^sub>a a \<in> carrier A\<rbrakk> \<Longrightarrow> (a = b) = (b = a)
[PROOF STEP]
apply (rule iffI, rule sym, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier A; b \<in> carrier A; -\<^sub>a a \<in> carrier A; b = a\<rbrakk> \<Longrightarrow> a = b
[PROOF STEP]
apply (rule sym, assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma star_of_Infinitesimal_iff_0 [iff]: "star_of x \<in> Infinitesimal \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (star_of x \<in> Infinitesimal) = (x = (0::'a))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. star_of x \<in> Infinitesimal \<Longrightarrow> x = (0::'a)
 2. x = (0::'a) \<Longrightarrow> star_of x \<in> Infinitesimal
[PROOF STEP]
show "x = 0" if "star_of x \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
have "hnorm (star_n (\<lambda>n. x)) \<in> Standard"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hnorm (star_n (\<lambda>n. x)) \<in> Standard
[PROOF STEP]
by (metis Reals_eq_Standard SReal_iff star_of_def star_of_norm)
[PROOF STATE]
proof (state)
this:
hnorm (star_n (\<lambda>n. x)) \<in> Standard

goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hnorm (star_n (\<lambda>n. x)) \<in> Standard
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hnorm (star_n (\<lambda>n. x)) \<in> Standard

goal (1 subgoal):
 1. x = (0::'a)
[PROOF STEP]
by (metis InfinitesimalD2 less_irrefl star_of_norm that zero_less_norm_iff)
[PROOF STATE]
proof (state)
this:
x = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
star_of x \<in> Infinitesimal \<Longrightarrow> x = (0::'a)

goal (1 subgoal):
 1. x = (0::'a) \<Longrightarrow> star_of x \<in> Infinitesimal
[PROOF STEP]
qed auto


[STATEMENT]
lemma Trgs_append [simp]:
    shows "U \<noteq> [] \<Longrightarrow> Trgs (T @ U) = Trgs U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<noteq> [] \<Longrightarrow> Trgs (T @ U) = Trgs U
[PROOF STEP]
proof (induct T)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. U \<noteq> [] \<Longrightarrow> Trgs ([] @ U) = Trgs U
 2. \<And>a T. \<lbrakk>U \<noteq> [] \<Longrightarrow> Trgs (T @ U) = Trgs U; U \<noteq> []\<rbrakk> \<Longrightarrow> Trgs ((a # T) @ U) = Trgs U
[PROOF STEP]
show "U \<noteq> [] \<Longrightarrow> Trgs ([] @ U) = Trgs U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<noteq> [] \<Longrightarrow> Trgs ([] @ U) = Trgs U
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
U \<noteq> [] \<Longrightarrow> Trgs ([] @ U) = Trgs U

goal (1 subgoal):
 1. \<And>a T. \<lbrakk>U \<noteq> [] \<Longrightarrow> Trgs (T @ U) = Trgs U; U \<noteq> []\<rbrakk> \<Longrightarrow> Trgs ((a # T) @ U) = Trgs U
[PROOF STEP]
show "\<And>t T. \<lbrakk>U \<noteq> [] \<Longrightarrow> Trgs (T @ U) = Trgs U; U \<noteq> []\<rbrakk>
                      \<Longrightarrow> Trgs ((t # T) @ U) = Trgs U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t T. \<lbrakk>U \<noteq> [] \<Longrightarrow> Trgs (T @ U) = Trgs U; U \<noteq> []\<rbrakk> \<Longrightarrow> Trgs ((t # T) @ U) = Trgs U
[PROOF STEP]
by (metis Nil_is_append_conv Trgs.simps(3) append_Cons list.exhaust)
[PROOF STATE]
proof (state)
this:
\<lbrakk>U \<noteq> [] \<Longrightarrow> Trgs (?T @ U) = Trgs U; U \<noteq> []\<rbrakk> \<Longrightarrow> Trgs ((?t # ?T) @ U) = Trgs U

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_nonzero_set_prod:
  fixes I:: "real poly set"
  shows  nonzero_hyp: "finite I \<Longrightarrow> ((\<forall> q \<in> I. q \<noteq> 0) \<longrightarrow> \<Prod> I \<noteq> 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite I \<Longrightarrow> (\<forall>q\<in>I. q \<noteq> 0) \<longrightarrow> \<Prod>I \<noteq> 0
[PROOF STEP]
proof (induct rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<forall>q\<in>{}. q \<noteq> 0) \<longrightarrow> \<Prod>{} \<noteq> 0
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<forall>q\<in>{}. q \<noteq> 0) \<longrightarrow> \<Prod>{} \<noteq> 0
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>q\<in>{}. q \<noteq> 0) \<longrightarrow> \<Prod>{} \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<forall>q\<in>{}. q \<noteq> 0) \<longrightarrow> \<Prod>{} \<noteq> 0

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
(\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
have h: "\<Prod> (insert x F) = x * (\<Prod> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>(insert x F) = x * \<Prod>F
[PROOF STEP]
by (simp add: insert.hyps(1) insert.hyps(2))
[PROOF STATE]
proof (state)
this:
\<Prod>(insert x F) = x * \<Prod>F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
have h_xin: "x \<in> insert x F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> insert x F
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> insert x F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
have hq: "(\<forall> q \<in> (insert x F). q \<noteq> 0) \<longrightarrow> x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> x \<noteq> 0
[PROOF STEP]
using h_xin
[PROOF STATE]
proof (prove)
using this:
x \<in> insert x F

goal (1 subgoal):
 1. (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> x \<noteq> 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> x \<noteq> 0

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0\<rbrakk> \<Longrightarrow> (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
using h hq
[PROOF STATE]
proof (prove)
using this:
\<Prod>(insert x F) = x * \<Prod>F
(\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> x \<noteq> 0

goal (1 subgoal):
 1. (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
using insert.hyps(3)
[PROOF STATE]
proof (prove)
using this:
\<Prod>(insert x F) = x * \<Prod>F
(\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> x \<noteq> 0
(\<forall>q\<in>F. q \<noteq> 0) \<longrightarrow> \<Prod>F \<noteq> 0

goal (1 subgoal):
 1. (\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>q\<in>insert x F. q \<noteq> 0) \<longrightarrow> \<Prod>(insert x F) \<noteq> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fold_max_triv:
  fixes k :: "_ :: linorder"
  shows "(\<forall>x\<in>set xs. x \<le> k) \<Longrightarrow> List.fold max xs k = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set xs. x \<le> k \<Longrightarrow> fold max xs k = k
[PROOF STEP]
by (induct xs) (auto simp add: max_def)


[STATEMENT]
theorem euler_maclaurin_raw_strong_int:
  defines "S \<equiv> (\<Sum>i\<in>{a<..b}. f (of_int i))"
  defines "I \<equiv> integral {of_int a..of_int b} f"
  defines "c' \<equiv> \<lambda>k. (bernoulli' (Suc k) / fact (Suc k)) *\<^sub>R (fs k b - fs k a)"
  shows   "S - I = (\<Sum>k<N. c' k) + EM_remainder' N (fs N) a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
define c :: "nat \<Rightarrow> 'a"
    where "c = (\<lambda>k. ((-1) ^ (Suc k) * bernoulli (Suc k) / fact (Suc k)) *\<^sub>R (fs k b - fs k a))"
[PROOF STATE]
proof (state)
this:
c = (\<lambda>k. ((- 1) ^ Suc k * bernoulli (Suc k) / fact (Suc k)) *\<^sub>R (fs k (real_of_int b) - fs k (real_of_int a)))

goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
have "S - I = (\<Sum>k<m. c k) + EM_remainder' m (fs m) a b" if "m \<ge> 1" "m \<le> N" for m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S - I = sum c {..<m} + EM_remainder' m (fs m) (real_of_int a) (real_of_int b)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
1 \<le> m
m \<le> N

goal (1 subgoal):
 1. S - I = sum c {..<m} + EM_remainder' m (fs m) (real_of_int a) (real_of_int b)
[PROOF STEP]
proof (induction m rule: dec_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 \<le> N \<Longrightarrow> S - I = sum c {..<1} + EM_remainder' 1 (fs 1) (real_of_int a) (real_of_int b)
 2. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:
1 \<le> N

goal (2 subgoals):
 1. 1 \<le> N \<Longrightarrow> S - I = sum c {..<1} + EM_remainder' 1 (fs 1) (real_of_int a) (real_of_int b)
 2. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
with ab fin fs_cont[of 0]
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
finite Y
0 \<le> N \<Longrightarrow> continuous_on {real_of_int a..real_of_int b} (fs 0)
1 \<le> N
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a \<le> b
finite Y
0 \<le> N \<Longrightarrow> continuous_on {real_of_int a..real_of_int b} (fs 0)
1 \<le> N

goal (1 subgoal):
 1. S - I = sum c {..<1} + EM_remainder' 1 (fs 1) (real_of_int a) (real_of_int b)
[PROOF STEP]
using fs_deriv[of 0] N
[PROOF STATE]
proof (prove)
using this:
a \<le> b
finite Y
0 \<le> N \<Longrightarrow> continuous_on {real_of_int a..real_of_int b} (fs 0)
1 \<le> N
\<lbrakk>0 < N; ?x \<in> {real_of_int a..real_of_int b} - Y\<rbrakk> \<Longrightarrow> (fs 0 has_vector_derivative fs (Suc 0) ?x) (at ?x)
0 < N

goal (1 subgoal):
 1. S - I = sum c {..<1} + EM_remainder' 1 (fs 1) (real_of_int a) (real_of_int b)
[PROOF STEP]
unfolding One_nat_def
[PROOF STATE]
proof (prove)
using this:
a \<le> b
finite Y
0 \<le> N \<Longrightarrow> continuous_on {real_of_int a..real_of_int b} (fs 0)
Suc 0 \<le> N
\<lbrakk>0 < N; ?x \<in> {real_of_int a..real_of_int b} - Y\<rbrakk> \<Longrightarrow> (fs 0 has_vector_derivative fs (Suc 0) ?x) (at ?x)
0 < N

goal (1 subgoal):
 1. S - I = sum c {..<Suc 0} + EM_remainder' (Suc 0) (fs (Suc 0)) (real_of_int a) (real_of_int b)
[PROOF STEP]
by (subst EM_remainder'_Suc_0[of _ _ Y f]) (simp_all add: algebra_simps S_def I_def c_def)
[PROOF STATE]
proof (state)
this:
S - I = sum c {..<1} + EM_remainder' 1 (fs 1) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
case (step n)
[PROOF STATE]
proof (state)
this:
1 \<le> n
n < m
n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b)
Suc n \<le> N

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
from step.prems
[PROOF STATE]
proof (chain)
picking this:
Suc n \<le> N
[PROOF STEP]
have "S - I = (\<Sum>k<n. c k) + EM_remainder' n (fs n) a b"
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> N

goal (1 subgoal):
 1. S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b)
[PROOF STEP]
by (intro step.IH) simp_all
[PROOF STATE]
proof (state)
this:
S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
have "(\<Sum>k<n. c k) = (\<Sum>k<Suc n. c k) +
                  (((-1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n b - fs n a))"
      (is "_ = _ + ?c")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum c {..<n} = sum c {..<Suc n} + ((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a))
[PROOF STEP]
by (simp add: EM_remainder'_Suc_0 c_def)
[PROOF STATE]
proof (state)
this:
sum c {..<n} = sum c {..<Suc n} + ((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum c {..<n} = sum c {..<Suc n} + ((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
have "\<dots> + EM_remainder' n (fs n) a b = (\<Sum>k<Suc n. c k) + (?c + EM_remainder' n (fs n) a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum c {..<Suc n} + ((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b) = sum c {..<Suc n} + (((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b))
[PROOF STEP]
by (simp add: add.assoc)
[PROOF STATE]
proof (state)
this:
sum c {..<Suc n} + ((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b) = sum c {..<Suc n} + (((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum c {..<Suc n} + ((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b) = sum c {..<Suc n} + (((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b))

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
from step.prems step.hyps ab fin
[PROOF STATE]
proof (chain)
picking this:
Suc n \<le> N
1 \<le> n
n < m
a \<le> b
finite Y
[PROOF STEP]
have "?c + EM_remainder' n (fs n) a b = EM_remainder' (Suc n) (fs (Suc n)) a b"
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> N
1 \<le> n
n < m
a \<le> b
finite Y

goal (1 subgoal):
 1. ((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b) = EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
by (subst EM_remainder'_conv_Suc [where A = Y])
         (auto intro!: fs_deriv fs_cont)
[PROOF STATE]
proof (state)
this:
((- 1) ^ n * bernoulli (Suc n) / fact (Suc n)) *\<^sub>R (fs n (real_of_int b) - fs n (real_of_int a)) + EM_remainder' n (fs n) (real_of_int a) (real_of_int b) = EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; n < m; n \<le> N \<Longrightarrow> S - I = sum c {..<n} + EM_remainder' n (fs n) (real_of_int a) (real_of_int b); Suc n \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
S - I = sum c {..<Suc n} + EM_remainder' (Suc n) (fs (Suc n)) (real_of_int a) (real_of_int b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 \<le> ?m; ?m \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<?m} + EM_remainder' ?m (fs ?m) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
from this[of N] and N
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>1 \<le> N; N \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
0 < N
[PROOF STEP]
have "S - I = sum c {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<le> N; N \<le> N\<rbrakk> \<Longrightarrow> S - I = sum c {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
0 < N

goal (1 subgoal):
 1. S - I = sum c {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
S - I = sum c {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S - I = sum c {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
have "sum c {..<N} = sum c' {..<N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum c {..<N} = sum c' {..<N}
[PROOF STEP]
proof (intro sum.cong refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<N} \<Longrightarrow> c x = c' x
[PROOF STEP]
fix k :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {..<N} \<Longrightarrow> c x = c' x
[PROOF STEP]
show "c k = c' k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c k = c' k
[PROOF STEP]
by (cases "even k")
         (auto simp: c_def c'_def bernoulli'_def algebra_simps bernoulli_odd_eq_0)
[PROOF STATE]
proof (state)
this:
c k = c' k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum c {..<N} = sum c' {..<N}

goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)

goal (1 subgoal):
 1. S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
S - I = sum c' {..<N} + EM_remainder' N (fs N) (real_of_int a) (real_of_int b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in vec_space) dim_zero_vs: "vectorspace.dim class_ring (span_vs {}) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace.dim class_ring (vs (local.span {})) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vectorspace.dim class_ring (vs (local.span {})) = 0
[PROOF STEP]
have "vectorspace class_ring (span_vs {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace class_ring (vs (local.span {}))
[PROOF STEP]
using field.field_axioms span_is_submodule submodule_is_module vectorspace_def
[PROOF STATE]
proof (prove)
using this:
field class_ring
?S \<subseteq> carrier_vec n \<Longrightarrow> LinearCombinations.submodule class_ring (local.span ?S) V
LinearCombinations.submodule class_ring ?N V \<Longrightarrow> module class_ring (vs ?N)
vectorspace ?K ?V \<equiv> module ?K ?V \<and> field ?K

goal (1 subgoal):
 1. vectorspace class_ring (vs (local.span {}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vectorspace class_ring (vs (local.span {}))

goal (1 subgoal):
 1. vectorspace.dim class_ring (vs (local.span {})) = 0
[PROOF STEP]
have "{} \<subseteq> carrier_vec n \<and> lin_indpt {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {} \<subseteq> carrier_vec n \<and> lin_indpt {}
[PROOF STEP]
by (metis (no_types) empty_subsetI fin_dim finite_basis_exists subset_li_is_li vec_vs vectorspace.basis_def)
[PROOF STATE]
proof (state)
this:
{} \<subseteq> carrier_vec n \<and> lin_indpt {}

goal (1 subgoal):
 1. vectorspace.dim class_ring (vs (local.span {})) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{} \<subseteq> carrier_vec n \<and> lin_indpt {}
[PROOF STEP]
have "vectorspace.basis class_ring (span_vs {}) {}"
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> carrier_vec n \<and> lin_indpt {}

goal (1 subgoal):
 1. vectorspace.basis class_ring (vs (local.span {})) {}
[PROOF STEP]
using vectorspace.basis_def
[PROOF STATE]
proof (prove)
using this:
{} \<subseteq> carrier_vec n \<and> lin_indpt {}
vectorspace ?K ?V \<Longrightarrow> vectorspace.basis ?K ?V ?A = (\<not> module.lin_dep ?K ?V ?A \<and> LinearCombinations.module.span ?K ?V ?A = carrier ?V \<and> ?A \<subseteq> carrier ?V)

goal (1 subgoal):
 1. vectorspace.basis class_ring (vs (local.span {})) {}
[PROOF STEP]
by (simp add: \<open>vectorspace class_ring (vs (span {}))\<close> span_is_submodule span_li_not_depend(1) span_li_not_depend(2) vectorspace.basis_def)
[PROOF STATE]
proof (state)
this:
vectorspace.basis class_ring (vs (local.span {})) {}

goal (1 subgoal):
 1. vectorspace.dim class_ring (vs (local.span {})) = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vectorspace.basis class_ring (vs (local.span {})) {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vectorspace.basis class_ring (vs (local.span {})) {}

goal (1 subgoal):
 1. vectorspace.dim class_ring (vs (local.span {})) = 0
[PROOF STEP]
using \<open>vectorspace class_ring (vs (span {}))\<close> vectorspace.dim_basis
[PROOF STATE]
proof (prove)
using this:
vectorspace.basis class_ring (vs (local.span {})) {}
vectorspace class_ring (vs (local.span {}))
\<lbrakk>vectorspace ?K ?V; finite ?A; vectorspace.basis ?K ?V ?A\<rbrakk> \<Longrightarrow> vectorspace.dim ?K ?V = card ?A

goal (1 subgoal):
 1. vectorspace.dim class_ring (vs (local.span {})) = 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
vectorspace.dim class_ring (vs (local.span {})) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_constant_1:
    assumes "k < length cs"
    assumes "\<And> a. a \<in> set w \<Longrightarrow> \<not> (cs ! k) a"
    shows "fold (count cs) w k = k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold (count cs) w k = k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
k < length cs
?a \<in> set w \<Longrightarrow> \<not> (cs ! k) ?a

goal (1 subgoal):
 1. fold (count cs) w k = k
[PROOF STEP]
unfolding count_def
[PROOF STATE]
proof (prove)
using this:
k < length cs
?a \<in> set w \<Longrightarrow> \<not> (cs ! k) ?a

goal (1 subgoal):
 1. fold (\<lambda>a k. if k < length cs then if (cs ! k) a then Suc k mod length cs else k else if cs = [] then k else 0) w k = k
[PROOF STEP]
by (induct w) (auto)


[STATEMENT]
lemma p_fun_comp:
  assumes "is_p_fun x" and "is_p_fun y"
  shows "is_p_fun (x ; y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_p_fun (x ; y)
[PROOF STEP]
proof (unfold is_p_fun_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x ; y)\<^sup>\<smile> ; (x ; y) \<le> 1'
[PROOF STEP]
have "(x ; y)\<^sup>\<smile> ; x ; y = y\<^sup>\<smile> ; x\<^sup>\<smile> ; x ; y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x ; y)\<^sup>\<smile> ; x ; y = y\<^sup>\<smile> ; x\<^sup>\<smile> ; x ; y
[PROOF STEP]
by (metis conv_contrav mult.assoc)
[PROOF STATE]
proof (state)
this:
(x ; y)\<^sup>\<smile> ; x ; y = y\<^sup>\<smile> ; x\<^sup>\<smile> ; x ; y

goal (1 subgoal):
 1. (x ; y)\<^sup>\<smile> ; (x ; y) \<le> 1'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x ; y)\<^sup>\<smile> ; x ; y = y\<^sup>\<smile> ; x\<^sup>\<smile> ; x ; y

goal (1 subgoal):
 1. (x ; y)\<^sup>\<smile> ; (x ; y) \<le> 1'
[PROOF STEP]
have "... \<le> y\<^sup>\<smile> ; y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y\<^sup>\<smile> ; x\<^sup>\<smile> ; x ; y \<le> y\<^sup>\<smile> ; y
[PROOF STEP]
by (metis assms(1) is_p_fun_def mult_double_iso mult.right_neutral mult.assoc)
[PROOF STATE]
proof (state)
this:
y\<^sup>\<smile> ; x\<^sup>\<smile> ; x ; y \<le> y\<^sup>\<smile> ; y

goal (1 subgoal):
 1. (x ; y)\<^sup>\<smile> ; (x ; y) \<le> 1'
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(x ; y)\<^sup>\<smile> ; x ; y \<le> y\<^sup>\<smile> ; y
[PROOF STEP]
show "(x ; y)\<^sup>\<smile> ; (x ; y) \<le> 1'"
[PROOF STATE]
proof (prove)
using this:
(x ; y)\<^sup>\<smile> ; x ; y \<le> y\<^sup>\<smile> ; y

goal (1 subgoal):
 1. (x ; y)\<^sup>\<smile> ; (x ; y) \<le> 1'
[PROOF STEP]
by (metis assms(2) order_trans is_p_fun_def mult.assoc)
[PROOF STATE]
proof (state)
this:
(x ; y)\<^sup>\<smile> ; (x ; y) \<le> 1'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_eq_iff:
  assumes "bij f" shows "f x = f y \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f x = f y) = (x = y)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij f

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


[STATEMENT]
lemma iIN_cut_le: "
  [n\<dots>,d] \<down>\<le> t = (
  if t < n then {} else
  if t \<le> n+d then [n\<dots>,t-n]
  else [n\<dots>,d])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [n\<dots>,d] \<down>\<le> t = (if t < n then {} else if t \<le> n + d then [n\<dots>,t - n] else [n\<dots>,d])
[PROOF STEP]
by (force simp: set_eq_iff i_cut_mem_iff iT_iff)


[STATEMENT]
theorem g_rec_is_pr: "g_rec \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g_rec \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. g_rec \<in> PrimRec2
[PROOF STEP]
from c_assoc_have_key_is_pr c_assoc_value_is_pr c_cons_is_pr
[PROOF STATE]
proof (chain)
picking this:
c_assoc_have_key \<in> PrimRec2
c_assoc_value \<in> PrimRec2
c_cons \<in> PrimRec2
[PROOF STEP]
have "(\<lambda> x y. g_rec x y) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
c_assoc_have_key \<in> PrimRec2
c_assoc_value \<in> PrimRec2
c_cons \<in> PrimRec2

goal (1 subgoal):
 1. g_rec \<in> PrimRec2
[PROOF STEP]
unfolding g_rec_def Let_def
[PROOF STATE]
proof (prove)
using this:
c_assoc_have_key \<in> PrimRec2
c_assoc_value \<in> PrimRec2
c_cons \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>x y. if c_fst (c_snd y) = 0 then if c_assoc_have_key x (c_pair (c_fst (c_snd (c_fst y))) (c_snd (c_snd y))) = 0 then c_cons (c_pair y (c_assoc_value x (c_pair (c_fst (c_snd (c_fst y))) (c_snd (c_snd y))))) x else x else if c_assoc_have_key x (c_pair (c_fst y) (c_pair (c_fst (c_snd y) - 1) (c_snd (c_snd y)))) = 0 then if c_assoc_have_key x (c_pair (c_snd (c_snd (c_fst y))) (c_pair (c_pair (c_fst (c_snd y) - 1) (c_assoc_value x (c_pair (c_fst y) (c_pair (c_fst (c_snd y) - 1) (c_snd (c_snd y)))))) (c_snd (c_snd y)))) = 0 then c_cons (c_pair y (c_assoc_value x (c_pair (c_snd (c_snd (c_fst y))) (c_pair (c_pair (c_fst (c_snd y) - 1) (c_assoc_value x (c_pair (c_fst y) (c_pair (c_fst (c_snd y) - 1) (c_snd (c_snd y)))))) (c_snd (c_snd y)))))) x else x else x) \<in> PrimRec2
[PROOF STEP]
by prec
[PROOF STATE]
proof (state)
this:
g_rec \<in> PrimRec2

goal (1 subgoal):
 1. g_rec \<in> PrimRec2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
g_rec \<in> PrimRec2

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_poly_irreducible_altdef:
  "mod_poly_irreducible CARD('n :: nontriv) p \<longleftrightarrow>
    irreducible (of_int_poly p :: 'n mod_ring poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_poly_irreducible CARD('n) p = irreducible (of_int_poly p)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mod_poly_irreducible CARD('n) p \<Longrightarrow> irreducible (of_int_poly p)
 2. irreducible (of_int_poly p) \<Longrightarrow> mod_poly_irreducible CARD('n) p
[PROOF STEP]
assume "irreducible (of_int_poly p :: 'n mod_ring poly)"
[PROOF STATE]
proof (state)
this:
irreducible (of_int_poly p)

goal (2 subgoals):
 1. mod_poly_irreducible CARD('n) p \<Longrightarrow> irreducible (of_int_poly p)
 2. irreducible (of_int_poly p) \<Longrightarrow> mod_poly_irreducible CARD('n) p
[PROOF STEP]
thus "mod_poly_irreducible CARD('n) p"
[PROOF STATE]
proof (prove)
using this:
irreducible (of_int_poly p)

goal (1 subgoal):
 1. mod_poly_irreducible CARD('n) p
[PROOF STEP]
by (auto simp: mod_poly_irreducible_def mod_poly_rel_altdef
    mod_poly_is_unit_altdef irreducible_def of_int_poly_hom.hom_mult)
[PROOF STATE]
proof (state)
this:
mod_poly_irreducible CARD('n) p

goal (1 subgoal):
 1. mod_poly_irreducible CARD('n) p \<Longrightarrow> irreducible (of_int_poly p)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_poly_irreducible CARD('n) p \<Longrightarrow> irreducible (of_int_poly p)
[PROOF STEP]
assume *: "mod_poly_irreducible CARD('n) p"
[PROOF STATE]
proof (state)
this:
mod_poly_irreducible CARD('n) p

goal (1 subgoal):
 1. mod_poly_irreducible CARD('n) p \<Longrightarrow> irreducible (of_int_poly p)
[PROOF STEP]
show "irreducible (of_int_poly p :: 'n mod_ring poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible (of_int_poly p)
[PROOF STEP]
unfolding irreducible_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly p \<noteq> 0 \<and> \<not> of_int_poly p dvd 1 \<and> (\<forall>a b. of_int_poly p = a * b \<longrightarrow> a dvd 1 \<or> b dvd 1)
[PROOF STEP]
proof (intro conjI impI allI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
fix a b
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
assume ab: "(of_int_poly p :: 'n mod_ring poly) = a * b"
[PROOF STATE]
proof (state)
this:
of_int_poly p = a * b

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
have "of_int_poly (map_poly to_int_mod_ring a *
      map_poly to_int_mod_ring b) =
      of_int_poly (map_poly to_int_mod_ring a) *
      (of_int_poly (map_poly to_int_mod_ring b) :: 'n mod_ring poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly (to_int_poly a * to_int_poly b) = of_int_poly (to_int_poly a) * of_int_poly (to_int_poly b)
[PROOF STEP]
by (simp add: of_int_poly_hom.hom_mult)
[PROOF STATE]
proof (state)
this:
of_int_poly (to_int_poly a * to_int_poly b) = of_int_poly (to_int_poly a) * of_int_poly (to_int_poly b)

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int_poly (to_int_poly a * to_int_poly b) = of_int_poly (to_int_poly a) * of_int_poly (to_int_poly b)

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
have "\<dots> = a * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly (to_int_poly a) * of_int_poly (to_int_poly b) = a * b
[PROOF STEP]
by (simp add: of_int_poly_to_int_poly)
[PROOF STATE]
proof (state)
this:
of_int_poly (to_int_poly a) * of_int_poly (to_int_poly b) = a * b

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int_poly (to_int_poly a) * of_int_poly (to_int_poly b) = a * b

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
have "\<dots> = of_int_poly p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b = of_int_poly p
[PROOF STEP]
using ab
[PROOF STATE]
proof (prove)
using this:
of_int_poly p = a * b

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

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
of_int_poly (to_int_poly a * to_int_poly b) = of_int_poly p
[PROOF STEP]
have "(of_int_poly p :: 'n mod_ring poly) =
      of_int_poly (to_int_poly a * to_int_poly b)"
[PROOF STATE]
proof (prove)
using this:
of_int_poly (to_int_poly a * to_int_poly b) = of_int_poly p

goal (1 subgoal):
 1. of_int_poly p = of_int_poly (to_int_poly a * to_int_poly b)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
of_int_poly p = of_int_poly (to_int_poly a * to_int_poly b)

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
hence "of_int_poly (to_int_poly a) dvd (1 :: 'n mod_ring poly) \<or>
           of_int_poly (to_int_poly b) dvd (1 :: 'n mod_ring poly)"
[PROOF STATE]
proof (prove)
using this:
of_int_poly p = of_int_poly (to_int_poly a * to_int_poly b)

goal (1 subgoal):
 1. of_int_poly (to_int_poly a) dvd 1 \<or> of_int_poly (to_int_poly b) dvd 1
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
of_int_poly p = of_int_poly (to_int_poly a * to_int_poly b)
mod_poly_irreducible CARD('n) p

goal (1 subgoal):
 1. of_int_poly (to_int_poly a) dvd 1 \<or> of_int_poly (to_int_poly b) dvd 1
[PROOF STEP]
unfolding mod_poly_irreducible_def mod_poly_rel_altdef
        mod_poly_is_unit_altdef
[PROOF STATE]
proof (prove)
using this:
of_int_poly p = of_int_poly (to_int_poly a * to_int_poly b)
of_int_poly p \<noteq> of_int_poly 0 \<and> \<not> of_int_poly p dvd 1 \<and> (\<forall>a b. of_int_poly p = of_int_poly (a * b) \<longrightarrow> of_int_poly a dvd 1 \<or> of_int_poly b dvd 1)

goal (1 subgoal):
 1. of_int_poly (to_int_poly a) dvd 1 \<or> of_int_poly (to_int_poly b) dvd 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
of_int_poly (to_int_poly a) dvd 1 \<or> of_int_poly (to_int_poly b) dvd 1

goal (3 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
 3. \<And>a b. of_int_poly p = a * b \<Longrightarrow> a dvd 1 \<or> b dvd 1
[PROOF STEP]
thus "(a dvd (1 :: 'n mod_ring poly)) \<or>
      (b dvd (1 :: 'n mod_ring poly))"
[PROOF STATE]
proof (prove)
using this:
of_int_poly (to_int_poly a) dvd 1 \<or> of_int_poly (to_int_poly b) dvd 1

goal (1 subgoal):
 1. a dvd 1 \<or> b dvd 1
[PROOF STEP]
by (simp add: of_int_poly_to_int_poly)
[PROOF STATE]
proof (state)
this:
a dvd 1 \<or> b dvd 1

goal (2 subgoals):
 1. of_int_poly p \<noteq> 0
 2. \<not> of_int_poly p dvd 1
[PROOF STEP]
qed (use * in \<open>auto simp: mod_poly_irreducible_def
    mod_poly_rel_altdef mod_poly_is_unit_altdef\<close>)
[PROOF STATE]
proof (state)
this:
irreducible (of_int_poly p)

goal:
No subgoals!
[PROOF STEP]
qed