[STATEMENT]
lemma nn_integral_prod_Pi_pmf:
  assumes "finite A"
  shows   "nn_integral (Pi_pmf A dflt p) (\<lambda>y. \<Prod>x\<in>A. f x (y x)) = (\<Prod>x\<in>A. nn_integral (p x) (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>A. f x (y x)) \<partial>measure_pmf (Pi_pmf A dflt p) = (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>A. f x (y x)) \<partial>measure_pmf (Pi_pmf A dflt p) = (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
proof (induction rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
case (insert x A)
[PROOF STATE]
proof (state)
this:
finite A
x \<notin> A
\<integral>\<^sup>+ y. (\<Prod>x\<in>A. f x (y x)) \<partial>measure_pmf (Pi_pmf A dflt p) = (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x))

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
have "nn_integral (Pi_pmf (insert x A) dflt p) (\<lambda>y. \<Prod>z\<in>insert x A. f z (y z)) =
          (\<integral>\<^sup>+a. \<integral>\<^sup>+b. f x a * (\<Prod>z\<in>A. f z (if z = x then a else b z)) \<partial>Pi_pmf A dflt p \<partial>p x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ y. (\<Prod>z\<in>insert x A. f z (y z)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = \<integral>\<^sup>+ a. \<integral>\<^sup>+ b. f x a * (\<Prod>z\<in>A. f z (if z = x then a else b z)) \<partial>measure_pmf (Pi_pmf A dflt p) \<partial>measure_pmf (p x)
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A
\<integral>\<^sup>+ y. (\<Prod>x\<in>A. f x (y x)) \<partial>measure_pmf (Pi_pmf A dflt p) = (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x))

goal (1 subgoal):
 1. \<integral>\<^sup>+ y. (\<Prod>z\<in>insert x A. f z (y z)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = \<integral>\<^sup>+ a. \<integral>\<^sup>+ b. f x a * (\<Prod>z\<in>A. f z (if z = x then a else b z)) \<partial>measure_pmf (Pi_pmf A dflt p) \<partial>measure_pmf (p x)
[PROOF STEP]
by (auto simp: Pi_pmf_insert case_prod_unfold nn_integral_pair_pmf' cong: if_cong)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ y. (\<Prod>z\<in>insert x A. f z (y z)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = \<integral>\<^sup>+ a. \<integral>\<^sup>+ b. f x a * (\<Prod>z\<in>A. f z (if z = x then a else b z)) \<partial>measure_pmf (Pi_pmf A dflt p) \<partial>measure_pmf (p x)

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ y. (\<Prod>z\<in>insert x A. f z (y z)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = \<integral>\<^sup>+ a. \<integral>\<^sup>+ b. f x a * (\<Prod>z\<in>A. f z (if z = x then a else b z)) \<partial>measure_pmf (Pi_pmf A dflt p) \<partial>measure_pmf (p x)

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
have "(\<lambda>a b. \<Prod>z\<in>A. f z (if z = x then a else b z)) = (\<lambda>a b. \<Prod>z\<in>A. f z (b z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>a b. \<Prod>z\<in>A. f z (if z = x then a else b z)) = (\<lambda>a b. \<Prod>z\<in>A. f z (b z))
[PROOF STEP]
by (intro ext prod.cong) (use insert.hyps in auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>a b. \<Prod>z\<in>A. f z (if z = x then a else b z)) = (\<lambda>a b. \<Prod>z\<in>A. f z (b z))

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>a b. \<Prod>z\<in>A. f z (if z = x then a else b z)) = (\<lambda>a b. \<Prod>z\<in>A. f z (b z))

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
have "(\<integral>\<^sup>+a. \<integral>\<^sup>+b. f x a * (\<Prod>z\<in>A. f z (b z)) \<partial>Pi_pmf A dflt p \<partial>p x) =
             (\<integral>\<^sup>+y. f x y \<partial>(p x)) * (\<integral>\<^sup>+y. (\<Prod>z\<in>A. f z (y z)) \<partial>(Pi_pmf A dflt p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ a. \<integral>\<^sup>+ b. f x a * (\<Prod>z\<in>A. f z (b z)) \<partial>measure_pmf (Pi_pmf A dflt p) \<partial>measure_pmf (p x) = integral\<^sup>N (measure_pmf (p x)) (f x) * \<integral>\<^sup>+ y. (\<Prod>z\<in>A. f z (y z)) \<partial>measure_pmf (Pi_pmf A dflt p)
[PROOF STEP]
by (simp add: nn_integral_multc nn_integral_cmult)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ a. \<integral>\<^sup>+ b. f x a * (\<Prod>z\<in>A. f z (b z)) \<partial>measure_pmf (Pi_pmf A dflt p) \<partial>measure_pmf (p x) = integral\<^sup>N (measure_pmf (p x)) (f x) * \<integral>\<^sup>+ y. (\<Prod>z\<in>A. f z (y z)) \<partial>measure_pmf (Pi_pmf A dflt p)

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ a. \<integral>\<^sup>+ b. f x a * (\<Prod>z\<in>A. f z (b z)) \<partial>measure_pmf (Pi_pmf A dflt p) \<partial>measure_pmf (p x) = integral\<^sup>N (measure_pmf (p x)) (f x) * \<integral>\<^sup>+ y. (\<Prod>z\<in>A. f z (y z)) \<partial>measure_pmf (Pi_pmf A dflt p)

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
have "(\<integral>\<^sup>+y. (\<Prod>z\<in>A. f z (y z)) \<partial>(Pi_pmf A dflt p)) = (\<Prod>x\<in>A. nn_integral (p x) (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ y. (\<Prod>z\<in>A. f z (y z)) \<partial>measure_pmf (Pi_pmf A dflt p) = (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
by (rule insert.IH)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ y. (\<Prod>z\<in>A. f z (y z)) \<partial>measure_pmf (Pi_pmf A dflt p) = (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x))

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ y. (\<Prod>z\<in>A. f z (y z)) \<partial>measure_pmf (Pi_pmf A dflt p) = (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x))

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
have "(\<integral>\<^sup>+y. f x y \<partial>(p x)) * \<dots> = (\<Prod>x\<in>insert x A. nn_integral (p x) (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (p x)) (f x) * (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x)) = (\<Prod>x\<in>insert x A. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
finite A
x \<notin> A

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (p x)) (f x) * (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x)) = (\<Prod>x\<in>insert x A. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (p x)) (f x) * (\<Prod>x\<in>A. integral\<^sup>N (measure_pmf (p x)) (f x)) = (\<Prod>x\<in>insert x A. integral\<^sup>N (measure_pmf (p x)) (f x))

goal (2 subgoals):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<integral>\<^sup>+ y. (\<Prod>x\<in>F. f x (y x)) \<partial>measure_pmf (Pi_pmf F dflt p) = (\<Prod>x\<in>F. integral\<^sup>N (measure_pmf (p x)) (f x))\<rbrakk> \<Longrightarrow> \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x F. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x F) dflt p) = (\<Prod>x\<in>insert x F. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ y. (\<Prod>z\<in>insert x A. f z (y z)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = (\<Prod>x\<in>insert x A. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ y. (\<Prod>z\<in>insert x A. f z (y z)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = (\<Prod>x\<in>insert x A. integral\<^sup>N (measure_pmf (p x)) (f x))

goal (1 subgoal):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>insert x A. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = (\<Prod>x\<in>insert x A. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ y. (\<Prod>x\<in>insert x A. f x (y x)) \<partial>measure_pmf (Pi_pmf (insert x A) dflt p) = (\<Prod>x\<in>insert x A. integral\<^sup>N (measure_pmf (p x)) (f x))

goal (1 subgoal):
 1. \<integral>\<^sup>+ y. (\<Prod>x\<in>{}. f x (y x)) \<partial>measure_pmf (Pi_pmf {} dflt p) = (\<Prod>x\<in>{}. integral\<^sup>N (measure_pmf (p x)) (f x))
[PROOF STEP]
qed auto


[STATEMENT]
theorem c_out_asi_altproof:
  assumes "sel_reasonable sf"
      and "\<forall>x. cf x > 0"
      and "c = c_list f cf h r"
      and "f = (ldeep_s sf xs)"
      and "h = (\<lambda>a. ldeep_s sf xs a * cf a)"
    shows "asi (\<lambda>l. (ldeep_T f cf l - 1) / c l) r (c_list f cf h r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. asi (\<lambda>l. (ldeep_T f cf l - 1) / c l) r (c_list f cf h r)
[PROOF STEP]
unfolding asi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A U V B. distinct (A @ U @ V @ B) \<and> U \<noteq> [] \<and> V \<noteq> [] \<and> (r \<notin> set (A @ U @ V @ B) \<or> take 1 (A @ U @ V @ B) = [r] \<and> take 1 (A @ V @ U @ B) = [r]) \<longrightarrow> (c_list f cf h r (rev (A @ U @ V @ B)) \<le> c_list f cf h r (rev (A @ V @ U @ B))) = ((ldeep_T f cf (rev U) - 1) / c (rev U) \<le> (ldeep_T f cf (rev V) - 1) / c (rev V))
[PROOF STEP]
using c_out_asi_aux[OF assms] assms(3)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>distinct (?A @ ?U @ ?V @ ?B); ?U \<noteq> []; ?V \<noteq> []; ?rank = (\<lambda>l. (ldeep_T f cf l - 1) / c l); r \<notin> set (?A @ ?U @ ?V @ ?B) \<or> take 1 (?A @ ?U @ ?V @ ?B) = [r] \<and> take 1 (?A @ ?V @ ?U @ ?B) = [r]\<rbrakk> \<Longrightarrow> (c (rev (?A @ ?U @ ?V @ ?B)) \<le> c (rev (?A @ ?V @ ?U @ ?B))) = (?rank (rev ?U) \<le> ?rank (rev ?V))
c = c_list f cf h r

goal (1 subgoal):
 1. \<forall>A U V B. distinct (A @ U @ V @ B) \<and> U \<noteq> [] \<and> V \<noteq> [] \<and> (r \<notin> set (A @ U @ V @ B) \<or> take 1 (A @ U @ V @ B) = [r] \<and> take 1 (A @ V @ U @ B) = [r]) \<longrightarrow> (c_list f cf h r (rev (A @ U @ V @ B)) \<le> c_list f cf h r (rev (A @ V @ U @ B))) = ((ldeep_T f cf (rev U) - 1) / c (rev U) \<le> (ldeep_T f cf (rev V) - 1) / c (rev V))
[PROOF STEP]
by blast


[STATEMENT]
lemma quadratic_hensel_step_code[code]:
  "quadratic_hensel_step q S T D H =
    (let dupe = dupe_monic_dynamic q D H S T; \<comment> \<open>this will share the conversions of \<open>D H S T\<close>\<close>
         U = poly_mod.Mp q (sdiv_poly (C - D * H) q);
         (A, B) = dupe U;
         D' = D + Polynomial.smult q B;
         H' = H + Polynomial.smult q A;
         U' = poly_mod.Mp q (sdiv_poly (S * D' + T * H' - 1) q);
         (A', B') = dupe U';
         q' = q * q;
         S' = poly_mod.Mp q' (S - Polynomial.smult q A');
         T' = poly_mod.Mp q' (T - Polynomial.smult q B')
           in (S', T', D', H'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.quadratic_hensel_step q S T D H = (let dupe = dupe_monic_dynamic q D H S T; U = poly_mod.Mp q (sdiv_poly (C - D * H) q); (A, B) = dupe U; D' = D + Polynomial.smult q B; H' = H + Polynomial.smult q A; U' = poly_mod.Mp q (sdiv_poly (S * D' + T * H' - 1) q); (A', B') = dupe U'; q' = q * q; S' = poly_mod.Mp q' (S - Polynomial.smult q A'); T' = poly_mod.Mp q' (T - Polynomial.smult q B') in (S', T', D', H'))
[PROOF STEP]
unfolding quadratic_hensel_step_def[unfolded hensel_step_def] Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case dupe_monic_dynamic q D H S T (poly_mod.Mp q (sdiv_poly (C - D * H) q)) of (A, B) \<Rightarrow> case dupe_monic_dynamic q D H S T (poly_mod.Mp q (sdiv_poly (S * (D + Polynomial.smult q B) + T * (H + Polynomial.smult q A) - 1) q)) of (A', B') \<Rightarrow> (poly_mod.Mp (q * q) (S - Polynomial.smult q A'), poly_mod.Mp (q * q) (T - Polynomial.smult q B'), D + Polynomial.smult q B, H + Polynomial.smult q A)) = (case dupe_monic_dynamic q D H S T (poly_mod.Mp q (sdiv_poly (C - D * H) q)) of (A, B) \<Rightarrow> case dupe_monic_dynamic q D H S T (poly_mod.Mp q (sdiv_poly (S * (D + Polynomial.smult q B) + T * (H + Polynomial.smult q A) - 1) q)) of (A', B') \<Rightarrow> (poly_mod.Mp (q * q) (S - Polynomial.smult q A'), poly_mod.Mp (q * q) (T - Polynomial.smult q B'), D + Polynomial.smult q B, H + Polynomial.smult q A))
[PROOF STEP]
..


[STATEMENT]
theorem (in character) sum_character:
  "(\<Sum>x\<in>carrier G. \<chi> x) = (if \<chi> = principal_char G then of_nat (order G) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
proof (cases "\<chi> = principal_char G")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<chi> = principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
 2. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<chi> = principal_char G

goal (2 subgoals):
 1. \<chi> = principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
 2. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
hence "(\<Sum>x\<in>carrier G. \<chi> x) = (\<Sum>x\<in>carrier G. 1)"
[PROOF STATE]
proof (prove)
using this:
\<chi> = principal_char G

goal (1 subgoal):
 1. sum \<chi> (carrier G) = (\<Sum>x\<in>carrier G. 1)
[PROOF STEP]
by (intro sum.cong) (auto simp: principal_char_def)
[PROOF STATE]
proof (state)
this:
sum \<chi> (carrier G) = (\<Sum>x\<in>carrier G. 1)

goal (2 subgoals):
 1. \<chi> = principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
 2. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum \<chi> (carrier G) = (\<Sum>x\<in>carrier G. 1)

goal (2 subgoals):
 1. \<chi> = principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
 2. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
have "\<dots> = order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>carrier G. 1) = of_nat (order G)
[PROOF STEP]
by (simp add: order_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>carrier G. 1) = of_nat (order G)

goal (2 subgoals):
 1. \<chi> = principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
 2. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum \<chi> (carrier G) = of_nat (order G)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum \<chi> (carrier G) = of_nat (order G)

goal (1 subgoal):
 1. sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
sum \<chi> (carrier G) = of_nat (order G)
\<chi> = principal_char G

goal (1 subgoal):
 1. sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<chi> \<noteq> principal_char G

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
define S where "S = (\<Sum>x\<in>carrier G. \<chi> x)"
[PROOF STATE]
proof (state)
this:
S = sum \<chi> (carrier G)

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<noteq> principal_char G
[PROOF STEP]
obtain y where y: "y \<in> carrier G" "\<chi> y \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> principal_char G

goal (1 subgoal):
 1. (\<And>y. \<lbrakk>y \<in> carrier G; \<chi> y \<noteq> 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: principal_char_def fun_eq_iff char_eq_0_iff split: if_splits)
[PROOF STATE]
proof (state)
this:
y \<in> carrier G
\<chi> y \<noteq> 1

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
from y
[PROOF STATE]
proof (chain)
picking this:
y \<in> carrier G
\<chi> y \<noteq> 1
[PROOF STEP]
have "S = (\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x))"
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier G
\<chi> y \<noteq> 1

goal (1 subgoal):
 1. S = (\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x))
[PROOF STEP]
unfolding S_def
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier G
\<chi> y \<noteq> 1

goal (1 subgoal):
 1. sum \<chi> (carrier G) = (\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x))
[PROOF STEP]
by (intro sum.reindex_bij_betw [symmetric] bij_betw_mult_left)
[PROOF STATE]
proof (state)
this:
S = (\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x))

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S = (\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x))

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>carrier G. \<chi> y * \<chi> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x)) = (\<Sum>x\<in>carrier G. \<chi> y * \<chi> x)
[PROOF STEP]
by (intro sum.cong refl char_mult y)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x)) = (\<Sum>x\<in>carrier G. \<chi> y * \<chi> x)

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>carrier G. \<chi> (y \<otimes> x)) = (\<Sum>x\<in>carrier G. \<chi> y * \<chi> x)

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
have "\<dots> = \<chi> y * S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>carrier G. \<chi> y * \<chi> x) = \<chi> y * S
[PROOF STEP]
by (simp add: S_def sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>carrier G. \<chi> y * \<chi> x) = \<chi> y * S

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S = \<chi> y * S
[PROOF STEP]
have "(\<chi> y - 1) * S = 0"
[PROOF STATE]
proof (prove)
using this:
S = \<chi> y * S

