[STATEMENT]
lemma bdd_map_bdd_lookup:
  assumes "bddh (length ws) bdd"
  shows "bdd_lookup (bdd_map f bdd) ws = f (bdd_lookup bdd ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bdd_lookup (bdd_map f bdd) ws = f (bdd_lookup bdd ws)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bddh (length ws) bdd

goal (1 subgoal):
 1. bdd_lookup (bdd_map f bdd) ws = f (bdd_lookup bdd ws)
[PROOF STEP]
by (induct bdd ws rule: bdd_lookup.induct) (auto simp add: bddh_bdd_map)+


[STATEMENT]
lemma abelian_group_homI:
  assumes "abelian_group G"
  assumes "abelian_group H"
  assumes a_group_hom: "group_hom (add_monoid G)
                                  (add_monoid H) h"
  shows "abelian_group_hom G H h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abelian_group_hom G H h
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. abelian_group_hom G H h
[PROOF STEP]
interpret G: abelian_group G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abelian_group G
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. abelian_group_hom G H h
[PROOF STEP]
interpret H: abelian_group H
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abelian_group H
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. abelian_group_hom G H h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abelian_group_hom G H h
[PROOF STEP]
by (intro abelian_group_hom.intro abelian_group_hom_axioms.intro
        G.abelian_group_axioms H.abelian_group_axioms a_group_hom)
[PROOF STATE]
proof (state)
this:
abelian_group_hom G H h

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iFROM_iMOD_subset_conv: "([n'\<dots>] \<subseteq> [r, mod m]) = (r \<le> n' \<and> m = Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([n'\<dots>] \<subseteq> [ r, mod m ]) = (r \<le> n' \<and> m = Suc 0)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. [n'\<dots>] \<subseteq> [ r, mod m ] \<Longrightarrow> r \<le> n' \<and> m = Suc 0
 2. r \<le> n' \<and> m = Suc 0 \<Longrightarrow> [n'\<dots>] \<subseteq> [ r, mod m ]
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. [n'\<dots>] \<subseteq> [ r, mod m ] \<Longrightarrow> r \<le> n'
 2. [n'\<dots>] \<subseteq> [ r, mod m ] \<Longrightarrow> m = Suc 0
 3. r \<le> n' \<and> m = Suc 0 \<Longrightarrow> [n'\<dots>] \<subseteq> [ r, mod m ]
[PROOF STEP]
apply (drule iMin_subset[OF iFROM_not_empty])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. iMin [ r, mod m ] \<le> iMin [n'\<dots>] \<Longrightarrow> r \<le> n'
 2. [n'\<dots>] \<subseteq> [ r, mod m ] \<Longrightarrow> m = Suc 0
 3. r \<le> n' \<and> m = Suc 0 \<Longrightarrow> [n'\<dots>] \<subseteq> [ r, mod m ]
[PROOF STEP]
apply (simp add: iT_Min)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. [n'\<dots>] \<subseteq> [ r, mod m ] \<Longrightarrow> m = Suc 0
 2. r \<le> n' \<and> m = Suc 0 \<Longrightarrow> [n'\<dots>] \<subseteq> [ r, mod m ]
[PROOF STEP]
apply (rule ccontr)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>[n'\<dots>] \<subseteq> [ r, mod m ]; m \<noteq> Suc 0\<rbrakk> \<Longrightarrow> False
 2. r \<le> n' \<and> m = Suc 0 \<Longrightarrow> [n'\<dots>] \<subseteq> [ r, mod m ]
[PROOF STEP]
apply (cut_tac Suc_in_imp_not_subset_iMOD[of n' "[n'\<dots>]" m r])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<lbrakk>[n'\<dots>] \<subseteq> [ r, mod m ]; m \<noteq> Suc 0; \<not> [n'\<dots>] \<subseteq> [ r, mod m ]\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>[n'\<dots>] \<subseteq> [ r, mod m ]; m \<noteq> Suc 0\<rbrakk> \<Longrightarrow> n' \<in> [n'\<dots>]
 3. \<lbrakk>[n'\<dots>] \<subseteq> [ r, mod m ]; m \<noteq> Suc 0\<rbrakk> \<Longrightarrow> Suc n' \<in> [n'\<dots>]
 4. \<lbrakk>[n'\<dots>] \<subseteq> [ r, mod m ]; m \<noteq> Suc 0\<rbrakk> \<Longrightarrow> m \<noteq> Suc 0
 5. r \<le> n' \<and> m = Suc 0 \<Longrightarrow> [n'\<dots>] \<subseteq> [ r, mod m ]
[PROOF STEP]
apply (simp add: iT_iff)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<le> n' \<and> m = Suc 0 \<Longrightarrow> [n'\<dots>] \<subseteq> [ r, mod Suc 0 ]
[PROOF STEP]
apply (simp add: subset_iff iT_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma splitAt_conv:
 "splitAt x xs = (takeWhile (\<lambda>y. y\<noteq>x) xs, tl(dropWhile (\<lambda>y. y\<noteq>x) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. splitAt x xs = (takeWhile (\<lambda>y. y \<noteq> x) xs, tl (dropWhile (\<lambda>y. y \<noteq> x) xs))
[PROOF STEP]
by(simp add: splitAt_def splitAtRec_conv)


[STATEMENT]
lemma (in weak_partial_order) inf_of_singleton_closed:
  "x \<in> carrier L ==> \<Sqinter>{x} \<in> carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier L \<Longrightarrow> \<Sqinter>{x} \<in> carrier L
[PROOF STEP]
unfolding inf_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier L \<Longrightarrow> (SOME xa. is_glb L xa {x}) \<in> carrier L
[PROOF STEP]
by (rule someI2) (auto intro: inf_of_singletonI)


[STATEMENT]
lemma emeasure_map_spmf:
  "emeasure (measure_spmf (map_spmf f p)) A = emeasure (measure_spmf p) (f -` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_spmf (map_spmf f p)) A = emeasure (measure_spmf p) (f -` A)
[PROOF STEP]
by(auto simp add: measure_spmf_def emeasure_distr measurable_restrict_space1 space_restrict_space emeasure_restrict_space intro: arg_cong2[where f=emeasure])


[STATEMENT]
lemma LPDs_Plus: "LPDs (MPlus r s) \<subseteq> {MPlus r s} \<union> LPDs r \<union> LPDs s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LPDs (MPlus r s) \<subseteq> {MPlus r s} \<union> LPDs r \<union> LPDs s
[PROOF STEP]
unfolding LPDs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i. LPDi i (MPlus r s)) \<subseteq> {MPlus r s} \<union> (\<Union>i. LPDi i r) \<union> (\<Union>i. LPDi i s)
[PROOF STEP]
using LPDi_Plus[of _ r s]
[PROOF STATE]
proof (prove)
using this:
LPDi ?i (MPlus r s) \<subseteq> {MPlus r s} \<union> LPDi ?i r \<union> LPDi ?i s

goal (1 subgoal):
 1. (\<Union>i. LPDi i (MPlus r s)) \<subseteq> {MPlus r s} \<union> (\<Union>i. LPDi i r) \<union> (\<Union>i. LPDi i s)
[PROOF STEP]
by auto


[STATEMENT]
lemma has_chain_integral_chain_integral3:
  assumes "(f has_contour_integral i) (linepath a b +++ linepath b c +++ linepath c d)"
           (is "(f has_contour_integral i) ?g")
  shows "contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i"
       (is "?lhs = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i
[PROOF STEP]
have "f contour_integrable_on ?g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f contour_integrable_on linepath a b +++ linepath b c +++ linepath c d
[PROOF STEP]
using assms contour_integrable_on_def
[PROOF STATE]
proof (prove)
using this:
(f has_contour_integral i) (linepath a b +++ linepath b c +++ linepath c d)
?f contour_integrable_on ?g \<equiv> \<exists>i. (?f has_contour_integral i) ?g

goal (1 subgoal):
 1. f contour_integrable_on linepath a b +++ linepath b c +++ linepath c d
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f contour_integrable_on linepath a b +++ linepath b c +++ linepath c d

goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f contour_integrable_on linepath a b +++ linepath b c +++ linepath c d
[PROOF STEP]
have "?lhs = contour_integral ?g f"
[PROOF STATE]
proof (prove)
using this:
f contour_integrable_on linepath a b +++ linepath b c +++ linepath c d

goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = contour_integral (linepath a b +++ linepath b c +++ linepath c d) f
[PROOF STEP]
by (simp add: valid_path_join has_contour_integral_integrable)
[PROOF STATE]
proof (state)
this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = contour_integral (linepath a b +++ linepath b c +++ linepath c d) f

goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = contour_integral (linepath a b +++ linepath b c +++ linepath c d) f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = contour_integral (linepath a b +++ linepath b c +++ linepath c d) f

goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i
[PROOF STEP]
using assms contour_integral_unique
[PROOF STATE]
proof (prove)
using this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = contour_integral (linepath a b +++ linepath b c +++ linepath c d) f
(f has_contour_integral i) (linepath a b +++ linepath b c +++ linepath c d)
(?f has_contour_integral ?i) ?g \<Longrightarrow> contour_integral ?g ?f = ?i

goal (1 subgoal):
 1. contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
contour_integral (linepath a b) f + contour_integral (linepath b c) f + contour_integral (linepath c d) f = i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma slength_sfoldl_aux: "sfoldl\<cdot>(\<Lambda> i _. i + 1)\<cdot>z\<cdot>xs = z + slength\<cdot>xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sfoldl\<cdot>(\<Lambda> i uu_. i + 1)\<cdot>z\<cdot>xs = z + slength\<cdot>xs
[PROOF STEP]
by (induct xs arbitrary: z) (simp_all add: ac_simps)


[STATEMENT]
lemma s_a: "$s^{m}_n = (1+i)^n * $a^{m}_n" if "m \<noteq> 0" for n m :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
have "(1+i)^n * $a^{m}_n = (\<Sum>k<n*m. (1+i)^n * ($v.^((k+1::nat)/m) / m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + i) ^ n * $a^{m}_n = (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m))
[PROOF STEP]
unfolding ann_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + i) ^ n * (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) / real m) = (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m))
[PROOF STEP]
using sum_distrib_left
[PROOF STATE]
proof (prove)
using this:
?r * sum ?f ?A = (\<Sum>n\<in>?A. ?r * ?f n)

goal (1 subgoal):
 1. (1 + i) ^ n * (\<Sum>k<n * m. $v .^ (real (k + 1) / real m) / real m) = (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(1 + i) ^ n * $a^{m}_n = (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m))

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + i) ^ n * $a^{m}_n = (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m))

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
have "\<dots> = (\<Sum>k<n*m. (1+i).^((n*m - Suc k)/m) / m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m)) = (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m)) = (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m)
[PROOF STEP]
have "\<And>k::nat. k < n*m \<Longrightarrow> (1+i)^n * ($v.^((k+1::nat)/m) / m) = (1+i).^((n*m - Suc k)/m) / m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < n * m \<Longrightarrow> (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m) = (1 + i) .^ (real (n * m - Suc k) / real m) / real m
[PROOF STEP]
unfolding v_pres_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < n * m \<Longrightarrow> (1 + i) ^ n * ((1 / (1 + i)) .^ (real (k + 1) / real m) / real m) = (1 + i) .^ (real (n * m - Suc k) / real m) / real m
[PROOF STEP]
apply (subst powr_realpow[THEN sym], simp add: v_futr_pos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < n * m \<Longrightarrow> (1 + i) .^ real n * ((1 / (1 + i)) .^ (real (k + 1) / real m) / real m) = (1 + i) .^ (real (n * m - Suc k) / real m) / real m
[PROOF STEP]
apply (subst inverse_powr, simp add: v_futr_pos)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < n * m \<Longrightarrow> (1 + i) .^ real n * ((1 + i) .^ - (real (k + 1) / real m) / real m) = (1 + i) .^ (real (n * m - Suc k) / real m) / real m
[PROOF STEP]
apply (subst times_divide_eq_right, subst powr_add[THEN sym], simp add: that)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. k < n * m \<Longrightarrow> (1 + i) .^ (real n - (1 + real k) / real m) = (1 + i) .^ (real (n * m - Suc k) / real m)
[PROOF STEP]
by (subst of_nat_diff, simp add: Suc_le_eq, simp add: diff_divide_distrib that)
[PROOF STATE]
proof (state)
this:
?k < n * m \<Longrightarrow> (1 + i) ^ n * ($v .^ (real (?k + 1) / real m) / real m) = (1 + i) .^ (real (n * m - Suc ?k) / real m) / real m

goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m)) = (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?k < n * m \<Longrightarrow> (1 + i) ^ n * ($v .^ (real (?k + 1) / real m) / real m) = (1 + i) .^ (real (n * m - Suc ?k) / real m) / real m

goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m)) = (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m)
[PROOF STEP]
by (meson lessThan_iff sum.cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m)) = (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m)) = (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m)

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. (1 + i) ^ n * ($v .^ (real (k + 1) / real m) / real m)) = (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m)

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
have "\<dots> = (\<Sum>k<n*m. (1+i).^(k/m) / m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m) = (\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m)
[PROOF STEP]
apply (subst atLeast0LessThan[THEN sym])+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m) = (\<Sum>k = 0..<n * m. (1 + i) .^ (real k / real m) / real m)
[PROOF STEP]
by (subst sum.atLeastLessThan_rev[THEN sym, of _ "n*m" 0, simplified add_0_right], simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m) = (\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m)

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. (1 + i) .^ (real (n * m - Suc k) / real m) / real m) = (\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m)

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
have "\<dots> = $s^{m}_n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m) = $s^{m}_n
[PROOF STEP]
unfolding acc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m) = (\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>k<n * m. (1 + i) .^ (real k / real m) / real m) = $s^{m}_n

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 + i) ^ n * $a^{m}_n = $s^{m}_n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1 + i) ^ n * $a^{m}_n = $s^{m}_n