goal (1 subgoal):
 1. (\<chi> y - 1) * S = 0
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<chi> y - 1) * S = 0

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
with y
[PROOF STATE]
proof (chain)
picking this:
y \<in> carrier G
\<chi> y \<noteq> 1
(\<chi> y - 1) * S = 0
[PROOF STEP]
have "S = 0"
[PROOF STATE]
proof (prove)
using this:
y \<in> carrier G
\<chi> y \<noteq> 1
(\<chi> y - 1) * S = 0

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

goal (1 subgoal):
 1. \<chi> \<noteq> principal_char G \<Longrightarrow> sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<chi> \<noteq> principal_char G
S = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<chi> \<noteq> principal_char G
S = 0

goal (1 subgoal):
 1. sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)
[PROOF STEP]
by (simp add: S_def)
[PROOF STATE]
proof (state)
this:
sum \<chi> (carrier G) = (if \<chi> = principal_char G then of_nat (order G) else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem "\<forall>(x::int). (2 dvd x) = (\<exists>(y::int). x = 2*y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. even x = (\<exists>y. x = 2 * y)
[PROOF STEP]
by presburger


[STATEMENT]
lemma continuous_map_real_inverse [continuous_intros]:
   "\<lbrakk>continuous_map X euclideanreal f; \<And>x. x \<in> topspace X \<Longrightarrow> f x \<noteq> 0\<rbrakk>
        \<Longrightarrow> continuous_map X euclideanreal (\<lambda>x. inverse(f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map X euclideanreal f; \<And>x. x \<in> topspace X \<Longrightarrow> f x \<noteq> 0\<rbrakk> \<Longrightarrow> continuous_map X euclideanreal (\<lambda>x. inverse (f x))
[PROOF STEP]
by (simp add: continuous_map_atin tendsto_inverse)


[STATEMENT]
lemma absolutely_integrable_on_1_iff:
  fixes f :: "'a::euclidean_space \<Rightarrow> real^1"
  shows "f absolutely_integrable_on S \<longleftrightarrow> (\<lambda>x. f x $ 1) absolutely_integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f absolutely_integrable_on S) = ((\<lambda>x. f x $ 1) absolutely_integrable_on S)
[PROOF STEP]
unfolding absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f integrable_on S \<and> (\<lambda>x. norm (f x)) integrable_on S) = ((\<lambda>x. f x $ 1) integrable_on S \<and> (\<lambda>x. norm (f x $ 1)) integrable_on S)
[PROOF STEP]
by (auto simp: integrable_on_1_iff norm_real)


[STATEMENT]
lemma zero_smult : "m \<in> M \<Longrightarrow> 0 \<cdot> m = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<in> M \<Longrightarrow> (0::'r) \<cdot> m = (0::'m)
[PROOF STEP]
using R_scalars.zero_closed smult_distrib_right[of 0] add_left_imp_eq
[PROOF STATE]
proof (prove)
using this:
(0::'r) \<in> R
\<lbrakk>(0::'r) \<in> R; ?s \<in> R; ?m \<in> M\<rbrakk> \<Longrightarrow> ((0::'r) + ?s) \<cdot> ?m = (0::'r) \<cdot> ?m + ?s \<cdot> ?m
?a + ?b = ?a + ?c \<Longrightarrow> ?b = ?c

goal (1 subgoal):
 1. m \<in> M \<Longrightarrow> (0::'r) \<cdot> m = (0::'m)
[PROOF STEP]
by simp


[STATEMENT]
lemma perfect_map_compose:
   "\<lbrakk>perfect_map X Y f; perfect_map Y Z g\<rbrakk> \<Longrightarrow> perfect_map X Z (g \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>perfect_map X Y f; perfect_map Y Z g\<rbrakk> \<Longrightarrow> perfect_map X Z (g \<circ> f)
[PROOF STEP]
by (meson continuous_map_compose perfect_imp_quotient_map perfect_map_def proper_map_compose quotient_map_compose_eq quotient_map_def)


[STATEMENT]
lemma finite_valid_edge [simp, intro!]: "finite (Collect (valid_edge c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Collect (valid_edge c))
[PROOF STEP]
unfolding valid_edge_def [abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {a. c \<turnstile> sourcenode a -kind a\<rightarrow> targetnode a}
[PROOF STEP]
apply (rule inj_on_finite [where f="\<lambda>(f,d,t). (f,t)" and B="Collect (valid_node c) \<times> Collect (valid_node c)"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. inj_on (\<lambda>(f, d, t). (f, t)) {a. c \<turnstile> sourcenode a -kind a\<rightarrow> targetnode a}
 2. (\<lambda>(f, d, t). (f, t)) ` {a. c \<turnstile> sourcenode a -kind a\<rightarrow> targetnode a} \<subseteq> Collect (valid_node c) \<times> Collect (valid_node c)
 3. finite (Collect (valid_node c) \<times> Collect (valid_node c))
[PROOF STEP]
apply (rule inj_onI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> {a. c \<turnstile> sourcenode a -kind a\<rightarrow> targetnode a}; y \<in> {a. c \<turnstile> sourcenode a -kind a\<rightarrow> targetnode a}; (case x of (f, d, t) \<Rightarrow> (f, t)) = (case y of (f, d, t) \<Rightarrow> (f, t))\<rbrakk> \<Longrightarrow> x = y
 2. (\<lambda>(f, d, t). (f, t)) ` {a. c \<turnstile> sourcenode a -kind a\<rightarrow> targetnode a} \<subseteq> Collect (valid_node c) \<times> Collect (valid_node c)
 3. finite (Collect (valid_node c) \<times> Collect (valid_node c))
[PROOF STEP]
apply (auto intro: WCFG_edge_det)[1]
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>(f, d, t). (f, t)) ` {a. c \<turnstile> sourcenode a -kind a\<rightarrow> targetnode a} \<subseteq> Collect (valid_node c) \<times> Collect (valid_node c)
 2. finite (Collect (valid_node c) \<times> Collect (valid_node c))
[PROOF STEP]
apply (force simp: valid_node_def valid_edge_def)[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Collect (valid_node c) \<times> Collect (valid_node c))
[PROOF STEP]
by auto


[STATEMENT]
lemma algebraic_sum [intro]:
  "(\<And>x. x \<in> A \<Longrightarrow> algebraic (f x)) \<Longrightarrow> algebraic (sum f A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> algebraic (f x)) \<Longrightarrow> algebraic (sum f A)
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto intro!: algebraic_plus)


[STATEMENT]
lemma fls_mult_inverse_base_factor:
  fixes   f :: "'a::division_ring fls"
  assumes "f \<noteq> 0"
  shows   "f * inverse (fls_base_factor f) = fls_X_intpow (fls_subdegree f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f * inverse (fls_base_factor f) = fls_X_intpow (fls_subdegree f)
[PROOF STEP]
using   fls_mult_right_inverse_base_factor[of f "inverse (f $$ fls_subdegree f)"]
          fls_base_factor_base[of f]
[PROOF STATE]
proof (prove)
using this:
f $$ fls_subdegree f * inverse (f $$ fls_subdegree f) = (1::'a) \<Longrightarrow> f * fls_right_inverse (fls_base_factor f) (inverse (f $$ fls_subdegree f)) = fls_X_intpow (fls_subdegree f)
fls_base_factor f $$ fls_subdegree (fls_base_factor f) = f $$ fls_subdegree f

goal (1 subgoal):
 1. f * inverse (fls_base_factor f) = fls_X_intpow (fls_subdegree f)
[PROOF STEP]
by      (simp add: assms fls_right_inverse_eq_inverse[symmetric])


[STATEMENT]
lemma star_iso: "x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
assume a1: "x \<le> y"
[PROOF STATE]
proof (state)
this:
x \<le> y

goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
have f2: "y \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>
[PROOF STEP]
by (meson local.less_eq_def star_unfold_part)
[PROOF STATE]
proof (state)
this:
y \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>

goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
have "x + y = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + y = y
[PROOF STEP]
using a1
[PROOF STATE]
proof (prove)
using this:
x \<le> y

goal (1 subgoal):
 1. x + y = y
[PROOF STEP]
by (meson local.less_eq_def)
[PROOF STATE]
proof (state)
this:
x + y = y

goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
hence "x \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
using this:
x + y = y

goal (1 subgoal):
 1. x \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>
[PROOF STEP]
using f2
[PROOF STATE]
proof (prove)
using this:
x + y = y
y \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>

goal (1 subgoal):
 1. x \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>
[PROOF STEP]
by (metis (no_types) local.add_assoc' local.s_prod_distr)
[PROOF STATE]
proof (state)
this:
x \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>

goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
using local.add_assoc' local.less_eq_def local.star_induct star_irr
[PROOF STATE]
proof (prove)
using this:
x \<cdot> y\<^sup>\<star> + y\<^sup>\<star> = y\<^sup>\<star>
?x + ?y + ?z = ?x + (?y + ?z)
(?x \<le> ?y) = (?x + ?y = ?y)
1\<^sub>\<sigma> + ?x \<cdot> ?y \<le> ?y \<Longrightarrow> ?x\<^sup>\<star> \<le> ?y
1\<^sub>\<sigma> \<le> ?x\<^sup>\<star>

goal (1 subgoal):
 1. x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
x\<^sup>\<star> \<le> y\<^sup>\<star>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_sum : "(\<forall>i\<in>{0..n::nat}. MPoly_Type.degree (f i :: real mpoly) var \<le> x) \<Longrightarrow> (MPoly_Type.degree (\<Sum>x\<in>{0..n}. f x) var) \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x
[PROOF STEP]
proof(induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i\<in>{0..0}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..0}) var \<le> x
 2. \<And>n. \<lbrakk>\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x; \<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x\<rbrakk> \<Longrightarrow> MPoly_Type.degree (sum f {0..Suc n}) var \<le> x
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{0..0}. MPoly_Type.degree (f i) var \<le> x

goal (2 subgoals):
 1. \<forall>i\<in>{0..0}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..0}) var \<le> x
 2. \<And>n. \<lbrakk>\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x; \<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x\<rbrakk> \<Longrightarrow> MPoly_Type.degree (sum f {0..Suc n}) var \<le> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<in>{0..0}. MPoly_Type.degree (f i) var \<le> x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{0..0}. MPoly_Type.degree (f i) var \<le> x

goal (1 subgoal):
 1. MPoly_Type.degree (sum f {0..0}) var \<le> x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (sum f {0..0}) var \<le> x

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x; \<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x\<rbrakk> \<Longrightarrow> MPoly_Type.degree (sum f {0..Suc n}) var \<le> x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x; \<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x\<rbrakk> \<Longrightarrow> MPoly_Type.degree (sum f {0..Suc n}) var \<le> x
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x
\<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x

goal (1 subgoal):
 1. \<And>n. \<lbrakk>\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x; \<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x\<rbrakk> \<Longrightarrow> MPoly_Type.degree (sum f {0..Suc n}) var \<le> x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x
\<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>{0..n}. MPoly_Type.degree (f i) var \<le> x \<Longrightarrow> MPoly_Type.degree (sum f {0..n}) var \<le> x
\<forall>i\<in>{0..Suc n}. MPoly_Type.degree (f i) var \<le> x

goal (1 subgoal):
 1. MPoly_Type.degree (sum f {0..Suc n}) var \<le> x
[PROOF STEP]
by(simp add: degree_add_leq)
[PROOF STATE]
proof (state)
this:
MPoly_Type.degree (sum f {0..Suc n}) var \<le> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma arcsin_eq_Re_Arcsin:
  assumes "\<bar>x\<bar> \<le> 1"
    shows "arcsin x = Re (Arcsin (of_real x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arcsin x = Re (Arcsin (complex_of_real x))
[PROOF STEP]
unfolding arcsin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE xa. - (pi / 2) \<le> xa \<and> xa \<le> pi / 2 \<and> sin xa = x) = Re (Arcsin (complex_of_real x))
[PROOF STEP]
proof (rule the_equality, safe)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. - (pi / 2) \<le> Re (Arcsin (complex_of_real x))
 2. Re (Arcsin (complex_of_real x)) \<le> pi / 2
 3. sin (Re (Arcsin (complex_of_real x))) = x
 4. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
show "- (pi / 2) \<le> Re (Arcsin (complex_of_real x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (pi / 2) \<le> Re (Arcsin (complex_of_real x))
[PROOF STEP]
using Re_Ln_pos_le [OF Arcsin_body_lemma, of "of_real x"]
[PROOF STATE]
proof (prove)
using this:
(\<bar>Im (Ln (\<i> * complex_of_real x + csqrt (1 - (complex_of_real x)\<^sup>2)))\<bar> \<le> pi / 2) = (0 \<le> Re (\<i> * complex_of_real x + csqrt (1 - (complex_of_real x)\<^sup>2)))

goal (1 subgoal):
 1. - (pi / 2) \<le> Re (Arcsin (complex_of_real x))
[PROOF STEP]
by (auto simp: Complex.in_Reals_norm Re_Arcsin)
[PROOF STATE]
proof (state)
this:
- (pi / 2) \<le> Re (Arcsin (complex_of_real x))

goal (3 subgoals):
 1. Re (Arcsin (complex_of_real x)) \<le> pi / 2
 2. sin (Re (Arcsin (complex_of_real x))) = x
 3. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. Re (Arcsin (complex_of_real x)) \<le> pi / 2
 2. sin (Re (Arcsin (complex_of_real x))) = x
 3. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
show "Re (Arcsin (complex_of_real x)) \<le> pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (Arcsin (complex_of_real x)) \<le> pi / 2
[PROOF STEP]
using Re_Ln_pos_le [OF Arcsin_body_lemma, of "of_real x"]
[PROOF STATE]
proof (prove)
using this:
(\<bar>Im (Ln (\<i> * complex_of_real x + csqrt (1 - (complex_of_real x)\<^sup>2)))\<bar> \<le> pi / 2) = (0 \<le> Re (\<i> * complex_of_real x + csqrt (1 - (complex_of_real x)\<^sup>2)))

goal (1 subgoal):
 1. Re (Arcsin (complex_of_real x)) \<le> pi / 2
[PROOF STEP]
by (auto simp: Complex.in_Reals_norm Re_Arcsin)
[PROOF STATE]
proof (state)
this:
Re (Arcsin (complex_of_real x)) \<le> pi / 2

goal (2 subgoals):
 1. sin (Re (Arcsin (complex_of_real x))) = x
 2. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sin (Re (Arcsin (complex_of_real x))) = x
 2. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
show "sin (Re (Arcsin (complex_of_real x))) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (Re (Arcsin (complex_of_real x))) = x
[PROOF STEP]
using Re_sin [of "Arcsin (of_real x)"] Arcsin_body_lemma [of "of_real x"]
[PROOF STATE]
proof (prove)
using this:
Re (sin (Arcsin (complex_of_real x))) = sin (Re (Arcsin (complex_of_real x))) * (exp (Im (Arcsin (complex_of_real x))) + exp (- Im (Arcsin (complex_of_real x)))) / 2
\<i> * complex_of_real x + csqrt (1 - (complex_of_real x)\<^sup>2) \<noteq> 0

goal (1 subgoal):
 1. sin (Re (Arcsin (complex_of_real x))) = x
[PROOF STEP]
by (simp add: Im_Arcsin_of_real assms)
[PROOF STATE]
proof (state)
this:
sin (Re (Arcsin (complex_of_real x))) = x

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
fix x'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
assume "- (pi / 2) \<le> x'" "x' \<le> pi / 2" "x = sin x'"
[PROOF STATE]
proof (state)
this:
- (pi / 2) \<le> x'
x' \<le> pi / 2
x = sin x'

goal (1 subgoal):
 1. \<And>xa. \<lbrakk>- (pi / 2) \<le> xa; xa \<le> pi / 2; x = sin xa\<rbrakk> \<Longrightarrow> xa = Re (Arcsin (complex_of_real (sin xa)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- (pi / 2) \<le> x'
x' \<le> pi / 2
x = sin x'
[PROOF STEP]
show "x' = Re (Arcsin (complex_of_real (sin x')))"
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) \<le> x'
x' \<le> pi / 2
x = sin x'

goal (1 subgoal):
 1. x' = Re (Arcsin (complex_of_real (sin x')))
[PROOF STEP]
unfolding sin_of_real [symmetric]
[PROOF STATE]
proof (prove)
using this:
- (pi / 2) \<le> x'
x' \<le> pi / 2
x = sin x'

goal (1 subgoal):
 1. x' = Re (Arcsin (sin (complex_of_real x')))
[PROOF STEP]
by (subst Arcsin_sin) auto
[PROOF STATE]
proof (state)
this:
x' = Re (Arcsin (complex_of_real (sin x')))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Hbd_card_order: "card_order Hbd"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_order Hbd
[PROOF STEP]
by (tactic \<open>BNF_Comp_Tactics.mk_comp_bd_card_order_tac @{context}
  @{thms F1.bd_card_order F2.bd_card_order F3.bd_card_order} @{thm G.bd_card_order}\<close>)


[STATEMENT]
lemma higher_deriv_cmult:
  assumes "f holomorphic_on A" "x \<in> A" "open A"
  shows   "(deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on A
x \<in> A
open A

goal (1 subgoal):
 1. (deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x
[PROOF STEP]
proof (induction j arbitrary: f x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ 0) (\<lambda>x. c * f x) x = c * (deriv ^^ 0) f x
 2. \<And>j f x. \<lbrakk>\<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x; f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ Suc j) (\<lambda>x. c * f x) x = c * (deriv ^^ Suc j) f x
[PROOF STEP]
case (Suc j f x)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?f holomorphic_on A; ?x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ j) (\<lambda>x. c * ?f x) ?x = c * (deriv ^^ j) ?f ?x
f holomorphic_on A
x \<in> A
open A

goal (2 subgoals):
 1. \<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ 0) (\<lambda>x. c * f x) x = c * (deriv ^^ 0) f x
 2. \<And>j f x. \<lbrakk>\<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x; f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ Suc j) (\<lambda>x. c * f x) x = c * (deriv ^^ Suc j) f x
[PROOF STEP]
have "deriv ((deriv ^^ j) (\<lambda>x. c * f x)) x = deriv (\<lambda>x. c * (deriv ^^ j) f x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv ((deriv ^^ j) (\<lambda>x. c * f x)) x = deriv (\<lambda>x. c * (deriv ^^ j) f x) x
[PROOF STEP]
using eventually_nhds_in_open[of A x] assms(2,3) Suc.prems
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>open A; x \<in> A\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F y in nhds x. y \<in> A
x \<in> A
open A
f holomorphic_on A
x \<in> A
open A

goal (1 subgoal):
 1. deriv ((deriv ^^ j) (\<lambda>x. c * f x)) x = deriv (\<lambda>x. c * (deriv ^^ j) f x) x
[PROOF STEP]
by (intro deriv_cong_ev refl) (auto elim!: eventually_mono simp: Suc.IH)
[PROOF STATE]
proof (state)
this:
deriv ((deriv ^^ j) (\<lambda>x. c * f x)) x = deriv (\<lambda>x. c * (deriv ^^ j) f x) x

goal (2 subgoals):
 1. \<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ 0) (\<lambda>x. c * f x) x = c * (deriv ^^ 0) f x
 2. \<And>j f x. \<lbrakk>\<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x; f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ Suc j) (\<lambda>x. c * f x) x = c * (deriv ^^ Suc j) f x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv ((deriv ^^ j) (\<lambda>x. c * f x)) x = deriv (\<lambda>x. c * (deriv ^^ j) f x) x

goal (2 subgoals):
 1. \<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ 0) (\<lambda>x. c * f x) x = c * (deriv ^^ 0) f x
 2. \<And>j f x. \<lbrakk>\<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x; f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ Suc j) (\<lambda>x. c * f x) x = c * (deriv ^^ Suc j) f x
[PROOF STEP]
have "\<dots> = c * deriv ((deriv ^^ j) f) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. c * (deriv ^^ j) f x) x = c * deriv ((deriv ^^ j) f) x
[PROOF STEP]
using Suc.prems assms(2,3)
[PROOF STATE]
proof (prove)
using this:
f holomorphic_on A
x \<in> A
open A
x \<in> A
open A

goal (1 subgoal):
 1. deriv (\<lambda>x. c * (deriv ^^ j) f x) x = c * deriv ((deriv ^^ j) f) x
[PROOF STEP]
by (intro deriv_cmult holomorphic_on_imp_differentiable_at holomorphic_higher_deriv) auto
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. c * (deriv ^^ j) f x) x = c * deriv ((deriv ^^ j) f) x

goal (2 subgoals):
 1. \<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ 0) (\<lambda>x. c * f x) x = c * (deriv ^^ 0) f x
 2. \<And>j f x. \<lbrakk>\<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ j) (\<lambda>x. c * f x) x = c * (deriv ^^ j) f x; f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ Suc j) (\<lambda>x. c * f x) x = c * (deriv ^^ Suc j) f x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
deriv ((deriv ^^ j) (\<lambda>x. c * f x)) x = c * deriv ((deriv ^^ j) f) x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
deriv ((deriv ^^ j) (\<lambda>x. c * f x)) x = c * deriv ((deriv ^^ j) f) x

goal (1 subgoal):
 1. (deriv ^^ Suc j) (\<lambda>x. c * f x) x = c * (deriv ^^ Suc j) f x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(deriv ^^ Suc j) (\<lambda>x. c * f x) x = c * (deriv ^^ Suc j) f x

goal (1 subgoal):
 1. \<And>f x. \<lbrakk>f holomorphic_on A; x \<in> A; open A\<rbrakk> \<Longrightarrow> (deriv ^^ 0) (\<lambda>x. c * f x) x = c * (deriv ^^ 0) f x
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma ccpo_Sup_below_iff: "Complete_Partial_Order.chain (\<le>) Y \<Longrightarrow> Sup Y \<le> x \<longleftrightarrow> (\<forall>y\<in>Y. y \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complete_Partial_Order.chain (\<le>) Y \<Longrightarrow> (\<Squnion> Y \<le> x) = (\<forall>y\<in>Y. y \<le> x)
[PROOF STEP]
by(fast intro: order_trans[OF ccpo_Sup_upper] ccpo_Sup_least)


[STATEMENT]
lemma gfp_exp_unitary:
  "(\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> unitary (gfp_exp t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. unitary P \<Longrightarrow> unitary (t P)) \<Longrightarrow> unitary (gfp_exp t)
[PROOF STEP]
by(iprover intro:gfp_exp_nneg gfp_exp_bound unitaryI2)


[STATEMENT]
lemma compact_Y: "compact Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact Y
[PROOF STEP]
unfolding Y_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact (pow_A_1 ` X1)
[PROOF STEP]
using compact_X1 continuous_pow_A_1[of X1]
[PROOF STATE]
proof (prove)
using this:
compact X1
continuous_on X1 pow_A_1

goal (1 subgoal):
 1. compact (pow_A_1 ` X1)
[PROOF STEP]
by (metis compact_continuous_image)


[STATEMENT]
lemma le_imp_inverse_le:
  "a \<le> b \<Longrightarrow> 0 < a \<Longrightarrow> inverse b \<le> inverse a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; (0::'a) < a\<rbrakk> \<Longrightarrow> inverse b \<le> inverse a
[PROOF STEP]
by (force simp add: le_less less_imp_inverse_less)


[STATEMENT]
lemma unique_Cons [simp]: "unique ((x,y)#l) = (unique l \<and> (\<forall>y. (x,y) \<notin> set l))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unique ((x, y) # l) = (unique l \<and> (\<forall>y. (x, y) \<notin> set l))
[PROOF STEP]
by (auto simp: unique_def dest: fst_in_set_lemma)


[STATEMENT]
lemma [code]: "Stream.smember x (y ## s) = (x = y \<or> Stream.smember x s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stream.smember x (y ## s) = (x = y \<or> Stream.smember x s)
[PROOF STEP]
unfolding Stream.smember_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> i.R (y ## s)) = (x = y \<or> x \<in> i.R s)
[PROOF STEP]
by auto


[STATEMENT]
lemma not_disj_deMorgans [simp]: "(\<not> ((P::'\<alpha> upred) \<or> Q)) = ((\<not> P) \<and> (\<not> Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (P \<or> Q)) = (\<not> P \<and> \<not> Q)
[PROOF STEP]
by (pred_auto)


[STATEMENT]
lemma ereal_openE:
  assumes "open A"
  obtains x y where "open (ereal -` A)"
    and "\<infinity> \<in> A \<Longrightarrow> {ereal x<..} \<subseteq> A"
    and "-\<infinity> \<in> A \<Longrightarrow> {..<ereal y} \<subseteq> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>open (ereal -` A); \<infinity> \<in> A \<Longrightarrow> {ereal x<..} \<subseteq> A; - \<infinity> \<in> A \<Longrightarrow> {..<ereal y} \<subseteq> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms open_ereal_def
[PROOF STATE]
proof (prove)
using this:
open A
open ?A = (open (ereal -` ?A) \<and> (\<infinity> \<in> ?A \<longrightarrow> (\<exists>x. {ereal x<..} \<subseteq> ?A)) \<and> (- \<infinity> \<in> ?A \<longrightarrow> (\<exists>x. {..<ereal x} \<subseteq> ?A)))

goal (1 subgoal):
 1. (\<And>x y. \<lbrakk>open (ereal -` A); \<infinity> \<in> A \<Longrightarrow> {ereal x<..} \<subseteq> A; - \<infinity> \<in> A \<Longrightarrow> {..<ereal y} \<subseteq> A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_list_eq_sum_lookup:
  fixes xs :: "(nat \<times> 'a::comm_semiring_1) list"
  assumes "list_all (\<lambda>(n, x). n < M) xs" "distinct (map fst xs)"
  shows "sum_list (map snd xs) = (\<Sum>i<M. lookup 0 xs i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
from \<open>distinct (map fst xs)\<close>
[PROOF STATE]
proof (chain)
picking this:
distinct (map fst xs)
[PROOF STEP]
have "distinct xs" "inj_on fst (set xs)"
[PROOF STATE]
proof (prove)
using this:
distinct (map fst xs)

goal (1 subgoal):
 1. distinct xs &&& inj_on fst (set xs)
[PROOF STEP]
by (simp_all add: distinct_map)
[PROOF STATE]
proof (state)
this:
distinct xs
inj_on fst (set xs)

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct xs
inj_on fst (set xs)
[PROOF STEP]
have "sum_list (map snd xs) = (\<Sum>x\<in>set xs. snd x)"
[PROOF STATE]
proof (prove)
using this:
distinct xs
inj_on fst (set xs)

goal (1 subgoal):
 1. sum_list (map snd xs) = sum snd (set xs)
[PROOF STEP]
by (auto intro!: sum.cong simp add: sparse_mult_def sum_list_distinct_conv_sum_set)
[PROOF STATE]
proof (state)
this:
sum_list (map snd xs) = sum snd (set xs)

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map snd xs) = sum snd (set xs)

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>set xs. lookup 0 xs (fst x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum snd (set xs) = (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x))
[PROOF STEP]
by (intro sum.cong refl arg_cong2[where f="(*)"]) (simp add: lookup_in_set assms)
[PROOF STATE]
proof (state)
this:
sum snd (set xs) = (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x))

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum snd (set xs) = (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x))

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>fst ` set xs. lookup 0 xs x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x)) = sum (lookup (0::'a) xs) (fst ` set xs)
[PROOF STEP]
using \<open>inj_on fst (set xs)\<close>
[PROOF STATE]
proof (prove)
using this:
inj_on fst (set xs)

goal (1 subgoal):
 1. (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x)) = sum (lookup (0::'a) xs) (fst ` set xs)
[PROOF STEP]
by (simp add: sum.reindex)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x)) = sum (lookup (0::'a) xs) (fst ` set xs)

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x)) = sum (lookup (0::'a) xs) (fst ` set xs)

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
have "\<dots> = (\<Sum>x<M. lookup 0 xs x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (lookup (0::'a) xs) (fst ` set xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>(n, x). n < M) xs

goal (1 subgoal):
 1. sum (lookup (0::'a) xs) (fst ` set xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
by (intro sum.mono_neutral_cong_left)
       (auto simp: list_all_iff lookup_eq_map_of map_of_eq_None_iff[THEN iffD2])
[PROOF STATE]
proof (state)
this:
sum (lookup (0::'a) xs) (fst ` set xs) = sum (lookup (0::'a) xs) {..<M}

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}

goal (1 subgoal):
 1. sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_list (map snd xs) = sum (lookup (0::'a) xs) {..<M}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ideal_points_line_unique:
  assumes "is_poincare_line H" "ideal_points H = {i1, i2}"
  shows "H = poincare_line i1 i2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H = poincare_line i1 i2
[PROOF STEP]
by (smt assms(1) assms(2) calc_ideal_points_on_unit_circle circline_set_def ex_poincare_line_points ideal_points_different(1) ideal_points_on_circline ideal_points_unique insertI1 insert_commute inversion_unit_circle mem_Collect_eq unique_poincare_line_general)


[STATEMENT]
lemma bigo_mult3: "f \<in> O(h) \<Longrightarrow> g \<in> O(j) \<Longrightarrow> f * g \<in> O(h * j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> O(h); g \<in> O(j)\<rbrakk> \<Longrightarrow> f * g \<in> O(h * j)
[PROOF STEP]
by (metis bigo_mult rev_subsetD set_times_intro)


[STATEMENT]
lemma Pi_cong_sets:
    "\<lbrakk>I = J; \<And>x. x \<in> I \<Longrightarrow> M x = N x\<rbrakk> \<Longrightarrow> Pi I M = Pi J N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I = J; \<And>x. x \<in> I \<Longrightarrow> M x = N x\<rbrakk> \<Longrightarrow> Pi I M = Pi J N
[PROOF STEP]
unfolding Pi_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>I = J; \<And>x. x \<in> I \<Longrightarrow> M x = N x\<rbrakk> \<Longrightarrow> {f. \<forall>x. x \<in> I \<longrightarrow> f x \<in> M x} = {f. \<forall>x. x \<in> J \<longrightarrow> f x \<in> N x}
[PROOF STEP]
by auto


[STATEMENT]
lemma nat_diff_left_cancel_le1: "\<lbrakk> k - m \<le> k - (n::nat); m < k \<rbrakk> \<Longrightarrow> n \<le> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k - m \<le> k - n; m < k\<rbrakk> \<Longrightarrow> n \<le> m
[PROOF STEP]
by simp


[STATEMENT]
lemma inner_sum_right: "inner x (\<Sum>y\<in>A. f y) = (\<Sum>y\<in>A. inner x (f y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner x (sum f A) = (\<Sum>y\<in>A. inner x (f y))
[PROOF STEP]
using inner_sum_left [of f A x]
[PROOF STATE]
proof (prove)
using this:
inner (sum f A) x = (\<Sum>xa\<in>A. inner (f xa) x)

goal (1 subgoal):
 1. inner x (sum f A) = (\<Sum>y\<in>A. inner x (f y))
[PROOF STEP]
by (simp only: inner_commute)


[STATEMENT]
lemma LIMSEQ_D: "X \<longlonglongrightarrow> L \<Longrightarrow> 0 < r \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r"
  for L :: "'a::real_normed_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<longlonglongrightarrow> L; 0 < r\<rbrakk> \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm (X n - L) < r
[PROOF STEP]
by (simp add: LIMSEQ_iff)


[STATEMENT]
lemma DERIV_subset:
  "(f has_field_derivative f') (at x within s) \<Longrightarrow> t \<subseteq> s \<Longrightarrow>
    (f has_field_derivative f') (at x within t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative f') (at x within s); t \<subseteq> s\<rbrakk> \<Longrightarrow> (f has_field_derivative f') (at x within t)
[PROOF STEP]
by (simp add: has_field_derivative_def has_derivative_subset)


[STATEMENT]
lemma fls_divide_X_intpow_conv_times:
  fixes f :: "'a::division_ring fls"
  shows "f / (fls_X_intpow i) = f * fls_X_intpow (-i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f / fls_X_intpow i = f * fls_X_intpow (- i)
[PROOF STEP]
by    (rule fls_divide_X_intpow_conv_times'[OF inverse_1])


[STATEMENT]
lemma r_distributive_matrix:
 assumes
  "r_distributive fmul fadd"
  "associative fadd"
  "commutative fadd"
  "fadd 0 0 = 0"
  "\<forall>a. fmul a 0 = 0"
  "\<forall>a. fmul 0 a = 0"
 shows "r_distributive (mult_matrix fmul fadd) (combine_matrix fadd)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r_distributive (mult_matrix fmul fadd) (combine_matrix fadd)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r_distributive (mult_matrix fmul fadd) (combine_matrix fadd)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
r_distributive fmul fadd
associative fadd
commutative fadd
fadd (0::'b) (0::'b) = (0::'b)
\<forall>a. fmul a (0::'b) = (0::'b)
\<forall>a. fmul (0::'a) a = (0::'b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r_distributive fmul fadd
associative fadd
commutative fadd
fadd (0::'b) (0::'b) = (0::'b)
\<forall>a. fmul a (0::'b) = (0::'b)
\<forall>a. fmul (0::'a) a = (0::'b)

goal (1 subgoal):
 1. r_distributive (mult_matrix fmul fadd) (combine_matrix fadd)
[PROOF STEP]
apply (simp add: r_distributive_def mult_matrix_def, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a u v. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a u v. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
fix a::"'a matrix"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a u v. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
fix u::"'b matrix"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a u v. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
fix v::"'b matrix"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a u v. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
let ?mx = "max (ncols a) (max (nrows u) (nrows v))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a u v. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
r_distributive fmul fadd
associative fadd
commutative fadd
fadd (0::'b) (0::'b) = (0::'b)
\<forall>a. fmul a (0::'b) = (0::'b)
\<forall>a. fmul (0::'a) a = (0::'b)
[PROOF STEP]
show "mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) =
        combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)"
[PROOF STATE]
proof (prove)
using this:
r_distributive fmul fadd
associative fadd
commutative fadd
fadd (0::'b) (0::'b) = (0::'b)
\<forall>a. fmul a (0::'b) = (0::'b)
\<forall>a. fmul (0::'a) a = (0::'b)

goal (1 subgoal):
 1. mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
apply (subst mult_matrix_nm[of _ _ _ ?mx fadd fmul])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> ncols a \<le> max (ncols a) (nrows (combine_matrix fadd u v))
 2. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> nrows (combine_matrix fadd u v) \<le> max (ncols a) (nrows (combine_matrix fadd u v))
 3. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> ncols a \<le> max (ncols a) (max (nrows u) (nrows v))
 4. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> nrows (combine_matrix fadd u v) \<le> max (ncols a) (max (nrows u) (nrows v))
 5. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (0::'b) (0::'b) = (0::'b)
 6. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fmul (0::'a) (0::'b) = (0::'b)
 7. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
apply (simp add: max1 max2 combine_nrows combine_ncols)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)
[PROOF STEP]
apply (subst mult_matrix_nm[of _ _ v ?mx fadd fmul])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> ncols a \<le> max (ncols a) (nrows v)
 2. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> nrows v \<le> max (ncols a) (nrows v)
 3. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> ncols a \<le> max (ncols a) (max (nrows u) (nrows v))
 4. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> nrows v \<le> max (ncols a) (max (nrows u) (nrows v))
 5. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (0::'b) (0::'b) = (0::'b)
 6. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fmul (0::'a) (0::'b) = (0::'b)
 7. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a v)
[PROOF STEP]
apply (simp add: max1 max2 combine_nrows combine_ncols)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a v)
[PROOF STEP]
apply (subst mult_matrix_nm[of _ _ u ?mx fadd fmul])
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> ncols a \<le> max (ncols a) (nrows u)
 2. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> nrows u \<le> max (ncols a) (nrows u)
 3. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> ncols a \<le> max (ncols a) (max (nrows u) (nrows v))
 4. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> nrows u \<le> max (ncols a) (max (nrows u) (nrows v))
 5. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (0::'b) (0::'b) = (0::'b)
 6. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fmul (0::'a) (0::'b) = (0::'b)
 7. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a u) (mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a v)
[PROOF STEP]
apply (simp add: max1 max2 combine_nrows combine_ncols)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r_distributive fmul fadd; associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a u) (mult_matrix_n (max (ncols a) (max (nrows u) (nrows v))) fmul fadd a v)
[PROOF STEP]
apply (simp add: mult_matrix_n_def r_distributive_def foldseq_distr[of fadd])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> Abs_matrix (\<lambda>j i. fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))) = combine_matrix fadd (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))))) (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v)))))
[PROOF STEP]
apply (simp add: combine_matrix_def combine_infmatrix_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> Abs_matrix (\<lambda>j i. fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))) = Abs_matrix (\<lambda>j i. fadd (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i) (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i))
[PROOF STEP]
apply (rule comb[of "Abs_matrix" "Abs_matrix"], simp, (rule ext)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v)))) = fadd (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i) (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i)
[PROOF STEP]
apply (simplesubst RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>m. \<forall>j i. m \<le> j \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 2. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 3. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v)))) = fadd (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))
[PROOF STEP]
apply (simp, auto)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>m. \<forall>j\<ge>m. \<forall>i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 2. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 3. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v)))) = fadd (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))
[PROOF STEP]
apply (rule exI[of _ "nrows a"], simp add: nrows_le foldseq_zero)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 2. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v)))) = fadd (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))
[PROOF STEP]
apply (rule exI[of _ "ncols v"], simp add: ncols_le foldseq_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v)))) = fadd (Rep_matrix (Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))))) j i) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))
[PROOF STEP]
apply (subst RepAbs_matrix)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>m. \<forall>j i. m \<le> j \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 2. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 3. \<And>j i. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v)))) = fadd (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v)))) (foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix v k i)) (max (ncols a) (max (nrows u) (nrows v))))
[PROOF STEP]
apply (simp, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>m. \<forall>j\<ge>m. \<forall>i. foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
 2. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
[PROOF STEP]
apply (rule exI[of _ "nrows a"], simp add: nrows_le foldseq_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>a u v. fmul a (fadd u v) = fadd (fmul a u) (fmul a v); associative fadd; commutative fadd; fadd (0::'b) (0::'b) = (0::'b); \<forall>a. fmul a (0::'b) = (0::'b); \<forall>a. fmul (0::'a) a = (0::'b)\<rbrakk> \<Longrightarrow> \<exists>n. \<forall>j i. n \<le> i \<longrightarrow> foldseq fadd (\<lambda>k. fmul (Rep_matrix a j k) (Rep_matrix u k i)) (max (ncols a) (max (nrows u) (nrows v))) = (0::'b)
[PROOF STEP]
apply (rule exI[of _ "ncols u"], simp add: ncols_le foldseq_zero)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
mult_matrix_n (max (ncols a) (nrows (combine_matrix fadd u v))) fmul fadd a (combine_matrix fadd u v) = combine_matrix fadd (mult_matrix_n (max (ncols a) (nrows u)) fmul fadd a u) (mult_matrix_n (max (ncols a) (nrows v)) fmul fadd a v)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
r_distributive (mult_matrix fmul fadd) (combine_matrix fadd)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma UINF_pred_lit_eq [simp]:
  "(\<Sqinter> x | \<guillemotleft>x = v\<guillemotright> \<bullet> P(x)) = (P v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter> x | \<guillemotleft>x = v\<guillemotright> \<bullet> P x) = P v
[PROOF STEP]
by (pred_auto)


[STATEMENT]
lemma unitary_gen_scale [simp]:
  assumes "unitary_gen M" and "k \<noteq> 0"
  shows "unitary_gen (k *\<^sub>s\<^sub>m M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary_gen (k *\<^sub>s\<^sub>m M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unitary_gen M
k \<noteq> 0

goal (1 subgoal):
 1. unitary_gen (k *\<^sub>s\<^sub>m M)
[PROOF STEP]
unfolding unitary_gen_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. k \<noteq> 0 \<and> mat_adj M *\<^sub>m\<^sub>m M = k *\<^sub>s\<^sub>m eye
k \<noteq> 0

goal (1 subgoal):
 1. \<exists>ka. ka \<noteq> 0 \<and> mat_adj (k *\<^sub>s\<^sub>m M) *\<^sub>m\<^sub>m (k *\<^sub>s\<^sub>m M) = ka *\<^sub>s\<^sub>m eye
[PROOF STEP]
by auto


[STATEMENT]
lemma lead_coeff_factor: assumes u: "u = v * (w :: 'a ::idom poly)"
  shows "smult (lead_coeff u) u = (smult (lead_coeff w) v) * (smult (lead_coeff v) w)"
  "lead_coeff (smult (lead_coeff w) v) = lead_coeff u" "lead_coeff (smult (lead_coeff v) w) = lead_coeff u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (lead_coeff u) u = Polynomial.smult (lead_coeff w) v * Polynomial.smult (lead_coeff v) w &&& lead_coeff (Polynomial.smult (lead_coeff w) v) = lead_coeff u &&& lead_coeff (Polynomial.smult (lead_coeff v) w) = lead_coeff u
[PROOF STEP]
unfolding u
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial.smult (lead_coeff (v * w)) (v * w) = Polynomial.smult (lead_coeff w) v * Polynomial.smult (lead_coeff v) w &&& lead_coeff (Polynomial.smult (lead_coeff w) v) = lead_coeff (v * w) &&& lead_coeff (Polynomial.smult (lead_coeff v) w) = lead_coeff (v * w)
[PROOF STEP]
by (auto simp: lead_coeff_mult lead_coeff_smult)


[STATEMENT]
lemma sumlist_append:
  assumes "set xs \<subseteq> carrier G" and "set ys \<subseteq> carrier G"
  shows "sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys
[PROOF STEP]
proof (insert assms, induct xs arbitrary: ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>ys. \<lbrakk>set [] \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist ([] @ ys) = sumlist [] \<oplus> sumlist ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>set xs \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys; set (a # xs) \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist ((a # xs) @ ys) = sumlist (a # xs) \<oplus> sumlist ys
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>set xs \<subseteq> carrier G; set ?ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist (xs @ ?ys) = sumlist xs \<oplus> sumlist ?ys
set (x # xs) \<subseteq> carrier G
set ys \<subseteq> carrier G

goal (2 subgoals):
 1. \<And>ys. \<lbrakk>set [] \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist ([] @ ys) = sumlist [] \<oplus> sumlist ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>set xs \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys; set (a # xs) \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist ((a # xs) @ ys) = sumlist (a # xs) \<oplus> sumlist ys
[PROOF STEP]
have "sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
set (x # xs) \<subseteq> carrier G
set ys \<subseteq> carrier G

goal (1 subgoal):
 1. sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys
[PROOF STEP]
by (auto intro: Cons.hyps)
[PROOF STATE]
proof (state)
this:
sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys

goal (2 subgoals):
 1. \<And>ys. \<lbrakk>set [] \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist ([] @ ys) = sumlist [] \<oplus> sumlist ys
 2. \<And>a xs ys. \<lbrakk>\<And>ys. \<lbrakk>set xs \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys; set (a # xs) \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist ((a # xs) @ ys) = sumlist (a # xs) \<oplus> sumlist ys
[PROOF STEP]
with Cons.prems
[PROOF STATE]
proof (chain)
picking this:
set (x # xs) \<subseteq> carrier G
set ys \<subseteq> carrier G
sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
set (x # xs) \<subseteq> carrier G
set ys \<subseteq> carrier G
sumlist (xs @ ys) = sumlist xs \<oplus> sumlist ys

goal (1 subgoal):
 1. sumlist ((x # xs) @ ys) = sumlist (x # xs) \<oplus> sumlist ys
[PROOF STEP]
by (auto intro!: a_assoc[symmetric])
[PROOF STATE]
proof (state)
this:
sumlist ((x # xs) @ ys) = sumlist (x # xs) \<oplus> sumlist ys

goal (1 subgoal):
 1. \<And>ys. \<lbrakk>set [] \<subseteq> carrier G; set ys \<subseteq> carrier G\<rbrakk> \<Longrightarrow> sumlist ([] @ ys) = sumlist [] \<oplus> sumlist ys
[PROOF STEP]
qed auto


[STATEMENT]
lemma space_interval_measure [simp]: "space (interval_measure F) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (interval_measure F) = UNIV
[PROOF STEP]
by (simp add: interval_measure_def space_extend_measure)


[STATEMENT]
lemma  rank_1_proj_col_carrier:
  assumes "i < dim_col A"
  shows "rank_1_proj (Matrix.col A i) \<in> carrier_mat (dim_row A) (dim_row A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
have "dim_vec (Matrix.col A i) = dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (Matrix.col A i) = dim_row A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec (Matrix.col A i) = dim_row A

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
dim_vec (Matrix.col A i) = dim_row A

goal (1 subgoal):
 1. rank_1_proj (Matrix.col A i) \<in> carrier_mat (dim_row A) (dim_row A)
[PROOF STEP]
by (metis rank_1_proj_carrier)
[PROOF STATE]
proof (state)
this:
rank_1_proj (Matrix.col A i) \<in> carrier_mat (dim_row A) (dim_row A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vrat_vsubset_vreal: "\<rat>\<^sub>\<circ> \<subseteq>\<^sub>\<circ> \<real>\<^sub>\<circ>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rat>\<^sub>\<circ> \<subseteq>\<^sub>\<circ> \<real>\<^sub>\<circ>
[PROOF STEP]
unfolding vrat_def vrat_of_rat_def vreal_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZFC_in_HOL.set (range (\<lambda>x. (real_of_rat x)\<^sub>\<real>)) \<subseteq>\<^sub>\<circ> ZFC_in_HOL.set (range vreal_of_real)
[PROOF STEP]
using image_cong
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?M = ?N; \<And>x. x \<in> ?N \<Longrightarrow> ?f x = ?g x\<rbrakk> \<Longrightarrow> ?f ` ?M = ?g ` ?N

goal (1 subgoal):
 1. ZFC_in_HOL.set (range (\<lambda>x. (real_of_rat x)\<^sub>\<real>)) \<subseteq>\<^sub>\<circ> ZFC_in_HOL.set (range vreal_of_real)
[PROOF STEP]
by auto


[STATEMENT]
theorem single_valued_lfp_Mon2Rel: "single_valued (lfp(\<Gamma> c (Mon2Rel B)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. single_valued (lfp (\<Gamma> c (Mon2Rel B)))
[PROOF STEP]
apply(rule single_valued_lfp, simp_all add: cont_\<Gamma>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r. single_valued r \<Longrightarrow> single_valued (\<Gamma> c (Mon2Rel B) r)
[PROOF STEP]
apply(auto simp: \<Gamma>_def single_valued_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r ya z xb yb zb. \<lbrakk>\<forall>x y. (x, y) \<in> r \<longrightarrow> (\<forall>z. (x, z) \<in> r \<longrightarrow> y = z); c xb; (xb, ya) \<in> Mon2Rel B; (ya, z) \<in> r; (xb, yb) \<in> Mon2Rel B; (yb, zb) \<in> r\<rbrakk> \<Longrightarrow> z = zb
[PROOF STEP]
apply(metis single_valued_Mon2Rel[of "B"] single_valued_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma continuous_orderD:
  fixes g::"'b::t2_space \<Rightarrow> 'c::order_topology"
  assumes "continuous (at x within S) g"
  shows "g x > c \<Longrightarrow> \<forall>\<^sub>F y in at x within S. g y > c"
    "g x < c \<Longrightarrow> \<forall>\<^sub>F y in at x within S. g y < c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c < g x \<Longrightarrow> \<forall>\<^sub>F y in at x within S. c < g y) &&& (g x < c \<Longrightarrow> \<forall>\<^sub>F y in at x within S. g y < c)
[PROOF STEP]
using order_tendstoD[OF assms[unfolded continuous_within]]
[PROOF STATE]
proof (prove)
using this:
?a < g x \<Longrightarrow> \<forall>\<^sub>F x in at x within S. ?a < g x
g x < ?a \<Longrightarrow> \<forall>\<^sub>F x in at x within S. g x < ?a

goal (1 subgoal):
 1. (c < g x \<Longrightarrow> \<forall>\<^sub>F y in at x within S. c < g y) &&& (g x < c \<Longrightarrow> \<forall>\<^sub>F y in at x within S. g y < c)
[PROOF STEP]
by auto


[STATEMENT]
lemma convex_halfspace_Re_lt: "convex {x. Re x < b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex {x. Re x < b}
[PROOF STEP]
using convex_halfspace_lt[of "1::complex" b]
[PROOF STATE]
proof (prove)
using this:
convex {x. 1 \<bullet> x < b}

goal (1 subgoal):
 1. convex {x. Re x < b}
[PROOF STEP]
by simp


[STATEMENT]
lemma mult_zero_right [simp]:
  assumes "z \<noteq> \<infinity>\<^sub>h"
  shows "z *\<^sub>h 0\<^sub>h = 0\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z *\<^sub>h 0\<^sub>h = 0\<^sub>h
[PROOF STEP]
using mult_zero_left[OF assms]
[PROOF STATE]
proof (prove)
using this:
0\<^sub>h *\<^sub>h z = 0\<^sub>h

goal (1 subgoal):
 1. z *\<^sub>h 0\<^sub>h = 0\<^sub>h
[PROOF STEP]
by (simp add: mult_commute)


[STATEMENT]
lemma mult_iarray_works:
  assumes "a<IArray.length A" shows "mult_iarray A q !! a = q * A!!a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult_iarray A q !! a = q * A !! a
[PROOF STEP]
unfolding mult_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>n. q * A !! n) (IArray.length A) !! a = q * A !! a
[PROOF STEP]
unfolding IArray.of_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray (map (\<lambda>n. q * A !! n) [0..<IArray.length A]) !! a = q * A !! a
[PROOF STEP]
unfolding sub_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray (map (\<lambda>n. q * A !! n) [0..<IArray.length A]) !! a = q * A !! a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < IArray.length A

goal (1 subgoal):
 1. IArray (map (\<lambda>n. q * A !! n) [0..<IArray.length A]) !! a = q * A !! a
[PROOF STEP]
by simp


[STATEMENT]
lemma pm_of_idx_pm_monom_mult: "pm_of_idx_pm xs (punit.monom_mult c 0 f) = punit.monom_mult c 0 (pm_of_idx_pm xs f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pm_of_idx_pm xs (punit.monom_mult c 0 f) = punit.monom_mult c (0::'a) (pm_of_idx_pm xs f)
[PROOF STEP]
by (rule poly_mapping_eqI, simp add: lookup_pm_of_idx_pm punit.lookup_monom_mult_zero when_def)


[STATEMENT]
lemma equal_odlist_equal[simp]:
  "\<lbrakk> distinct xs; distinct ys; sorted xs; sorted ys \<rbrakk>
     \<Longrightarrow> odlist_equal xs ys \<longleftrightarrow> (xs = ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xs; distinct ys; sorted xs; sorted ys\<rbrakk> \<Longrightarrow> odlist_equal xs ys = (xs = ys)
[PROOF STEP]
by (induct xs ys rule: odlist_equal.induct) (auto)