goal (1 subgoal):
 1. $s^{m}_n = (1 + i) ^ n * $a^{m}_n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
$s^{m}_n = (1 + i) ^ n * $a^{m}_n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma surj_card_of_vimage:
assumes "surj f"
shows "|B| \<le>o |f -` B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |B| \<le>o |f -` B|
[PROOF STEP]
by (metis assms card_of_vimage subset_UNIV)


[STATEMENT]
lemma (in Ring) exact_im_sub_kern:"\<lbrakk>R module L; R module M; R module N;
             f \<in> mHom R L M; g \<in> mHom R M N; exact3 R L f M g N\<rbrakk> \<Longrightarrow>
           f ` (carrier L) \<subseteq> ker\<^bsub>M,N\<^esub> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module L; R module M; R module N; f \<in> mHom R L M; g \<in> mHom R M N; exact3 R L f M g N\<rbrakk> \<Longrightarrow> f ` carrier L \<subseteq> ker\<^bsub>M,N\<^esub> g
[PROOF STEP]
apply (simp add:exact3_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma max_eint_simps [simp]:
  "max (eint m) (eint n) = eint (max m n)"
  "max q \<infinity> = (\<infinity>::eint)"
  "max \<infinity> q = (\<infinity>::eint)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (eint m) (eint n) = eint (max m n) &&& max q \<infinity> = \<infinity> &&& max \<infinity> q = \<infinity>
[PROOF STEP]
by (simp_all add: max_def)


[STATEMENT]
lemma sel_r_eq_ldeep_s_if_valid_fwd:
  "\<lbrakk>r \<in> verts G; valid_tree t; directed_tree.forward (dir_tree_r r) (inorder t)\<rbrakk>
    \<Longrightarrow> sel_r r = ldeep_s match_sel (revorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<in> verts G; valid_tree t; directed_tree.forward (dir_tree_r r) (inorder t)\<rbrakk> \<Longrightarrow> sel_r r = ldeep_s match_sel (revorder t)
[PROOF STEP]
unfolding valid_tree_def distinct_relations_def inorder_eq_set[symmetric] revorder_eq_rev_inorder
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r \<in> verts G; set (inorder t) = verts G \<and> distinct (inorder t); directed_tree.forward (dir_tree_r r) (inorder t)\<rbrakk> \<Longrightarrow> sel_r r = ldeep_s match_sel (rev (inorder t))
[PROOF STEP]
using sel_r_eq_ldeep_s_if_dst_fwd_verts
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?r \<in> verts G; distinct ?xs; directed_tree.forward (dir_tree_r ?r) ?xs; set ?xs = verts G\<rbrakk> \<Longrightarrow> sel_r ?r = ldeep_s match_sel (rev ?xs)

goal (1 subgoal):
 1. \<lbrakk>r \<in> verts G; set (inorder t) = verts G \<and> distinct (inorder t); directed_tree.forward (dir_tree_r r) (inorder t)\<rbrakk> \<Longrightarrow> sel_r r = ldeep_s match_sel (rev (inorder t))
[PROOF STEP]
by blast


[STATEMENT]
lemma aadd_poss_pos:"\<lbrakk>(0::ant) < x; 0 \<le> y\<rbrakk> \<Longrightarrow> 0 < (x + y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x; 0 \<le> y\<rbrakk> \<Longrightarrow> 0 < x + y
[PROOF STEP]
apply (subst aadd_commute, rule aadd_pos_poss, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma mss_kadane_mid_sums: "mss_kadane xs = Max (mid_sums xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mss_kadane xs = Max (mid_sums xs)
[PROOF STEP]
unfolding mss_kadane_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kadane xs (0::'a) (0::'a) = Max (mid_sums xs)
[PROOF STEP]
using kadane Max_mid_sums_geq_0 Max_front_sums_leq_Max_mid_sums
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?cur \<le> ?m; (0::'a) \<le> ?m\<rbrakk> \<Longrightarrow> kadane ?xs ?cur ?m = max ?m (max (?cur + Max (front_sums ?xs)) (Max (mid_sums ?xs)))
(0::'a) \<le> Max (mid_sums ?xs)
Max (front_sums ?xs) \<le> Max (mid_sums ?xs)

goal (1 subgoal):
 1. kadane xs (0::'a) (0::'a) = Max (mid_sums xs)
[PROOF STEP]
by auto


[STATEMENT]
lemma word_and_mask_le_2pm1: "w AND mask n \<le> 2 ^ n - 1"
  for w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w AND mask n \<le> 2 ^ n - 1
[PROOF STEP]
by (simp add: mask_2pm1[symmetric] word_and_le1)


[STATEMENT]
lemma osum_minus_Id2:
  "r' \<le> Id \<Longrightarrow> (r +o r') - Id \<le> (map_prod Inl Inl ` (r - Id)) \<union> (Inl ` Field r \<times> Inr ` Field r')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r' \<subseteq> Id \<Longrightarrow> r +o r' - Id \<subseteq> map_prod Inl Inl ` (r - Id) \<union> Inl ` Field r \<times> Inr ` Field r'
[PROOF STEP]
unfolding osum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r' \<subseteq> Id \<Longrightarrow> map_prod Inl Inl ` r \<union> map_prod Inr Inr ` r' \<union> {(Inl a, Inr a') |a a'. a \<in> Field r \<and> a' \<in> Field r'} - Id \<subseteq> map_prod Inl Inl ` (r - Id) \<union> Inl ` Field r \<times> Inr ` Field r'
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_XD'_power: "fps_XD' a (b ^ n :: 'a :: idom fps) = of_nat n * b ^ (n - 1) * fps_XD' a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
 2. n \<noteq> 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
 2. n \<noteq> 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
have "b * fps_XD' a (b ^ n) = of_nat n * b ^ n * fps_XD' a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b * fps_XD' a (b ^ n) = of_nat n * b ^ n * fps_XD' a b
[PROOF STEP]
by (induction n) (simp_all add: fps_XD'_prod algebra_simps)
[PROOF STATE]
proof (state)
this:
b * fps_XD' a (b ^ n) = of_nat n * b ^ n * fps_XD' a b

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
 2. n \<noteq> 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b * fps_XD' a (b ^ n) = of_nat n * b ^ n * fps_XD' a b

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
 2. n \<noteq> 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
have "\<dots> = b * (of_nat n * b ^ (n - 1) * fps_XD' a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat n * b ^ n * fps_XD' a b = b * (of_nat n * b ^ (n - 1) * fps_XD' a b)
[PROOF STEP]
by (cases n) (simp_all add: algebra_simps)
[PROOF STATE]
proof (state)
this:
of_nat n * b ^ n * fps_XD' a b = b * (of_nat n * b ^ (n - 1) * fps_XD' a b)

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
 2. n \<noteq> 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
b * fps_XD' a (b ^ n) = b * (of_nat n * b ^ (n - 1) * fps_XD' a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b * fps_XD' a (b ^ n) = b * (of_nat n * b ^ (n - 1) * fps_XD' a b)

goal (1 subgoal):
 1. fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
b * fps_XD' a (b ^ n) = b * (of_nat n * b ^ (n - 1) * fps_XD' a b)
n \<noteq> 0

goal (1 subgoal):
 1. fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
by (subst (asm) mult_cancel_left) (auto simp: power_0_left)
[PROOF STATE]
proof (state)
this:
fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b

goal (1 subgoal):
 1. n = 0 \<Longrightarrow> fps_XD' a (b ^ n) = of_nat n * b ^ (n - 1) * fps_XD' a b
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma (in Ring) bilinear_l_add1:"\<lbrakk>R module M1; R module M2; R module N;
       m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2;
       bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow>
       f (m11 \<plusminus>\<^bsub>M1\<^esub> m12, m2) \<plusminus>\<^bsub>N\<^esub> -\<^sub>a\<^bsub>N\<^esub> (f (m11, m2) \<plusminus>\<^bsub>N\<^esub> (f (m12, m2))) = \<zero>\<^bsub>N\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow> f (m11 \<plusminus>\<^bsub>M1\<^esub> m12, m2) \<plusminus>\<^bsub>N\<^esub> -\<^sub>a\<^bsub>N\<^esub> (f (m11, m2) \<plusminus>\<^bsub>N\<^esub> f (m12, m2)) = \<zero>\<^bsub>N\<^esub>
[PROOF STEP]
apply (frule Module.module_is_ag[of N],
       frule Module.module_is_ag[of M1],
       subst aGroup.ag_eq_diffzero[of N, THEN sym], assumption+,
       frule_tac x = m11 and y = m12 in aGroup.ag_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M1; m11 \<plusminus>\<^bsub>M1\<^esub> m12 \<in> carrier M1\<rbrakk> \<Longrightarrow> f (m11 \<plusminus>\<^bsub>M1\<^esub> m12, m2) \<in> carrier N
 2. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M1\<rbrakk> \<Longrightarrow> f (m11, m2) \<plusminus>\<^bsub>N\<^esub> f (m12, m2) \<in> carrier N
 3. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M1\<rbrakk> \<Longrightarrow> f (m11 \<plusminus>\<^bsub>M1\<^esub> m12, m2) = f (m11, m2) \<plusminus>\<^bsub>N\<^esub> f (m12, m2)
[PROOF STEP]
apply (simp add:bilinear_mem,
       rule aGroup.ag_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M1\<rbrakk> \<Longrightarrow> f (m11, m2) \<in> carrier N
 2. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M1\<rbrakk> \<Longrightarrow> f (m12, m2) \<in> carrier N
 3. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N; aGroup N; aGroup M1\<rbrakk> \<Longrightarrow> f (m11 \<plusminus>\<^bsub>M1\<^esub> m12, m2) = f (m11, m2) \<plusminus>\<^bsub>N\<^esub> f (m12, m2)
[PROOF STEP]
apply ((simp add:bilinear_mem)+, simp add:bilinear_l_add)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma X4_ALL:
  shows "(\<forall>X''. P X'') \<longleftrightarrow> (\<forall>X''\<in>set ` set (subseqs [Xd1, Xd1', Xd2, Xd2']). P X'')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>X''. P X'') = (\<forall>X''\<in>set ` set (subseqs [Xd1, Xd1', Xd2, Xd2']). P X'')
[PROOF STEP]
using X4_pow
[PROOF STATE]
proof (prove)
using this:
?X \<in> set ` set (subseqs [Xd1, Xd1', Xd2, Xd2'])

goal (1 subgoal):
 1. (\<forall>X''. P X'') = (\<forall>X''\<in>set ` set (subseqs [Xd1, Xd1', Xd2, Xd2']). P X'')
[PROOF STEP]
by blast


[STATEMENT]
lemma osum_minus_Id:
  assumes r: "Total r" "\<not> (r \<le> Id)" and r': "Total r'" "\<not> (r' \<le> Id)"
  shows "(r +o r') - Id \<le> (r - Id) +o (r' - Id)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r +o r' - Id \<subseteq> (r - Id) +o (r' - Id)
[PROOF STEP]
unfolding osum_def Total_Id_Field[OF r] Total_Id_Field[OF r']
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_prod Inl Inl ` r \<union> map_prod Inr Inr ` r' \<union> {(Inl a, Inr a') |a a'. a \<in> Field (r - Id) \<and> a' \<in> Field (r' - Id)} - Id \<subseteq> map_prod Inl Inl ` (r - Id) \<union> map_prod Inr Inr ` (r' - Id) \<union> {(Inl a, Inr a') |a a'. a \<in> Field (r - Id) \<and> a' \<in> Field (r' - Id)}
[PROOF STEP]
by auto


[STATEMENT]
lemma de_lcm_pos[simp]:"de_lcm p > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < de_lcm p
[PROOF STEP]
apply (induct p)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. 0 < de_lcm 0
 2. \<And>a p. \<lbrakk>a \<noteq> 0 \<or> p \<noteq> 0; 0 < de_lcm p\<rbrakk> \<Longrightarrow> 0 < de_lcm (pCons a p)
[PROOF STEP]
apply (auto simp add:de_lcm_pCons)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a p. \<lbrakk>0 < de_lcm p; a \<noteq> 0\<rbrakk> \<Longrightarrow> 0 < lcm (snd (quotient_of a)) (de_lcm p)
 2. \<And>a p. \<lbrakk>0 < de_lcm p; p \<noteq> 0\<rbrakk> \<Longrightarrow> 0 < lcm (snd (quotient_of a)) (de_lcm p)
[PROOF STEP]
by (metis lcm_pos_int less_numeral_extra(3) quotient_of_denom_pos')+


[STATEMENT]
lemma genuine_roots_impl: "set (genuine_roots_impl p) = {z. poly (gr_poly p) z = 0}"
  "distinct (genuine_roots_impl p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (genuine_roots_impl p) = {z. poly (gr_poly p) z = (0::'a)} &&& distinct (genuine_roots_impl p)
[PROOF STEP]
unfolding genuine_roots_impl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (genuine_roots' initial_precision p) = {z. poly (gr_poly p) z = (0::'a)} &&& distinct (genuine_roots' initial_precision p)
[PROOF STEP]
by (transfer, auto simp: genuine_roots_def, transfer, auto)


[STATEMENT]
theorem ltl_FG_logical_characterization:
  "w \<Turnstile> F G \<phi> \<longleftrightarrow> (\<exists>\<G> \<subseteq> \<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w)"
  (is "?lhs \<longleftrightarrow> ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<Turnstile> F G \<phi> = (\<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. w \<Turnstile> F G \<phi> \<Longrightarrow> \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w
 2. \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w \<Longrightarrow> w \<Turnstile> F G \<phi>
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
w \<Turnstile> F G \<phi>

goal (2 subgoals):
 1. w \<Turnstile> F G \<phi> \<Longrightarrow> \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w
 2. \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w \<Longrightarrow> w \<Turnstile> F G \<phi>
[PROOF STEP]
hence "G \<phi> \<in> \<G>\<^sub>F\<^sub>G (F G \<phi>) w" and "\<G>\<^sub>F\<^sub>G (F G \<phi>) w \<subseteq> \<^bold>G (F G \<phi>)"
[PROOF STATE]
proof (prove)
using this:
w \<Turnstile> F G \<phi>

goal (1 subgoal):
 1. G \<phi> \<in> \<G>\<^sub>F\<^sub>G (F G \<phi>) w &&& \<G>\<^sub>F\<^sub>G (F G \<phi>) w \<subseteq> \<^bold>G (F G \<phi>)
[PROOF STEP]
unfolding \<G>\<^sub>F\<^sub>G_alt_def
[PROOF STATE]
proof (prove)
using this:
w \<Turnstile> F G \<phi>

goal (1 subgoal):
 1. G \<phi> \<in> {G \<psi> |\<psi>. G \<psi> \<in> \<^bold>G (F G \<phi>) \<and> w \<Turnstile> F G \<psi>} &&& {G \<psi> |\<psi>. G \<psi> \<in> \<^bold>G (F G \<phi>) \<and> w \<Turnstile> F G \<psi>} \<subseteq> \<^bold>G (F G \<phi>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
G \<phi> \<in> \<G>\<^sub>F\<^sub>G (F G \<phi>) w
\<G>\<^sub>F\<^sub>G (F G \<phi>) w \<subseteq> \<^bold>G (F G \<phi>)

goal (2 subgoals):
 1. w \<Turnstile> F G \<phi> \<Longrightarrow> \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w
 2. \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w \<Longrightarrow> w \<Turnstile> F G \<phi>
[PROOF STEP]
thus ?rhs
[PROOF STATE]
proof (prove)
using this:
G \<phi> \<in> \<G>\<^sub>F\<^sub>G (F G \<phi>) w
\<G>\<^sub>F\<^sub>G (F G \<phi>) w \<subseteq> \<^bold>G (F G \<phi>)

goal (1 subgoal):
 1. \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w
[PROOF STEP]
using closed_\<G>\<^sub>F\<^sub>G
[PROOF STATE]
proof (prove)
using this:
G \<phi> \<in> \<G>\<^sub>F\<^sub>G (F G \<phi>) w
\<G>\<^sub>F\<^sub>G (F G \<phi>) w \<subseteq> \<^bold>G (F G \<phi>)
closed (\<G>\<^sub>F\<^sub>G ?\<phi> ?w) ?w

goal (1 subgoal):
 1. \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w

goal (1 subgoal):
 1. \<exists>\<G>\<subseteq>\<^bold>G (F G \<phi>). G \<phi> \<in> \<G> \<and> closed \<G> w \<Longrightarrow> w \<Turnstile> F G \<phi>
[PROOF STEP]
qed (blast intro: closed_FG)


[STATEMENT]
lemma Ree_sum [simp]: "Ree (sum f S) = sum (\<lambda>x.  Ree(f x)) S"
  and Im1_sum [simp]: "Im1 (sum f S) = sum (\<lambda>x. Im1 (f x)) S"
  and Im2_sum [simp]: "Im2 (sum f S) = sum (\<lambda>x. Im2 (f x)) S"
  and Im3_sum [simp]: "Im3 (sum f S) = sum (\<lambda>x. Im3 (f x)) S"
  and Im4_sum [simp]: "Im4 (sum f S) = sum (\<lambda>x. Im4 (f x)) S"
  and Im5_sum [simp]: "Im5 (sum f S) = sum (\<lambda>x. Im5 (f x)) S"
  and Im6_sum [simp]: "Im6 (sum f S) = sum (\<lambda>x. Im6 (f x)) S"
  and Im7_sum [simp]: "Im7 (sum f S) = sum (\<lambda>x. Im7 (f x)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((Ree (sum f S) = (\<Sum>x\<in>S. Ree (f x)) &&& Im1 (sum f S) = (\<Sum>x\<in>S. Im1 (f x))) &&& Im2 (sum f S) = (\<Sum>x\<in>S. Im2 (f x)) &&& Im3 (sum f S) = (\<Sum>x\<in>S. Im3 (f x))) &&& (Im4 (sum f S) = (\<Sum>x\<in>S. Im4 (f x)) &&& Im5 (sum f S) = (\<Sum>x\<in>S. Im5 (f x))) &&& Im6 (sum f S) = (\<Sum>x\<in>S. Im6 (f x)) &&& Im7 (sum f S) = (\<Sum>x\<in>S. Im7 (f x))
[PROOF STEP]
by (induct S rule: infinite_finite_induct; simp)+


[STATEMENT]
lemma obj_isoD[dest]:
  assumes "a \<approx>\<^sub>o\<^sub>b\<^sub>j\<^bsub>\<CC>\<^esub> b"
  shows "\<exists>f. f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<approx>\<^sub>o\<^sub>b\<^sub>j\<^bsub>\<CC>\<^esub> b

goal (1 subgoal):
 1. \<exists>f. f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b
[PROOF STEP]
unfolding obj_iso_def
[PROOF STATE]
proof (prove)
using this:
Ex (is_iso_arr \<CC> a b)

goal (1 subgoal):
 1. \<exists>f. f : a \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> b
[PROOF STEP]
by auto


[STATEMENT]
lemma continuous_map_openin_preimage_eq:
   "continuous_map X Y f \<longleftrightarrow>
        f ` (topspace X) \<subseteq> topspace Y \<and> (\<forall>U. openin Y U \<longrightarrow> openin X (topspace X \<inter> f -` U))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map X Y f = (f ` topspace X \<subseteq> topspace Y \<and> (\<forall>U. openin Y U \<longrightarrow> openin X (topspace X \<inter> f -` U)))
[PROOF STEP]
by (auto simp: continuous_map_def vimage_def Int_def)


[STATEMENT]
lemma numeral_less_ereal_of_enat_iff[simp]: "numeral m < ereal_of_enat n \<longleftrightarrow> numeral m < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numeral m < ereal_of_enat n) = (numeral m < n)
[PROOF STEP]
by (cases n) auto


[STATEMENT]
lemma exists_bijective_linear_map_W_vec:
  assumes finite_P: "finite P"
      and u_desc_square_free: "u = (\<Prod>a\<in>P. a)"
      and P: "P \<subseteq> {q. irreducible q \<and> monic q}"
  shows "\<exists>f. linear_map class_ring W (module_vec TYPE('a mod_ring) (card P)) f
  \<and> bij_betw f (carrier W) (carrier_vec (card P)::'a mod_ring vec set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
let ?B="carrier_vec (card P)::'a mod_ring vec set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have u_not_0: "u \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<noteq> 0
[PROOF STEP]
using deg_u0 degree_0
[PROOF STATE]
proof (prove)
using this:
0 < degree u
degree 0 = 0

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

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
obtain m and n::nat where P_m: "P = m ` {i. i < n}" and inj_on_m: "inj_on m {i. i < n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>m n. \<lbrakk>P = m ` {i. i < n}; inj_on m {i. i < n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using finite_imp_nat_seg_image_inj_on[OF finite_P]
[PROOF STATE]
proof (prove)
using this:
\<exists>n f. P = f ` {i. i < n} \<and> inj_on f {i. i < n}

goal (1 subgoal):
 1. (\<And>m n. \<lbrakk>P = m ` {i. i < n}; inj_on m {i. i < n}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P = m ` {i. i < n}
inj_on m {i. i < n}

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
hence n: "n = card P"
[PROOF STATE]
proof (prove)
using this:
P = m ` {i. i < n}
inj_on m {i. i < n}

goal (1 subgoal):
 1. n = card P
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
n = card P

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have degree_prod: "degree (prod m {i. i < n}) = degree u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod m {i. i < n}) = degree u
[PROOF STEP]
by (metis P_m u_desc_square_free inj_on_m prod.reindex_cong)
[PROOF STATE]
proof (state)
this:
degree (prod m {i. i < n}) = degree u

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have not_zero: "\<forall>i\<in>{i. i < n}. m i \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{i. i < n}. m i \<noteq> 0
[PROOF STEP]
using P_m u_desc_square_free u_not_0
[PROOF STATE]
proof (prove)
using this:
P = m ` {i. i < n}
u = \<Prod>P
u \<noteq> 0

goal (1 subgoal):
 1. \<forall>i\<in>{i. i < n}. m i \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{i. i < n}. m i \<noteq> 0

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have deg_sum_eq: "(\<Sum>i\<in>{i. i < n}. degree (m i)) = degree u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i | i < n. degree (m i)) = degree u
[PROOF STEP]
by (metis degree_prod degree_prod_eq_sum_degree not_zero)
[PROOF STATE]
proof (state)
this:
(\<Sum>i | i < n. degree (m i)) = degree u

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have coprime_mi_mj:"\<forall>i\<in>{i. i < n}. \<forall>j\<in>{i. i < n}. i \<noteq> j \<longrightarrow> coprime (m i) (m j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{i. i < n}. \<forall>j\<in>{i. i < n}. i \<noteq> j \<longrightarrow> comm_monoid_mult_class.coprime (m i) (m j)
[PROOF STEP]
proof (rule+)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i \<in> {i. i < n}; j \<in> {i. i < n}; i \<noteq> j\<rbrakk> \<Longrightarrow> comm_monoid_mult_class.coprime (m i) (m j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i \<in> {i. i < n}; j \<in> {i. i < n}; i \<noteq> j\<rbrakk> \<Longrightarrow> comm_monoid_mult_class.coprime (m i) (m j)
[PROOF STEP]
assume i: "i \<in> {i. i < n}"
    and j: "j \<in> {i. i < n}" and ij: "i \<noteq> j"
[PROOF STATE]
proof (state)
this:
i \<in> {i. i < n}
j \<in> {i. i < n}
i \<noteq> j

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i \<in> {i. i < n}; j \<in> {i. i < n}; i \<noteq> j\<rbrakk> \<Longrightarrow> comm_monoid_mult_class.coprime (m i) (m j)
[PROOF STEP]
show "coprime (m i) (m j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_monoid_mult_class.coprime (m i) (m j)
[PROOF STEP]
proof (rule coprime_polynomial_factorization[OF P finite_P])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. m i \<in> P
 2. m j \<in> P
 3. m i \<noteq> m j
[PROOF STEP]
show "m i \<in> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m i \<in> P
[PROOF STEP]
using i P_m
[PROOF STATE]
proof (prove)
using this:
i \<in> {i. i < n}
P = m ` {i. i < n}

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

goal (2 subgoals):
 1. m j \<in> P
 2. m i \<noteq> m j
[PROOF STEP]
show "m j \<in> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m j \<in> P
[PROOF STEP]
using j P_m
[PROOF STATE]
proof (prove)
using this:
j \<in> {i. i < n}
P = m ` {i. i < n}

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

goal (1 subgoal):
 1. m i \<noteq> m j
[PROOF STEP]
show "m i \<noteq> m j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m i \<noteq> m j
[PROOF STEP]
using inj_on_m i ij j
[PROOF STATE]
proof (prove)
using this:
inj_on m {i. i < n}
i \<in> {i. i < n}
i \<noteq> j
j \<in> {i. i < n}

goal (1 subgoal):
 1. m i \<noteq> m j
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{i. i < n}. \<forall>y\<in>{i. i < n}. m x = m y \<longrightarrow> x = y
i \<in> {i. i < n}
i \<noteq> j
j \<in> {i. i < n}

goal (1 subgoal):
 1. m i \<noteq> m j
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
m i \<noteq> m j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
comm_monoid_mult_class.coprime (m i) (m j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{i. i < n}. \<forall>j\<in>{i. i < n}. i \<noteq> j \<longrightarrow> comm_monoid_mult_class.coprime (m i) (m j)

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
let ?f = "\<lambda>v. vec n (\<lambda>i. coeff (v mod (m i)) 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
interpret vec_VS: vectorspace class_ring "(module_vec TYPE('a mod_ring) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vectorspace class_ring (module_vec TYPE('a mod_ring) n)
[PROOF STEP]
by (rule VS_Connect.vec_vs)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
interpret linear_map class_ring W "(module_vec TYPE('a mod_ring) n)" ?f
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) n) (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0))
[PROOF STEP]
by (intro_locales, unfold mod_hom_axioms_def LinearCombinations.module_hom_def,
        auto simp add: vec_eq_iff module_vec_def mod_smult_left poly_mod_add_left)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have "linear_map class_ring W (module_vec TYPE('a mod_ring) n) ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) n) (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0))
[PROOF STEP]
by (intro_locales)
[PROOF STATE]
proof (state)
this:
linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) n) (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0))

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) n) (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0))

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have inj_f: "inj_on ?f (carrier W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}))
[PROOF STEP]
proof (rule Ke0_imp_inj, auto simp add: mod_hom.ker_def)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
 2. [0 ^ CARD('a) = 0] (mod u)
 3. vec n (\<lambda>i. 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>
[PROOF STEP]
show "[0 ^ CARD('a) = 0] (mod u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0 ^ CARD('a) = 0] (mod u)
[PROOF STEP]
by (simp add: cong_def zero_power)
[PROOF STATE]
proof (state)
this:
[0 ^ CARD('a) = 0] (mod u)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
 2. vec n (\<lambda>i. 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>
[PROOF STEP]
show "vec n (\<lambda>i. 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec n (\<lambda>i. 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>
[PROOF STEP]
by (auto simp add: module_vec_def)
[PROOF STATE]
proof (state)
this:
vec n (\<lambda>i. 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
assume x: "[x ^ CARD('a) = x] (mod u)" and deg_x: "degree x < degree u"
     and v: "vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>"
[PROOF STATE]
proof (state)
this:
[x ^ CARD('a) = x] (mod u)
degree x < degree u
vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
have cong_0: "\<forall>i\<in>{i. i < n}. [x = (\<lambda>i. 0) i] (mod m i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{i. i < n}. [x = 0] (mod m i)
[PROOF STEP]
proof (rule, unfold cong_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {i. i < n} \<Longrightarrow> x mod m i = 0 mod m i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {i. i < n} \<Longrightarrow> x mod m i = 0 mod m i
[PROOF STEP]
assume i: "i \<in> {i. i < n}"
[PROOF STATE]
proof (state)
this:
i \<in> {i. i < n}

goal (1 subgoal):
 1. \<And>i. i \<in> {i. i < n} \<Longrightarrow> x mod m i = 0 mod m i
[PROOF STEP]
have deg_x_mod_mi: "degree (x mod m i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (x mod m i) = 0
[PROOF STEP]
proof (rule degree_u_mod_irreducible\<^sub>d_factor_0[OF _ finite_P u_desc_square_free P])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> {v. [v ^ CARD('a) = v] (mod u)}
 2. m i \<in> P
[PROOF STEP]
show "x \<in> {v. [v ^ CARD('a) = v] (mod u)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {v. [v ^ CARD('a) = v] (mod u)}
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
[x ^ CARD('a) = x] (mod u)

goal (1 subgoal):
 1. x \<in> {v. [v ^ CARD('a) = v] (mod u)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {v. [v ^ CARD('a) = v] (mod u)}

goal (1 subgoal):
 1. m i \<in> P
[PROOF STEP]
show "m i \<in> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m i \<in> P
[PROOF STEP]
using P_m i
[PROOF STATE]
proof (prove)
using this:
P = m ` {i. i < n}
i \<in> {i. i < n}

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (x mod m i) = 0

goal (1 subgoal):
 1. \<And>i. i \<in> {i. i < n} \<Longrightarrow> x mod m i = 0 mod m i
[PROOF STEP]
thus "x mod m i = 0 mod m i"
[PROOF STATE]
proof (prove)
using this:
degree (x mod m i) = 0

goal (1 subgoal):
 1. x mod m i = 0 mod m i
[PROOF STEP]
using v
[PROOF STATE]
proof (prove)
using this:
degree (x mod m i) = 0
vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>

goal (1 subgoal):
 1. x mod m i = 0 mod m i
[PROOF STEP]
unfolding module_vec_def
[PROOF STATE]
proof (prove)
using this:
degree (x mod m i) = 0
vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>\<lparr>carrier = carrier_vec n, monoid.mult = undefined, one = undefined, zero = 0\<^sub>v n, add = (+), module.smult = (\<cdot>\<^sub>v)\<rparr>\<^esub>

goal (1 subgoal):
 1. x mod m i = 0 mod m i
[PROOF STEP]
by (auto, metis i leading_coeff_neq_0 mem_Collect_eq index_vec index_zero_vec(1))
[PROOF STATE]
proof (state)
this:
x mod m i = 0 mod m i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{i. i < n}. [x = 0] (mod m i)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{i. i < n}. [x = 0] (mod m i)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
have deg_x2: "degree x < (\<Sum>i\<in>{i. i < n}. degree (m i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree x < (\<Sum>i | i < n. degree (m i))
[PROOF STEP]
using deg_sum_eq deg_x
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i | i < n. degree (m i)) = degree u
degree x < degree u

goal (1 subgoal):
 1. degree x < (\<Sum>i | i < n. degree (m i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree x < (\<Sum>i | i < n. degree (m i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
degree x < (\<Sum>i | i < n. degree (m i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
have "\<forall>i\<in>{i. i < n}. [0 = (\<lambda>i. 0) i] (mod m i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{i. i < n}. [0 = 0] (mod m i)
[PROOF STEP]
by (auto simp add: cong_def)
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{i. i < n}. [0 = 0] (mod m i)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{i. i < n}. [0 = 0] (mod m i)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
have "degree 0 < (\<Sum>i\<in>{i. i < n}. degree (m i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree 0 < (\<Sum>i | i < n. degree (m i))
[PROOF STEP]
using degree_prod deg_sum_eq deg_u0
[PROOF STATE]
proof (prove)
using this:
degree (prod m {i. i < n}) = degree u
(\<Sum>i | i < n. degree (m i)) = degree u
0 < degree u

goal (1 subgoal):
 1. degree 0 < (\<Sum>i | i < n. degree (m i))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
degree 0 < (\<Sum>i | i < n. degree (m i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
degree 0 < (\<Sum>i | i < n. degree (m i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
have "\<exists>!x. degree x < (\<Sum>i\<in>{i. i < n}. degree (m i))
        \<and> (\<forall>i\<in>{i. i < n}. [x = (\<lambda>i. 0) i] (mod m i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!x. degree x < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [x = 0] (mod m i))
[PROOF STEP]
proof (rule chinese_remainder_unique_poly[OF not_zero])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i\<in>{i. i < n}. \<forall>j\<in>{i. i < n}. i \<noteq> j \<longrightarrow> algebraic_semidom_class.coprime (m i) (m j)
 2. 0 < degree (prod m {i. i < n})
[PROOF STEP]
show "0 < degree (prod m {i. i < n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < degree (prod m {i. i < n})
[PROOF STEP]
using deg_u0 degree_prod
[PROOF STATE]
proof (prove)
using this:
0 < degree u
degree (prod m {i. i < n}) = degree u

goal (1 subgoal):
 1. 0 < degree (prod m {i. i < n})
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < degree (prod m {i. i < n})

goal (1 subgoal):
 1. \<forall>i\<in>{i. i < n}. \<forall>j\<in>{i. i < n}. i \<noteq> j \<longrightarrow> algebraic_semidom_class.coprime (m i) (m j)
[PROOF STEP]
qed (insert coprime_mi_mj, auto)
[PROOF STATE]
proof (state)
this:
\<exists>!x. degree x < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [x = 0] (mod m i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>[x ^ CARD('a) = x] (mod u); degree x < degree u; vec n (\<lambda>i. coeff (x mod m i) 0) = \<zero>\<^bsub>module_vec TYPE('a mod_ring) n\<^esub>\<rbrakk> \<Longrightarrow> x = 0
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<in>{i. i < n}. [x = 0] (mod m i)
degree x < (\<Sum>i | i < n. degree (m i))
\<forall>i\<in>{i. i < n}. [0 = 0] (mod m i)
degree 0 < (\<Sum>i | i < n. degree (m i))
\<exists>!x. degree x < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [x = 0] (mod m i))
[PROOF STEP]
show "x = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{i. i < n}. [x = 0] (mod m i)
degree x < (\<Sum>i | i < n. degree (m i))
\<forall>i\<in>{i. i < n}. [0 = 0] (mod m i)
degree 0 < (\<Sum>i | i < n. degree (m i))
\<exists>!x. degree x < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [x = 0] (mod m i))

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}))

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}))

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
have "?f ` (carrier W) = ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) ` carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) = carrier_vec (card P)
[PROOF STEP]
proof (auto simp add: image_def)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>[xa ^ CARD('a) = xa] (mod u); degree xa < degree u\<rbrakk> \<Longrightarrow> n = card P
 2. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
fix xa
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. \<lbrakk>[xa ^ CARD('a) = xa] (mod u); degree xa < degree u\<rbrakk> \<Longrightarrow> n = card P
 2. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
show "n = card P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n = card P
[PROOF STEP]
by (auto simp add: n)
[PROOF STATE]
proof (state)
this:
n = card P

goal (1 subgoal):
 1. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
fix x::"'a mod_ring vec"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
assume x: "x \<in> carrier_vec (card P)"
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec (card P)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
have " \<exists>!v. degree v < (\<Sum>i\<in>{i. i < n}. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [v = (\<lambda>i. [:x $ i:]) i] (mod m i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!v. degree v < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i))
[PROOF STEP]
proof (rule chinese_remainder_unique_poly[OF not_zero])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i\<in>{i. i < n}. \<forall>j\<in>{i. i < n}. i \<noteq> j \<longrightarrow> algebraic_semidom_class.coprime (m i) (m j)
 2. 0 < degree (prod m {i. i < n})
[PROOF STEP]
show "0 < degree (prod m {i. i < n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < degree (prod m {i. i < n})
[PROOF STEP]
using deg_u0 degree_prod
[PROOF STATE]
proof (prove)
using this:
0 < degree u
degree (prod m {i. i < n}) = degree u

goal (1 subgoal):
 1. 0 < degree (prod m {i. i < n})
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
0 < degree (prod m {i. i < n})

goal (1 subgoal):
 1. \<forall>i\<in>{i. i < n}. \<forall>j\<in>{i. i < n}. i \<noteq> j \<longrightarrow> algebraic_semidom_class.coprime (m i) (m j)
[PROOF STEP]
qed (insert coprime_mi_mj, auto)
[PROOF STATE]
proof (state)
this:
\<exists>!v. degree v < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i))

goal (1 subgoal):
 1. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>!v. degree v < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i))
[PROOF STEP]
obtain v where deg_v: "degree v < (\<Sum>i\<in>{i. i < n}. degree (m i))"
      and v_x_cong: "(\<forall>i \<in> {i. i < n}. [v = (\<lambda>i. [:x $ i:]) i] (mod m i))"
[PROOF STATE]
proof (prove)
using this:
\<exists>!v. degree v < (\<Sum>i | i < n. degree (m i)) \<and> (\<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i))

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>degree v < (\<Sum>i | i < n. degree (m i)); \<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree v < (\<Sum>i | i < n. degree (m i))
\<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i)

goal (1 subgoal):
 1. \<And>x. x \<in> carrier_vec (card P) \<Longrightarrow> \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
show "\<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u
      \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)
[PROOF STEP]
proof (rule exI[of _ v], auto)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. [v ^ CARD('a) = v] (mod u)
 2. degree v < degree u
 3. x = vec n (\<lambda>i. coeff (v mod m i) 0)
[PROOF STEP]
show v: "[v ^ CARD('a) = v] (mod u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [v ^ CARD('a) = v] (mod u)
[PROOF STEP]
proof (unfold u_desc_square_free, rule coprime_cong_mult_factorization_poly[OF finite_P], auto)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> irreducible x
 2. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 3. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> irreducible x
 2. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 3. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
assume y: "y \<in> P"
[PROOF STATE]
proof (state)
this:
y \<in> P

goal (3 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> irreducible x
 2. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 3. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
thus "irreducible y"
[PROOF STATE]
proof (prove)
using this:
y \<in> P

goal (1 subgoal):
 1. irreducible y
[PROOF STEP]
using P
[PROOF STATE]
proof (prove)
using this:
y \<in> P
P \<subseteq> {q. irreducible q \<and> monic q}

goal (1 subgoal):
 1. irreducible y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
irreducible y

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
obtain i where i: "i \<in> {i. i < n}" and mi: "y = m i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> {i. i < n}; y = m i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using P_m y
[PROOF STATE]
proof (prove)
using this:
P = m ` {i. i < n}
y \<in> P

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i \<in> {i. i < n}; y = m i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
i \<in> {i. i < n}
y = m i

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
have "irreducible (m i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible (m i)
[PROOF STEP]
using i P_m P
[PROOF STATE]
proof (prove)
using this:
i \<in> {i. i < n}
P = m ` {i. i < n}
P \<subseteq> {q. irreducible q \<and> monic q}

goal (1 subgoal):
 1. irreducible (m i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
irreducible (m i)

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
irreducible (m i)

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
have "[v = [:x $ i:]] (mod m i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [v = [:x $ i:]] (mod m i)
[PROOF STEP]
using v_x_cong i
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i)
i \<in> {i. i < n}

goal (1 subgoal):
 1. [v = [:x $ i:]] (mod m i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[v = [:x $ i:]] (mod m i)

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
irreducible (m i)
[v = [:x $ i:]] (mod m i)
[PROOF STEP]
have v_mi_eq_xi: "v mod m i = [:x $ i:]"
[PROOF STATE]
proof (prove)
using this:
irreducible (m i)
[v = [:x $ i:]] (mod m i)

goal (1 subgoal):
 1. v mod m i = [:x $ i:]
[PROOF STEP]
by (auto simp: cong_def intro!: mod_poly_less)
[PROOF STATE]
proof (state)
this:
v mod m i = [:x $ i:]

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
have xi_pow_xi: "[:x $ i:]^CARD('a) = [:x $ i:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:x $ i:] ^ CARD('a) = [:x $ i:]
[PROOF STEP]
by (simp add: poly_const_pow)
[PROOF STATE]
proof (state)
this:
[:x $ i:] ^ CARD('a) = [:x $ i:]

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
hence "(v mod m i)^CARD('a) = v mod m i"
[PROOF STATE]
proof (prove)
using this:
[:x $ i:] ^ CARD('a) = [:x $ i:]

goal (1 subgoal):
 1. (v mod m i) ^ CARD('a) = v mod m i
[PROOF STEP]
using v_mi_eq_xi
[PROOF STATE]
proof (prove)
using this:
[:x $ i:] ^ CARD('a) = [:x $ i:]
v mod m i = [:x $ i:]

goal (1 subgoal):
 1. (v mod m i) ^ CARD('a) = v mod m i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(v mod m i) ^ CARD('a) = v mod m i

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
hence "(v mod m i)^CARD('a) = (v^CARD('a) mod m i)"
[PROOF STATE]
proof (prove)
using this:
(v mod m i) ^ CARD('a) = v mod m i

goal (1 subgoal):
 1. (v mod m i) ^ CARD('a) = v ^ CARD('a) mod m i
[PROOF STEP]
by (metis mod_mod_trivial power_mod)
[PROOF STATE]
proof (state)
this:
(v mod m i) ^ CARD('a) = v ^ CARD('a) mod m i

goal (2 subgoals):
 1. \<And>x. x \<in> P \<Longrightarrow> [v ^ CARD('a) = v] (mod x)
 2. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
thus "[v ^ CARD('a) = v] (mod y)"
[PROOF STATE]
proof (prove)
using this:
(v mod m i) ^ CARD('a) = v ^ CARD('a) mod m i

goal (1 subgoal):
 1. [v ^ CARD('a) = v] (mod y)
[PROOF STEP]
unfolding mi cong_def v_mi_eq_xi xi_pow_xi
[PROOF STATE]
proof (prove)
using this:
[:x $ i:] = v ^ CARD('a) mod m i

goal (1 subgoal):
 1. v ^ CARD('a) mod m i = [:x $ i:]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[v ^ CARD('a) = v] (mod y)

goal (1 subgoal):
 1. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
fix p1 p2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
assume "p1 \<in> P" and "p2 \<in> P" and "p1 \<noteq> p2"
[PROOF STATE]
proof (state)
this:
p1 \<in> P
p2 \<in> P
p1 \<noteq> p2

goal (1 subgoal):
 1. \<And>p1 p2. \<lbrakk>p1 \<in> P; p2 \<in> P; p1 \<noteq> p2\<rbrakk> \<Longrightarrow> algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p1 \<in> P
p2 \<in> P
p1 \<noteq> p2
[PROOF STEP]
show "Rings.coprime p1 p2"
[PROOF STATE]
proof (prove)
using this:
p1 \<in> P
p2 \<in> P
p1 \<noteq> p2

goal (1 subgoal):
 1. algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
using coprime_polynomial_factorization[OF P finite_P]
[PROOF STATE]
proof (prove)
using this:
p1 \<in> P
p2 \<in> P
p1 \<noteq> p2
\<lbrakk>?a1.0 \<in> P; ?a2.0 \<in> P; ?a1.0 \<noteq> ?a2.0\<rbrakk> \<Longrightarrow> comm_monoid_mult_class.coprime ?a1.0 ?a2.0

goal (1 subgoal):
 1. algebraic_semidom_class.coprime p1 p2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
algebraic_semidom_class.coprime p1 p2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
[v ^ CARD('a) = v] (mod u)

goal (2 subgoals):
 1. degree v < degree u
 2. x = vec n (\<lambda>i. coeff (v mod m i) 0)
[PROOF STEP]
show "degree v < degree u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree v < degree u
[PROOF STEP]
using deg_v deg_sum_eq degree_prod
[PROOF STATE]
proof (prove)
using this:
degree v < (\<Sum>i | i < n. degree (m i))
(\<Sum>i | i < n. degree (m i)) = degree u
degree (prod m {i. i < n}) = degree u

goal (1 subgoal):
 1. degree v < degree u
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
degree v < degree u

goal (1 subgoal):
 1. x = vec n (\<lambda>i. coeff (v mod m i) 0)
[PROOF STEP]
show "x = vec n (\<lambda>i. coeff (v mod m i) 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = vec n (\<lambda>i. coeff (v mod m i) 0)
[PROOF STEP]
proof (unfold vec_eq_iff, rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_vec x = dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0))
 2. \<forall>i<dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0)). x $ i = vec n (\<lambda>i. coeff (v mod m i) 0) $ i
[PROOF STEP]
show "dim_vec x = dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec x = dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0))
[PROOF STEP]
using x n
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier_vec (card P)
n = card P

goal (1 subgoal):
 1. dim_vec x = dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec x = dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0))

goal (1 subgoal):
 1. \<forall>i<dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0)). x $ i = vec n (\<lambda>i. coeff (v mod m i) 0) $ i
[PROOF STEP]
show "\<forall>i<dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0)). x $ i = vec n (\<lambda>i. coeff (v mod m i) 0) $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0)). x $ i = vec n (\<lambda>i. coeff (v mod m i) 0) $ i
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
assume i: "i < n"
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
have deg_mi: "irreducible (m i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible (m i)
[PROOF STEP]
using i P_m P
[PROOF STATE]
proof (prove)
using this:
i < n
P = m ` {i. i < n}
P \<subseteq> {q. irreducible q \<and> monic q}

goal (1 subgoal):
 1. irreducible (m i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
irreducible (m i)

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
have deg_v_mi: "degree (v mod m i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (v mod m i) = 0
[PROOF STEP]
proof (rule degree_u_mod_irreducible\<^sub>d_factor_0[OF _ finite_P u_desc_square_free P])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. v \<in> {v. [v ^ CARD('a) = v] (mod u)}
 2. m i \<in> P
[PROOF STEP]
show "v \<in> {v. [v ^ CARD('a) = v] (mod u)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> {v. [v ^ CARD('a) = v] (mod u)}
[PROOF STEP]
using v
[PROOF STATE]
proof (prove)
using this:
[v ^ CARD('a) = v] (mod u)

goal (1 subgoal):
 1. v \<in> {v. [v ^ CARD('a) = v] (mod u)}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
v \<in> {v. [v ^ CARD('a) = v] (mod u)}

goal (1 subgoal):
 1. m i \<in> P
[PROOF STEP]
show "m i \<in> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m i \<in> P
[PROOF STEP]
using P_m i
[PROOF STATE]
proof (prove)
using this:
P = m ` {i. i < n}
i < n

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (v mod m i) = 0

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
have "v mod m i = [:x $ i:] mod m i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v mod m i = [:x $ i:] mod m i
[PROOF STEP]
using v_x_cong i
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{i. i < n}. [v = [:x $ i:]] (mod m i)
i < n

goal (1 subgoal):
 1. v mod m i = [:x $ i:] mod m i
[PROOF STEP]
unfolding cong_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{i. i < n}. v mod m i = [:x $ i:] mod m i
i < n

goal (1 subgoal):
 1. v mod m i = [:x $ i:] mod m i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v mod m i = [:x $ i:] mod m i

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v mod m i = [:x $ i:] mod m i

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
have "... = [:x $ i:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:x $ i:] mod m i = [:x $ i:]
[PROOF STEP]
using deg_mi
[PROOF STATE]
proof (prove)
using this:
irreducible (m i)

goal (1 subgoal):
 1. [:x $ i:] mod m i = [:x $ i:]
[PROOF STEP]
by (auto intro!: mod_poly_less)
[PROOF STATE]
proof (state)
this:
[:x $ i:] mod m i = [:x $ i:]

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> x $ i = coeff (v mod m i) 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
v mod m i = [:x $ i:]
[PROOF STEP]
show "x $ i = coeff (v mod m i) 0"
[PROOF STATE]
proof (prove)
using this:
v mod m i = [:x $ i:]

goal (1 subgoal):
 1. x $ i = coeff (v mod m i) 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x $ i = coeff (v mod m i) 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<dim_vec (vec n (\<lambda>i. coeff (v mod m i) 0)). x $ i = vec n (\<lambda>i. coeff (v mod m i) 0) $ i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = vec n (\<lambda>i. coeff (v mod m i) 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>xa. [xa ^ CARD('a) = xa] (mod u) \<and> degree xa < degree u \<and> x = vec n (\<lambda>i. coeff (xa mod m i) 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) ` carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) = carrier_vec (card P)

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) n) (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0))
inj_on (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}))
(\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) ` carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) = carrier_vec (card P)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) n) (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0))
inj_on (\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}))
(\<lambda>v. vec n (\<lambda>i. coeff (v mod m i) 0)) ` carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) = carrier_vec (card P)

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))
[PROOF STEP]
unfolding bij_betw_def n
[PROOF STATE]
proof (prove)
using this:
linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) (\<lambda>v. vec (card P) (\<lambda>i. coeff (v mod m i) 0))
inj_on (\<lambda>v. vec (card P) (\<lambda>i. coeff (v mod m i) 0)) (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}))
(\<lambda>v. vec (card P) (\<lambda>i. coeff (v mod m i) 0)) ` carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) = carrier_vec (card P)

goal (1 subgoal):
 1. \<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> inj_on f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) \<and> f ` carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) = carrier_vec (card P)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>f. linear_map class_ring (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u}) (module_vec TYPE('a mod_ring) (card P)) f \<and> bij_betw f (carrier (vector_space_poly.vs {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u})) (carrier_vec (card P))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smooth_on_basis_comp_inv: "smooth_on {x. (x + (1 - x \<bullet> a) *\<^sub>R a) \<bullet> b \<noteq> 0} (chart_basis b \<circ> chart_basis_inv a)"
  if [transfer_rule]: "a \<in> Basis" "b \<in> Basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smooth_on {x. (x + (1 - x \<bullet> a) *\<^sub>R a) \<bullet> b \<noteq> 0} (chart_basis b \<circ> chart_basis_inv a)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smooth_on {x. (x + (1 - x \<bullet> a) *\<^sub>R a) \<bullet> b \<noteq> 0} (chart_basis_nonzero b \<circ> chart_basis_inv_nonzero a)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smooth_on {x. (x + (1 - x \<bullet> a) *\<^sub>R a) \<bullet> b \<noteq> 0} ((\<lambda>(x, c). (x + (c - x \<bullet> b) *\<^sub>R b) /\<^sub>R (x \<bullet> b)) \<circ> (\<lambda>x. (x + (1 - x \<bullet> a) *\<^sub>R a, x \<bullet> a)))
[PROOF STEP]
by (auto intro!: smooth_on_add smooth_on_scaleR smooth_on_minus smooth_on_inner smooth_on_inverse
    smooth_on_mult open_Collect_neq continuous_intros simp: o_def algebra_simps inner_Basis)


[STATEMENT]
lemma coclop_dual: "(coclop::('a::order_with_dual \<Rightarrow> 'a) \<Rightarrow> bool) = clop \<circ> \<partial>\<^sub>F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coclop = clop \<circ> \<partial>\<^sub>F
[PROOF STEP]
unfolding coclop_def clop_def id_def mono_def map_dual_def comp_def fun_eq_iff le_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. ((\<forall>xa. x xa \<le> xa) \<and> (\<forall>xa y. xa \<le> y \<longrightarrow> x xa \<le> x y) \<and> (\<forall>xa. x xa \<le> x (x xa))) = ((\<forall>xa. xa \<le> \<partial> (x (\<partial> xa))) \<and> (\<forall>xa y. xa \<le> y \<longrightarrow> \<partial> (x (\<partial> xa)) \<le> \<partial> (x (\<partial> y))) \<and> (\<forall>xa. \<partial> (x (\<partial> (\<partial> (x (\<partial> xa))))) \<le> \<partial> (x (\<partial> xa))))
[PROOF STEP]
by (metis invol_dual_var ord_dual)


[STATEMENT]
lemma extendLevel_Nsteps:
  "\<lbrakk>sset belowN = {\<phi>. max_depth \<phi> < n}; sset N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow>
  \<exists>belowNext Next. (extendLevel ^^ m) (belowN, N) = (belowNext, Next) \<and>
     sset belowNext = {\<phi>. max_depth \<phi> < n + m} \<and> sset Next = {\<phi>. max_depth \<phi> = n + m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + m}
[PROOF STEP]
proof (induction m arbitrary: belowN N n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>belowN N n. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ 0) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + 0} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + 0}
 2. \<And>m belowN N n. \<lbrakk>\<And>belowN N n. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + m}; i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ Suc m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + Suc m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + Suc m}
[PROOF STEP]
case (Suc m)
[PROOF STATE]
proof (state)
this:
\<lbrakk>i.R ?belowN = {\<phi>. max_depth \<phi> < ?n}; i.R ?N = {\<phi>. max_depth \<phi> = ?n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ m) (?belowN, ?N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < ?n + m} \<and> i.R Next = {\<phi>. max_depth \<phi> = ?n + m}
i.R belowN = {\<phi>. max_depth \<phi> < n}
i.R N = {\<phi>. max_depth \<phi> = n}

goal (2 subgoals):
 1. \<And>belowN N n. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ 0) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + 0} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + 0}
 2. \<And>m belowN N n. \<lbrakk>\<And>belowN N n. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + m}; i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ Suc m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + Suc m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + Suc m}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>i.R ?belowN = {\<phi>. max_depth \<phi> < ?n}; i.R ?N = {\<phi>. max_depth \<phi> = ?n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ m) (?belowN, ?N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < ?n + m} \<and> i.R Next = {\<phi>. max_depth \<phi> = ?n + m}
i.R belowN = {\<phi>. max_depth \<phi> < n}
i.R N = {\<phi>. max_depth \<phi> = n}
[PROOF STEP]
obtain belowNext Next where "(extendLevel ^^ m) (belowN, N) = (belowNext, Next)"
    "sset belowNext = {\<phi>. max_depth \<phi> < n + m}" "sset Next = {\<phi>. max_depth \<phi> = n + m}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i.R ?belowN = {\<phi>. max_depth \<phi> < ?n}; i.R ?N = {\<phi>. max_depth \<phi> = ?n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ m) (?belowN, ?N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < ?n + m} \<and> i.R Next = {\<phi>. max_depth \<phi> = ?n + m}
i.R belowN = {\<phi>. max_depth \<phi> < n}
i.R N = {\<phi>. max_depth \<phi> = n}

goal (1 subgoal):
 1. (\<And>belowNext Next. \<lbrakk>(extendLevel ^^ m) (belowN, N) = (belowNext, Next); i.R belowNext = {\<phi>. max_depth \<phi> < n + m}; i.R Next = {\<phi>. max_depth \<phi> = n + m}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(extendLevel ^^ m) (belowN, N) = (belowNext, Next)
i.R belowNext = {\<phi>. max_depth \<phi> < n + m}
i.R Next = {\<phi>. max_depth \<phi> = n + m}

goal (2 subgoals):
 1. \<And>belowN N n. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ 0) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + 0} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + 0}
 2. \<And>m belowN N n. \<lbrakk>\<And>belowN N n. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + m}; i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ Suc m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + Suc m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + Suc m}
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
(extendLevel ^^ m) (belowN, N) = (belowNext, Next)
i.R belowNext = {\<phi>. max_depth \<phi> < n + m}
i.R Next = {\<phi>. max_depth \<phi> = n + m}

goal (1 subgoal):
 1. \<exists>belowNext Next. (extendLevel ^^ Suc m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + Suc m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + Suc m}
[PROOF STEP]
unfolding funpow.simps o_apply add_Suc_right
[PROOF STATE]
proof (prove)
using this:
(extendLevel ^^ m) (belowN, N) = (belowNext, Next)
i.R belowNext = {\<phi>. max_depth \<phi> < n + m}
i.R Next = {\<phi>. max_depth \<phi> = n + m}

goal (1 subgoal):
 1. \<exists>belowNext Next. extendLevel ((extendLevel ^^ m) (belowN, N)) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < Suc (n + m)} \<and> i.R Next = {\<phi>. max_depth \<phi> = Suc (n + m)}
[PROOF STEP]
by (intro extendLevel_step[of belowNext _ Next])
[PROOF STATE]
proof (state)
this:
\<exists>belowNext Next. (extendLevel ^^ Suc m) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + Suc m} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + Suc m}

goal (1 subgoal):
 1. \<And>belowN N n. \<lbrakk>i.R belowN = {\<phi>. max_depth \<phi> < n}; i.R N = {\<phi>. max_depth \<phi> = n}\<rbrakk> \<Longrightarrow> \<exists>belowNext Next. (extendLevel ^^ 0) (belowN, N) = (belowNext, Next) \<and> i.R belowNext = {\<phi>. max_depth \<phi> < n + 0} \<and> i.R Next = {\<phi>. max_depth \<phi> = n + 0}
[PROOF STEP]
qed simp


[STATEMENT]
theorem code_blue_dfs_correct':
  assumes G: "b_graph G" "finite ((g_E G)\<^sup>* `` g_V0 G)"
  assumes REL: "(Gi,G)\<in>bg_impl_rel_ext unit_rel Id"
  shows "case code_blue_dfs Gi of
      None \<Rightarrow> \<forall>prpl. \<not>b_graph.is_lasso_prpl G prpl
    | Some L \<Rightarrow> b_graph.is_lasso_prpl G L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. case code_blue_dfs Gi of None \<Rightarrow> \<forall>prpl. \<not> b_graph.is_lasso_prpl G prpl | Some L \<Rightarrow> b_graph.is_lasso_prpl G L
[PROOF STEP]
using code_blue_dfs_correct[OF G REL]
[PROOF STATE]
proof (prove)
using this:
RETURN (code_blue_dfs Gi) \<le> SPEC (\<lambda>r. case r of None \<Rightarrow> \<forall>prpl. \<not> b_graph.is_lasso_prpl G prpl | Some L \<Rightarrow> b_graph.is_lasso_prpl G L)

goal (1 subgoal):
 1. case code_blue_dfs Gi of None \<Rightarrow> \<forall>prpl. \<not> b_graph.is_lasso_prpl G prpl | Some L \<Rightarrow> b_graph.is_lasso_prpl G L
[PROOF STEP]
by simp