[STATEMENT]
lemma completely_multiplicative_fds_deriv':
  "completely_multiplicative_function (fds_nth f) \<Longrightarrow>
     fds_deriv f = - fds (\<lambda>n. fds_nth f n * mangoldt n) * f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. completely_multiplicative_function (fds_nth f) \<Longrightarrow> fds_deriv f = - fds (\<lambda>n. fds_nth f n * mangoldt n) * f
[PROOF STEP]
using completely_multiplicative_fds_deriv[of "fds_nth f"]
[PROOF STATE]
proof (prove)
using this:
completely_multiplicative_function (fds_nth f) \<Longrightarrow> fds_deriv (fds (fds_nth f)) = - fds (\<lambda>n. fds_nth f n * mangoldt n) * fds (fds_nth f)

goal (1 subgoal):
 1. completely_multiplicative_function (fds_nth f) \<Longrightarrow> fds_deriv f = - fds (\<lambda>n. fds_nth f n * mangoldt n) * f
[PROOF STEP]
by simp


[STATEMENT]
theorem wls_Op_inj[simp]:
assumes "wlsInp delta inp" and "wlsBinp delta binp"
and "wlsInp delta' inp'" and "wlsBinp delta' binp'"
shows
"(Op delta inp binp = Op delta' inp' binp') =
 (delta = delta' \<and> inp = inp' \<and> binp = binp')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Op delta inp binp = Op delta' inp' binp') = (delta = delta' \<and> inp = inp' \<and> binp = binp')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsInp delta inp
wlsBinp delta binp
wlsInp delta' inp'
wlsBinp delta' binp'

goal (1 subgoal):
 1. (Op delta inp binp = Op delta' inp' binp') = (delta = delta' \<and> inp = inp' \<and> binp = binp')
[PROOF STEP]
by simp


[STATEMENT]
lemma state_list_length_non_zero:
  fixes as s
  shows "\<not>(0 = length (state_list s as))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<noteq> length (state_list s as)
[PROOF STEP]
proof (induction as)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<noteq> length (state_list s [])
 2. \<And>a as. 0 \<noteq> length (state_list s as) \<Longrightarrow> 0 \<noteq> length (state_list s (a # as))
[PROOF STEP]
qed auto


[STATEMENT]
lemma landau_symbol_at_top_imp_at_0:
  "(\<lambda>x. f (-inverse x)) \<in> L' at_top (\<lambda>x. g (-inverse x)) \<Longrightarrow>
   (\<lambda>x. f (inverse x)) \<in> L' at_top (\<lambda>x. g (inverse x)) \<Longrightarrow>
   f \<in> L (at 0) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(\<lambda>x. f (- inverse x)) \<in> L' at_top (\<lambda>x. g (- inverse x)); (\<lambda>x. f (inverse x)) \<in> L' at_top (\<lambda>x. g (inverse x))\<rbrakk> \<Longrightarrow> f \<in> L (at 0) g
[PROOF STEP]
by (rule landau_symbol_at_top_imp_at) simp_all


[STATEMENT]
lemma Int_stableI_image:
  "(\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> \<exists>k\<in>I. A i \<inter> A j = A k) \<Longrightarrow> Int_stable (A ` I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i j. \<lbrakk>i \<in> I; j \<in> I\<rbrakk> \<Longrightarrow> \<exists>k\<in>I. A i \<inter> A j = A k) \<Longrightarrow> Int_stable (A ` I)
[PROOF STEP]
by (auto simp: Int_stable_def image_def)


[STATEMENT]
lemma mset_replicate [simp]: "mset (replicate n x) = replicate_mset n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset (replicate n x) = replicate_mset n x
[PROOF STEP]
by (induction n) auto


[STATEMENT]
lemma compare_Tuple3_simps [simp]:
  "compare\<cdot>\<langle>x1, y1, z1\<rangle>\<cdot>\<langle>x2, y2, z2\<rangle> =
    thenOrdering\<cdot>(compare\<cdot>x1\<cdot>x2)\<cdot>
      (thenOrdering\<cdot>(compare\<cdot>y1\<cdot>y2)\<cdot>(compare\<cdot>z1\<cdot>z2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compare\<cdot>\<langle>x1, y1, z1\<rangle>\<cdot>\<langle>x2, y2, z2\<rangle> = thenOrdering\<cdot>(compare\<cdot>x1\<cdot>x2)\<cdot>(thenOrdering\<cdot>(compare\<cdot>y1\<cdot>y2)\<cdot>(compare\<cdot>z1\<cdot>z2))
[PROOF STEP]
unfolding compare_Tuple3_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case \<langle>x1, y1, z1\<rangle> of \<langle>x1, y1, z1\<rangle> \<Rightarrow> \<Lambda> \<langle>x2, y2, z2\<rangle>. thenOrdering\<cdot>(compare\<cdot>x1\<cdot>x2)\<cdot>(thenOrdering\<cdot>(compare\<cdot>y1\<cdot>y2)\<cdot>(compare\<cdot>z1\<cdot>z2)))\<cdot>\<langle>x2, y2, z2\<rangle> = thenOrdering\<cdot>(compare\<cdot>x1\<cdot>x2)\<cdot>(thenOrdering\<cdot>(compare\<cdot>y1\<cdot>y2)\<cdot>(compare\<cdot>z1\<cdot>z2))
[PROOF STEP]
by simp


[STATEMENT]
lemma HBL2_imp:
 "\<And>\<phi> \<chi>. \<phi> \<in> fmla \<Longrightarrow> \<chi> \<in> fmla \<Longrightarrow> Fvars \<phi> = {} \<Longrightarrow> Fvars \<chi> = {} \<Longrightarrow>
  bprv (imp (PP \<langle>imp \<phi> \<chi>\<rangle>) (imp (PP \<langle>\<phi>\<rangle>) (PP \<langle>\<chi>\<rangle>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>\<phi> \<chi>. \<lbrakk>\<phi> \<in> fmla; \<chi> \<in> fmla; Fvars \<phi> = {}; Fvars \<chi> = {}\<rbrakk> \<Longrightarrow> bprv (imp (PP \<langle>imp \<phi> \<chi>\<rangle>) (imp (PP \<langle>\<phi>\<rangle>) (PP \<langle>\<chi>\<rangle>)))
[PROOF STEP]
using HBL2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<phi> \<in> fmla; ?\<chi> \<in> fmla; Fvars ?\<phi> = {}; Fvars ?\<chi> = {}\<rbrakk> \<Longrightarrow> bprv (imp (cnj (PP \<langle>?\<phi>\<rangle>) (PP \<langle>imp ?\<phi> ?\<chi>\<rangle>)) (PP \<langle>?\<chi>\<rangle>))

goal (1 subgoal):
 1. \<And>\<phi> \<chi>. \<lbrakk>\<phi> \<in> fmla; \<chi> \<in> fmla; Fvars \<phi> = {}; Fvars \<chi> = {}\<rbrakk> \<Longrightarrow> bprv (imp (PP \<langle>imp \<phi> \<chi>\<rangle>) (imp (PP \<langle>\<phi>\<rangle>) (PP \<langle>\<chi>\<rangle>)))
[PROOF STEP]
by (simp add: B.prv_cnj_imp B.prv_imp_com)


[STATEMENT]
lemma linf_norm_vec_ge_0 [intro!]:
  fixes v :: "'a :: ordered_ab_group_add_abs vec"
  shows "\<parallel>v\<parallel>\<^sub>\<infinity> \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> \<parallel>v\<parallel>\<^sub>\<infinity>
[PROOF STEP]
by (induct v, auto simp: max_def)


[STATEMENT]
lemma list_gcd_greatest: "(\<And> x. x \<in> set xs \<Longrightarrow> y dvd x) \<Longrightarrow> y dvd (list_gcd xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> y dvd x) \<Longrightarrow> y dvd gcd_list xs
[PROOF STEP]
by (fact gcd_list_greatest)


[STATEMENT]
lemma inj_on_fst_graph: "inj_on fst (graph m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on fst (graph m)
[PROOF STEP]
unfolding graph_def inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{(a, b) |a b. m a = Some b}. \<forall>y\<in>{(a, b) |a b. m a = Some b}. fst x = fst y \<longrightarrow> x = y
[PROOF STEP]
by force


[STATEMENT]
lemma covar_integrable:
  fixes f g :: "'a \<Rightarrow> real"
  assumes "f \<in> borel_measurable M" "g \<in> borel_measurable M"
  assumes "integrable M (\<lambda>\<omega>. f \<omega>^2)" "integrable M (\<lambda>\<omega>. g \<omega>^2)"
  shows "integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))
[PROOF STEP]
have "integrable M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M f
[PROOF STEP]
using square_integrable_imp_integrable assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>random_variable borel ?f; integrable M (\<lambda>x. (?f x)\<^sup>2)\<rbrakk> \<Longrightarrow> integrable M ?f
random_variable borel f
random_variable borel g
integrable M (\<lambda>\<omega>. (f \<omega>)\<^sup>2)
integrable M (\<lambda>\<omega>. (g \<omega>)\<^sup>2)

goal (1 subgoal):
 1. integrable M f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M f

goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
integrable M f

goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))
[PROOF STEP]
have "integrable M g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
using square_integrable_imp_integrable assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>random_variable borel ?f; integrable M (\<lambda>x. (?f x)\<^sup>2)\<rbrakk> \<Longrightarrow> integrable M ?f
random_variable borel f
random_variable borel g
integrable M (\<lambda>\<omega>. (f \<omega>)\<^sup>2)
integrable M (\<lambda>\<omega>. (g \<omega>)\<^sup>2)

goal (1 subgoal):
 1. integrable M g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integrable M g

goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
integrable M f
integrable M g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integrable M f
integrable M g

goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))
[PROOF STEP]
using assms real_prod_integrable
[PROOF STATE]
proof (prove)
using this:
integrable M f
integrable M g
random_variable borel f
random_variable borel g
integrable M (\<lambda>\<omega>. (f \<omega>)\<^sup>2)
integrable M (\<lambda>\<omega>. (g \<omega>)\<^sup>2)
\<lbrakk>random_variable borel ?f; random_variable borel ?g; integrable M (\<lambda>\<omega>. (?f \<omega>)\<^sup>2); integrable M (\<lambda>\<omega>. (?g \<omega>)\<^sup>2)\<rbrakk> \<Longrightarrow> integrable M (\<lambda>\<omega>. ?f \<omega> * ?g \<omega>)

goal (1 subgoal):
 1. integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>\<omega>. (f \<omega> - expectation f) * (g \<omega> - expectation g))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_coeff_poly_x_minus_y:
  fixes p q :: "'a :: {idom, semiring_char_0} poly"
  shows "degree (coeff (poly_x_minus_y p) i) = degree p - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
consider "i = degree p" | "i > degree p" | "i < degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i = degree p \<Longrightarrow> thesis; degree p < i \<Longrightarrow> thesis; i < degree p \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<lbrakk>i = degree p \<Longrightarrow> ?thesis; degree p < i \<Longrightarrow> ?thesis; i < degree p \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i = degree p \<Longrightarrow> ?thesis; degree p < i \<Longrightarrow> ?thesis; i < degree p \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. i = degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
 2. degree p < i \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
 3. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
assume "i > degree p"
[PROOF STATE]
proof (state)
this:
degree p < i

goal (3 subgoals):
 1. i = degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
 2. degree p < i \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
 3. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
degree p < i

goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
by (subst coeff_eq_0) auto
[PROOF STATE]
proof (state)
this:
degree (coeff (poly_x_minus_y p) i) = degree p - i

goal (2 subgoals):
 1. i = degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
 2. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
 2. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
assume "i = degree p"
[PROOF STATE]
proof (state)
this:
i = degree p

goal (2 subgoals):
 1. i = degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
 2. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = degree p

goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
using lead_coeff_poly_x_minus_y[of p]
[PROOF STATE]
proof (prove)
using this:
i = degree p
lead_coeff (poly_x_minus_y p) = [:lead_coeff p * (- (1::'a)) ^ degree p:]

goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
by (simp add: lead_coeff_poly_x_minus_y)
[PROOF STATE]
proof (state)
this:
degree (coeff (poly_x_minus_y p) i) = degree p - i

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
assume "i < degree p"
[PROOF STATE]
proof (state)
this:
i < degree p

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
define n where "n = degree p"
[PROOF STATE]
proof (state)
this:
n = degree p

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
have "degree (coeff (poly_x_minus_y p) i) =
            degree (\<Sum>j\<le>n. [:coeff p j:] * coeff (x_y ^ j) i)" (is "_ = degree (sum ?f _)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree (\<Sum>j\<le>n. [:coeff p j:] * coeff (x_y ^ j) i)
[PROOF STEP]
by (simp add: poly_x_minus_y_def pcompose_conv_poly poly_altdef coeff_sum n_def)
[PROOF STATE]
proof (state)
this:
degree (coeff (poly_x_minus_y p) i) = degree (\<Sum>j\<le>n. [:coeff p j:] * coeff (x_y ^ j) i)

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (coeff (poly_x_minus_y p) i) = degree (\<Sum>j\<le>n. [:coeff p j:] * coeff (x_y ^ j) i)

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
have "{..n} = insert n {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..n} = insert n {..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..n} = insert n {..<n}

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{..n} = insert n {..<n}

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
have "sum ?f \<dots> = ?f n + sum ?f {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>insert n {..<n}. [:coeff p j:] * coeff (x_y ^ j) i) = [:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)
[PROOF STEP]
by (subst sum.insert) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>insert n {..<n}. [:coeff p j:] * coeff (x_y ^ j) i) = [:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>insert n {..<n}. [:coeff p j:] * coeff (x_y ^ j) i) = [:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
have "degree \<dots> = n - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i
[PROOF STEP]
have "degree (?f n) = n - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i) = n - i
[PROOF STEP]
using \<open>i < degree p\<close>
[PROOF STATE]
proof (prove)
using this:
i < degree p

goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i) = n - i
[PROOF STEP]
by (simp add: n_def coeff_xy_power degree_monom_eq)
[PROOF STATE]
proof (state)
this:
degree ([:coeff p n:] * coeff (x_y ^ n) i) = n - i

goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
degree ([:coeff p n:] * coeff (x_y ^ n) i) = n - i

goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i
[PROOF STEP]
have "degree (sum ?f {..<n}) < n - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
proof (intro degree_sum_smaller)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < n - i
 2. finite {..<n}
 3. \<And>j. j \<in> {..<n} \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < n - i
 2. finite {..<n}
 3. \<And>j. j \<in> {..<n} \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
assume "j \<in> {..<n}"
[PROOF STATE]
proof (state)
this:
j \<in> {..<n}

goal (3 subgoals):
 1. 0 < n - i
 2. finite {..<n}
 3. \<And>j. j \<in> {..<n} \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
have "degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
proof (cases "i \<le> j")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
 2. \<not> i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i \<le> j

goal (2 subgoals):
 1. i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
 2. \<not> i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<le> j

goal (1 subgoal):
 1. degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
by (auto simp: n_def coeff_xy_power degree_monom_eq)
[PROOF STATE]
proof (state)
this:
degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i

goal (1 subgoal):
 1. \<not> i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> i \<le> j

goal (1 subgoal):
 1. \<not> i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
hence "coeff (x_y ^ j :: 'a poly poly) i = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> i \<le> j

goal (1 subgoal):
 1. coeff (x_y ^ j) i = 0
[PROOF STEP]
by (subst coeff_eq_0) (auto simp: degree_power_eq)
[PROOF STATE]
proof (state)
this:
coeff (x_y ^ j) i = 0

goal (1 subgoal):
 1. \<not> i \<le> j \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
coeff (x_y ^ j) i = 0

goal (1 subgoal):
 1. degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i

goal (3 subgoals):
 1. 0 < n - i
 2. finite {..<n}
 3. \<And>j. j \<in> {..<n} \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree ([:coeff p j:] * coeff (x_y ^ j) i) \<le> j - i

goal (3 subgoals):
 1. 0 < n - i
 2. finite {..<n}
 3. \<And>j. j \<in> {..<n} \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
have "\<dots> < n - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j - i < n - i
[PROOF STEP]
using \<open>j \<in> {..<n}\<close> \<open>i < degree p\<close>
[PROOF STATE]
proof (prove)
using this:
j \<in> {..<n}
i < degree p

goal (1 subgoal):
 1. j - i < n - i
[PROOF STEP]
by (auto simp: n_def)
[PROOF STATE]
proof (state)
this:
j - i < n - i

goal (3 subgoals):
 1. 0 < n - i
 2. finite {..<n}
 3. \<And>j. j \<in> {..<n} \<Longrightarrow> degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
show "degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i"
[PROOF STATE]
proof (prove)
using this:
degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i

goal (1 subgoal):
 1. degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
degree ([:coeff p j:] * coeff (x_y ^ j) i) < n - i

goal (2 subgoals):
 1. 0 < n - i
 2. finite {..<n}
[PROOF STEP]
qed (use \<open>i < degree p\<close> in \<open>auto simp: n_def\<close>)
[PROOF STATE]
proof (state)
this:
degree (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i) < n - i

goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
degree ([:coeff p n:] * coeff (x_y ^ n) i) = n - i
degree (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i) < n - i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree ([:coeff p n:] * coeff (x_y ^ n) i) = n - i
degree (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i) < n - i

goal (1 subgoal):
 1. degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i
[PROOF STEP]
by (subst degree_add_eq_left) auto
[PROOF STATE]
proof (state)
this:
degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree ([:coeff p n:] * coeff (x_y ^ n) i + (\<Sum>j<n. [:coeff p j:] * coeff (x_y ^ j) i)) = n - i

goal (1 subgoal):
 1. i < degree p \<Longrightarrow> degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (coeff (poly_x_minus_y p) i) = n - i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (coeff (poly_x_minus_y p) i) = n - i

goal (1 subgoal):
 1. degree (coeff (poly_x_minus_y p) i) = degree p - i
[PROOF STEP]
by (simp add: n_def)
[PROOF STATE]
proof (state)
this:
degree (coeff (poly_x_minus_y p) i) = degree p - i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (coeff (poly_x_minus_y p) i) = degree p - i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma AE_exponential: "0 < l \<Longrightarrow> AE x in exponential l. 0 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < l \<Longrightarrow> almost_everywhere (exponential l) ((<) 0)
[PROOF STEP]
unfolding exponential_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < l \<Longrightarrow> almost_everywhere (density lborel (\<lambda>x. ennreal (exponential_density l x))) ((<) 0)
[PROOF STEP]
using AE_lborel_singleton[of 0]
[PROOF STATE]
proof (prove)
using this:
AE x in lborel. x \<noteq> (0::?'a1)

goal (1 subgoal):
 1. 0 < l \<Longrightarrow> almost_everywhere (density lborel (\<lambda>x. ennreal (exponential_density l x))) ((<) 0)
[PROOF STEP]
by (auto simp add: AE_density exponential_density_def)


[STATEMENT]
lemma tan_pos_pi2_le: "0 \<le> x \<Longrightarrow> x < pi/2 \<Longrightarrow> 0 \<le> tan x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x < pi / 2\<rbrakk> \<Longrightarrow> 0 \<le> tan x
[PROOF STEP]
using less_eq_real_def tan_gt_zero
[PROOF STATE]
proof (prove)
using this:
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)
\<lbrakk>0 < ?x; ?x < pi / 2\<rbrakk> \<Longrightarrow> 0 < tan ?x

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x < pi / 2\<rbrakk> \<Longrightarrow> 0 \<le> tan x
[PROOF STEP]
by auto


[STATEMENT]
lemma custom_arccos_has_deriv:
  assumes "- 1 < x" "x < 1"
  shows "DERIV custom_arccos x :> inverse (- sqrt (1 - x\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) has_real_derivative inverse (- sqrt (1 - x\<^sup>2))) (at x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) has_real_derivative inverse (- sqrt (1 - x\<^sup>2))) (at x)
[PROOF STEP]
have x1: "\<bar>x\<bar>\<^sup>2 < 1\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar>\<^sup>2 < 1\<^sup>2
[PROOF STEP]
by (simp add: abs_less_iff abs_square_less_1 assms)
[PROOF STATE]
proof (state)
this:
\<bar>x\<bar>\<^sup>2 < 1\<^sup>2

goal (1 subgoal):
 1. ((\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) has_real_derivative inverse (- sqrt (1 - x\<^sup>2))) (at x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) has_real_derivative inverse (- sqrt (1 - x\<^sup>2))) (at x)
[PROOF STEP]
apply (rule DERIV_inverse_function [where f=cos and a="-1" and b=1])
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. (cos has_real_derivative - sqrt (1 - x\<^sup>2)) (at (if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x))
 2. - sqrt (1 - x\<^sup>2) \<noteq> 0
 3. - 1 < x
 4. x < 1
 5. \<And>y. \<lbrakk>- 1 < y; y < 1\<rbrakk> \<Longrightarrow> cos (if - 1 \<le> y \<and> y \<le> 1 then arccos y else if y < - 1 then - y + pi else 1 - y) = y
 6. isCont (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) x
[PROOF STEP]
apply (rule x1 derivative_eq_intros | simp add: sin_arccos)+
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. (x < - 1 \<longrightarrow> sin x = sqrt (1 - x\<^sup>2)) \<and> (\<not> x < - 1 \<longrightarrow> \<not> x \<le> 1 \<longrightarrow> sin (1 - x) = sqrt (1 - x\<^sup>2))
 2. - sqrt (1 - x\<^sup>2) \<noteq> 0
 3. - 1 < x
 4. x < 1
 5. \<And>y. \<lbrakk>- 1 < y; y < 1\<rbrakk> \<Longrightarrow> cos (if - 1 \<le> y \<and> y \<le> 1 then arccos y else if y < - 1 then - y + pi else 1 - y) = y
 6. isCont (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) x
[PROOF STEP]
using assms x1 cont_custom_arccos [of "{-1<..<1}"]
[PROOF STATE]
proof (prove)
using this:
- 1 < x
x < 1
\<bar>x\<bar>\<^sup>2 < 1\<^sup>2
{- 1<..<1} \<subseteq> {- 1..1} \<Longrightarrow> continuous_on {- 1<..<1} (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x)

goal (6 subgoals):
 1. (x < - 1 \<longrightarrow> sin x = sqrt (1 - x\<^sup>2)) \<and> (\<not> x < - 1 \<longrightarrow> \<not> x \<le> 1 \<longrightarrow> sin (1 - x) = sqrt (1 - x\<^sup>2))
 2. - sqrt (1 - x\<^sup>2) \<noteq> 0
 3. - 1 < x
 4. x < 1
 5. \<And>y. \<lbrakk>- 1 < y; y < 1\<rbrakk> \<Longrightarrow> cos (if - 1 \<le> y \<and> y \<le> 1 then arccos y else if y < - 1 then - y + pi else 1 - y) = y
 6. isCont (\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) x
[PROOF STEP]
apply (auto simp: continuous_on_eq_continuous_at greaterThanLessThan_subseteq_atLeastAtMost_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if - 1 \<le> x \<and> x \<le> 1 then arccos x else if x < - 1 then - x + pi else 1 - x) has_real_derivative inverse (- sqrt (1 - x\<^sup>2))) (at x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inj_on_conv_Ex1: "inj_on f A \<longleftrightarrow> (\<forall>y\<in>f`A. \<exists>!x\<in>A. y = f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on f A = (\<forall>y\<in>f ` A. \<exists>!x. x \<in> A \<and> y = f x)
[PROOF STEP]
by (auto simp: inj_on_def)


[STATEMENT]
lemma meld_mset:
  "\<lbrakk> queue_invar q; queue_invar q' \<rbrakk> \<Longrightarrow>
  queue_to_multiset (meld q q') = queue_to_multiset q + queue_to_multiset q'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>queue_invar q; queue_invar q'\<rbrakk> \<Longrightarrow> queue_to_multiset (meld q q') = queue_to_multiset q + queue_to_multiset q'
[PROOF STEP]
by (simp add: meld_def meldUniq_mset invar_uniqify uniqify_mset[symmetric])


[STATEMENT]
lemma length_dropWhile_le: "length (dropWhile P xs) \<le> length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (dropWhile P xs) \<le> length xs
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma continuous_on_diff_ereal:
  "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> \<bar>f x\<bar> \<noteq> \<infinity>) \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> \<bar>g x\<bar> \<noteq> \<infinity>) \<Longrightarrow> continuous_on A (\<lambda>z. f z - g z::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_on A f; continuous_on A g; \<And>x. x \<in> A \<Longrightarrow> \<bar>f x\<bar> \<noteq> \<infinity>; \<And>x. x \<in> A \<Longrightarrow> \<bar>g x\<bar> \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> continuous_on A (\<lambda>z. f z - g z)
[PROOF STEP]
by (auto simp: tendsto_diff_ereal continuous_on_def)


[STATEMENT]
theorem Gibbard_Satterthwaite:
  "\<not> manipulable f \<Longrightarrow> \<forall>a.\<exists>P\<in>Prof. a = f P \<Longrightarrow> \<exists>i. dict f i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> manipulable f; \<forall>a. \<exists>P\<in>Prof. a = f P\<rbrakk> \<Longrightarrow> \<exists>i. dict f i
[PROOF STEP]
using GS.Gibbard_Satterthwaite[of f,unfolded GS_def]
[PROOF STATE]
proof (prove)
using this:
\<not> manipulable f \<and> f ` Prof = UNIV \<Longrightarrow> \<exists>i. dict f i

goal (1 subgoal):
 1. \<lbrakk>\<not> manipulable f; \<forall>a. \<exists>P\<in>Prof. a = f P\<rbrakk> \<Longrightarrow> \<exists>i. dict f i
[PROOF STEP]
by blast


[STATEMENT]
lemma if_is_pr2 [prec]: "\<lbrakk> p \<in> PrimRec2; q1 \<in> PrimRec2; q2 \<in> PrimRec2\<rbrakk> \<Longrightarrow> (\<lambda> x y. if (p x y = 0) then (q1 x y) else (q2 x y)) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec2; q1 \<in> PrimRec2; q2 \<in> PrimRec2\<rbrakk> \<Longrightarrow> (\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec2; q1 \<in> PrimRec2; q2 \<in> PrimRec2\<rbrakk> \<Longrightarrow> (\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) \<in> PrimRec2
[PROOF STEP]
have if_as_pr: "(\<lambda> x y. if (p x y = 0) then (q1 x y) else (q2 x y)) = (\<lambda> x y. (sgn2 (p x y)) * (q1 x y) + (sgn1 (p x y)) * (q2 x y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) = (\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y)
[PROOF STEP]
proof (rule ext, rule ext)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
show "(if (p x y = 0) then (q1 x y) else (q2 x y)) = (sgn2 (p x y)) * (q1 x y) + (sgn1 (p x y)) * (q2 x y)" (is "?left = ?right")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
 2. \<not> ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
assume A1: "p x y = 0"
[PROOF STATE]
proof (state)
this:
p x y = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
 2. \<not> ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p x y = 0
[PROOF STEP]
have S1: "?left = q1 x y"
[PROOF STATE]
proof (prove)
using this:
p x y = 0

goal (1 subgoal):
 1. (if p x y = 0 then q1 x y else q2 x y) = q1 x y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if p x y = 0 then q1 x y else q2 x y) = q1 x y

goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
 2. \<not> ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
p x y = 0
[PROOF STEP]
have S2: "?right = q1 x y"
[PROOF STATE]
proof (prove)
using this:
p x y = 0

goal (1 subgoal):
 1. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y = q1 x y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y = q1 x y

goal (2 subgoals):
 1. ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
 2. \<not> ?P \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
(if p x y = 0 then q1 x y else q2 x y) = q1 x y
sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y = q1 x y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if p x y = 0 then q1 x y else q2 x y) = q1 x y
sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y = q1 x y

goal (1 subgoal):
 1. (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y

goal (1 subgoal):
 1. p x y \<noteq> 0 \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p x y \<noteq> 0 \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
assume A2: "p x y \<noteq> 0"
[PROOF STATE]
proof (state)
this:
p x y \<noteq> 0

goal (1 subgoal):
 1. p x y \<noteq> 0 \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p x y \<noteq> 0
[PROOF STEP]
have S3: "p x y > 0"
[PROOF STATE]
proof (prove)
using this:
p x y \<noteq> 0

goal (1 subgoal):
 1. 0 < p x y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < p x y

goal (1 subgoal):
 1. p x y \<noteq> 0 \<Longrightarrow> (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < p x y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
0 < p x y

goal (1 subgoal):
 1. (if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(if p x y = 0 then q1 x y else q2 x y) = sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) = (\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y)

goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec2; q1 \<in> PrimRec2; q2 \<in> PrimRec2\<rbrakk> \<Longrightarrow> (\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) \<in> PrimRec2
[PROOF STEP]
assume "p \<in> PrimRec2" and "q1 \<in> PrimRec2" and "q2 \<in> PrimRec2"
[PROOF STATE]
proof (state)
this:
p \<in> PrimRec2
q1 \<in> PrimRec2
q2 \<in> PrimRec2

goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec2; q1 \<in> PrimRec2; q2 \<in> PrimRec2\<rbrakk> \<Longrightarrow> (\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) \<in> PrimRec2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> PrimRec2
q1 \<in> PrimRec2
q2 \<in> PrimRec2
[PROOF STEP]
have "(\<lambda> x y. (sgn2 (p x y)) * (q1 x y) + (sgn1 (p x y)) * (q2 x y)) \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
p \<in> PrimRec2
q1 \<in> PrimRec2
q2 \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y) \<in> PrimRec2
[PROOF STEP]
by prec0
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y) \<in> PrimRec2

goal (1 subgoal):
 1. \<lbrakk>p \<in> PrimRec2; q1 \<in> PrimRec2; q2 \<in> PrimRec2\<rbrakk> \<Longrightarrow> (\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) \<in> PrimRec2
[PROOF STEP]
with if_as_pr
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) = (\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y)
(\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y) \<in> PrimRec2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) = (\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y)
(\<lambda>x y. sgn2 (p x y) * q1 x y + sgn1 (p x y) * q2 x y) \<in> PrimRec2

goal (1 subgoal):
 1. (\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) \<in> PrimRec2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. if p x y = 0 then q1 x y else q2 x y) \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convex_on_linorderI [intro?]:
  fixes A :: "('a::{linorder,real_vector}) set"
  assumes "\<And>t x y. t > 0 \<Longrightarrow> t < 1 \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x < y \<Longrightarrow>
    f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
  shows "convex_on A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on A f
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t x y. \<lbrakk>0 < t; t < 1; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t x y. \<lbrakk>0 < t; t < 1; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
fix t :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t x y. \<lbrakk>0 < t; t < 1; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
assume A: "x \<in> A" "y \<in> A" "t > 0" "t < 1"
[PROOF STATE]
proof (state)
this:
x \<in> A
y \<in> A
0 < t
t < 1

goal (1 subgoal):
 1. \<And>t x y. \<lbrakk>0 < t; t < 1; x \<in> A; y \<in> A\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
with assms [of t x y] assms [of "1 - t" y x]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < t; t < 1; x \<in> A; y \<in> A; x < y\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
\<lbrakk>0 < 1 - t; 1 - t < 1; y \<in> A; x \<in> A; y < x\<rbrakk> \<Longrightarrow> f ((1 - (1 - t)) *\<^sub>R y + (1 - t) *\<^sub>R x) \<le> (1 - (1 - t)) * f y + (1 - t) * f x
x \<in> A
y \<in> A
0 < t
t < 1
[PROOF STEP]
show "f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < t; t < 1; x \<in> A; y \<in> A; x < y\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
\<lbrakk>0 < 1 - t; 1 - t < 1; y \<in> A; x \<in> A; y < x\<rbrakk> \<Longrightarrow> f ((1 - (1 - t)) *\<^sub>R y + (1 - t) *\<^sub>R x) \<le> (1 - (1 - t)) * f y + (1 - t) * f x
x \<in> A
y \<in> A
0 < t
t < 1

goal (1 subgoal):
 1. f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
by (cases x y rule: linorder_cases) (auto simp: algebra_simps)
[PROOF STATE]
proof (state)
this:
f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "exe_ars_conds arss \<Longrightarrow> \<exists>name . map_of (map (apsnd map_of) arss) name = Some ars
  \<Longrightarrow> \<exists>name arsl . (name, arsl) \<in> set arss \<and> map_of arsl = ars"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>exe_ars_conds arss; \<exists>name. map_of (map (apsnd map_of) arss) name = Some ars\<rbrakk> \<Longrightarrow> \<exists>name arsl. (name, arsl) \<in> set arss \<and> map_of arsl = ars
[PROOF STEP]
by (force simp add: exe_ars_conds_def)


[STATEMENT]
lemma scaleC_collapse [simp]: "(1 - u) *\<^sub>C a + u *\<^sub>C a = a"
  for a :: "'a::complex_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 - u) *\<^sub>C a + u *\<^sub>C a = a
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma sample_vars_union:
  "\<lbrakk> finite A; finite B \<rbrakk> \<Longrightarrow> sample_vars X (A \<union> B) m = sample_vars X A (sample_vars X B m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; finite B\<rbrakk> \<Longrightarrow> sample_vars X (A \<union> B) m = sample_vars X A (sample_vars X B m)
[PROOF STEP]
by(subst Un_commute)(rule sample_var.fold_set_union)


[STATEMENT]
lemma composition : "\<lbrakk> f \<in> A \<rightarrow>  B; g \<in> B \<rightarrow> C\<rbrakk> \<Longrightarrow> (compose A g f) \<in> A \<rightarrow>  C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; g \<in> B \<rightarrow> C\<rbrakk> \<Longrightarrow> compose A g f \<in> A \<rightarrow> C
[PROOF STEP]
apply (simp add:Pi_def restrict_def compose_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sum_norm_le: "norm (sum f S) \<le> sum g S"
  if "\<And>x. x \<in> S \<Longrightarrow> norm (f x) \<le> g x"
  for f::"'b \<Rightarrow> 'a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (sum f S) \<le> sum g S
[PROOF STEP]
by (rule order_trans [OF norm_sum sum_mono]) (simp add: that)


[STATEMENT]
lemma Qp_p_nat_pow_pow:
  fixes n::nat
  fixes m::nat
  shows "(\<pp> [^] (n*m)) = ((\<pp>[^]n)[^]m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pp> [^] (n * m) = (\<pp> [^] n) [^] m
[PROOF STEP]
using Qp_nat_pow_pow
[PROOF STATE]
proof (prove)
using this:
?a \<in> carrier Q\<^sub>p \<Longrightarrow> ?a [^] (?n * ?m) = (?a [^] ?n) [^] ?m

goal (1 subgoal):
 1. \<pp> [^] (n * m) = (\<pp> [^] n) [^] m
[PROOF STEP]
by simp


[STATEMENT]
lemma polynomial_function_sum [intro]:
    "\<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> polynomial_function (\<lambda>x. f x i)\<rbrakk> \<Longrightarrow> polynomial_function (\<lambda>x. sum (f x) I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>i. i \<in> I \<Longrightarrow> polynomial_function (\<lambda>x. f x i)\<rbrakk> \<Longrightarrow> polynomial_function (\<lambda>x. sum (f x) I)
[PROOF STEP]
by (induct I rule: finite_induct) auto


[STATEMENT]
lemma congs_length:
  "F\<^sub>1 \<cong> F\<^sub>2 \<Longrightarrow> length F\<^sub>2 = length F\<^sub>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F\<^sub>1 \<cong> F\<^sub>2 \<Longrightarrow> length F\<^sub>2 = length F\<^sub>1
[PROOF STEP]
by (auto simp: congs_def)


[STATEMENT]
lemma mult_imp_div_pos_le: "0 < y \<Longrightarrow> x \<le> z * y \<Longrightarrow> x / y \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < y; x \<le> z * y\<rbrakk> \<Longrightarrow> x / y \<le> z
[PROOF STEP]
by (subst pos_divide_le_eq, assumption+)


[STATEMENT]
lemma fls_divide_shift_both_nonzero:
  fixes   f g :: "'a :: {comm_monoid_add,inverse,times,uminus} fls"
  assumes "f \<noteq> 0" "g \<noteq> 0"
  shows   "fls_shift n f / fls_shift m g = fls_shift (n-m) (f/g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_shift n f / fls_shift m g = fls_shift (n - m) (f / g)
[PROOF STEP]
by      (simp add: assms fls_divide_shift_numer_nonzero fls_divide_shift_denom_nonzero)


[STATEMENT]
lemma alphaInp_sym:
fixes qinp qinp' :: "('index,('index,'bindex,'varSort,'var,'opSym)qTerm)input"
shows "qinp %= qinp' \<Longrightarrow> qinp' %= qinp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (qinp, qinp') \<in> alphaInp \<Longrightarrow> (qinp', qinp) \<in> alphaInp
[PROOF STEP]
using alpha_sym
[PROOF STATE]
proof (prove)
using this:
?X #= ?X' \<Longrightarrow> ?X' #= ?X

goal (1 subgoal):
 1. (qinp, qinp') \<in> alphaInp \<Longrightarrow> (qinp', qinp) \<in> alphaInp
[PROOF STEP]
unfolding alphaInp_def sameDom_def liftAll2_def
[PROOF STATE]
proof (prove)
using this:
?X #= ?X' \<Longrightarrow> ?X' #= ?X

goal (1 subgoal):
 1. (qinp, qinp') \<in> {(qinp, qinp'). (\<forall>i. (qinp i = None) = (qinp' i = None)) \<and> (\<forall>i v1 v2. qinp i = Some v1 \<and> qinp' i = Some v2 \<longrightarrow> v1 #= v2)} \<Longrightarrow> (qinp', qinp) \<in> {(qinp, qinp'). (\<forall>i. (qinp i = None) = (qinp' i = None)) \<and> (\<forall>i v1 v2. qinp i = Some v1 \<and> qinp' i = Some v2 \<longrightarrow> v1 #= v2)}
[PROOF STEP]
by blast


[STATEMENT]
lemma integral_cmul [simp]: "integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
proof (cases "f integrable_on S \<or> c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f integrable_on S \<or> c = 0 \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
 2. \<not> (f integrable_on S \<or> c = 0) \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f integrable_on S \<or> c = 0

goal (2 subgoals):
 1. f integrable_on S \<or> c = 0 \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
 2. \<not> (f integrable_on S \<or> c = 0) \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
with has_integral_cmul integrable_integral
[PROOF STATE]
proof (chain)
picking this:
(?f has_integral ?k) ?S \<Longrightarrow> ((\<lambda>x. ?c *\<^sub>R ?f x) has_integral ?c *\<^sub>R ?k) ?S
?f integrable_on ?i \<Longrightarrow> (?f has_integral integral ?i ?f) ?i
f integrable_on S \<or> c = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(?f has_integral ?k) ?S \<Longrightarrow> ((\<lambda>x. ?c *\<^sub>R ?f x) has_integral ?c *\<^sub>R ?k) ?S
?f integrable_on ?i \<Longrightarrow> (?f has_integral integral ?i ?f) ?i
f integrable_on S \<or> c = 0

goal (1 subgoal):
 1. integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f

goal (1 subgoal):
 1. \<not> (f integrable_on S \<or> c = 0) \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (f integrable_on S \<or> c = 0) \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (f integrable_on S \<or> c = 0)

goal (1 subgoal):
 1. \<not> (f integrable_on S \<or> c = 0) \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (f integrable_on S \<or> c = 0)
[PROOF STEP]
have "\<not> (\<lambda>x. c *\<^sub>R f x) integrable_on S"
[PROOF STATE]
proof (prove)
using this:
\<not> (f integrable_on S \<or> c = 0)

goal (1 subgoal):
 1. \<not> (\<lambda>x. c *\<^sub>R f x) integrable_on S
[PROOF STEP]
using has_integral_cmul [of "(\<lambda>x. c *\<^sub>R f x)" _ S "inverse c"]
[PROOF STATE]
proof (prove)
using this:
\<not> (f integrable_on S \<or> c = 0)
((\<lambda>x. c *\<^sub>R f x) has_integral ?k) S \<Longrightarrow> ((\<lambda>x. c *\<^sub>R f x /\<^sub>R c) has_integral ?k /\<^sub>R c) S

goal (1 subgoal):
 1. \<not> (\<lambda>x. c *\<^sub>R f x) integrable_on S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> (\<lambda>x. c *\<^sub>R f x) integrable_on S

goal (1 subgoal):
 1. \<not> (f integrable_on S \<or> c = 0) \<Longrightarrow> integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> (f integrable_on S \<or> c = 0)
\<not> (\<lambda>x. c *\<^sub>R f x) integrable_on S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (f integrable_on S \<or> c = 0)
\<not> (\<lambda>x. c *\<^sub>R f x) integrable_on S

goal (1 subgoal):
 1. integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f
[PROOF STEP]
by (simp add: not_integrable_integral)
[PROOF STATE]
proof (state)
this:
integral S (\<lambda>x. c *\<^sub>R f x) = c *\<^sub>R integral S f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma imp_for'_rule:
  assumes LESS: "l\<le>u"
  assumes PRE: "P \<Longrightarrow>\<^sub>A I l s"
  assumes STEP: "\<And>i s. \<lbrakk> l\<le>i; i<u \<rbrakk> \<Longrightarrow> <I i s> f i s <I (i+1)>"
  shows "<P> imp_for' l u f s <I u>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <P> imp_for' l u f s <I u>
[PROOF STEP]
apply (rule Hoare_Triple.cons_pre_rule[OF PRE])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <I l s> imp_for' l u f s <I u>
[PROOF STEP]
using LESS
[PROOF STATE]
proof (prove)
using this:
l \<le> u

goal (1 subgoal):
 1. <I l s> imp_for' l u f s <I u>
[PROOF STEP]
proof (induction arbitrary: s rule: inc_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>s. <I u s> imp_for' u u f s <I u>
 2. \<And>n s. \<lbrakk>l \<le> n; n < u; \<And>s. <I (Suc n) s> imp_for' (Suc n) u f s <I u>\<rbrakk> \<Longrightarrow> <I n s> imp_for' n u f s <I u>
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>s. <I u s> imp_for' u u f s <I u>
 2. \<And>n s. \<lbrakk>l \<le> n; n < u; \<And>s. <I (Suc n) s> imp_for' (Suc n) u f s <I u>\<rbrakk> \<Longrightarrow> <I n s> imp_for' n u f s <I u>
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <I u s> imp_for' u u f s <I u>
[PROOF STEP]
by sep_auto
[PROOF STATE]
proof (state)
this:
<I u s> imp_for' u u f s <I u>

goal (1 subgoal):
 1. \<And>n s. \<lbrakk>l \<le> n; n < u; \<And>s. <I (Suc n) s> imp_for' (Suc n) u f s <I u>\<rbrakk> \<Longrightarrow> <I n s> imp_for' n u f s <I u>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n s. \<lbrakk>l \<le> n; n < u; \<And>s. <I (Suc n) s> imp_for' (Suc n) u f s <I u>\<rbrakk> \<Longrightarrow> <I n s> imp_for' n u f s <I u>
[PROOF STEP]
case (step k)
[PROOF STATE]
proof (state)
this:
l \<le> k
k < u
<I (Suc k) ?s> imp_for' (Suc k) u f ?s <I u>

goal (1 subgoal):
 1. \<And>n s. \<lbrakk>l \<le> n; n < u; \<And>s. <I (Suc n) s> imp_for' (Suc n) u f s <I u>\<rbrakk> \<Longrightarrow> <I n s> imp_for' n u f s <I u>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <I k s> imp_for' k u f s <I u>
[PROOF STEP]
using step.hyps
[PROOF STATE]
proof (prove)
using this:
l \<le> k
k < u

goal (1 subgoal):
 1. <I k s> imp_for' k u f s <I u>
[PROOF STEP]
by (sep_auto heap: STEP step.IH)
[PROOF STATE]
proof (state)
this:
<I k s> imp_for' k u f s <I u>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma par_strict_all_one_side:
  assumes "A B ParStrict C D"
  shows "\<forall> P. Col C D P \<longrightarrow> A B OS C P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>P. Col C D P \<longrightarrow> A B OS C P
[PROOF STEP]
using assms par_strict_one_side
[PROOF STATE]
proof (prove)
using this:
A B ParStrict C D
\<lbrakk>?A ?B ParStrict ?C ?D; Col ?C ?D ?P\<rbrakk> \<Longrightarrow> ?A ?B OS ?C ?P

goal (1 subgoal):
 1. \<forall>P. Col C D P \<longrightarrow> A B OS C P
[PROOF STEP]
by blast


[STATEMENT]
lemma rk_empty: "rk {} = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {} = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rk {} = 0
[PROOF STEP]
have "rk {} \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> rk {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> rk {}

goal (1 subgoal):
 1. rk {} = 0
[PROOF STEP]
have "rk {} \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rk {} \<le> 0
[PROOF STEP]
by (metis card.empty matroid_ax_1b)
[PROOF STATE]
proof (state)
this:
rk {} \<le> 0

goal (1 subgoal):
 1. rk {} = 0
[PROOF STEP]
thus "rk {} = 0"
[PROOF STATE]
proof (prove)
using this:
rk {} \<le> 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uset_l:
  assumes lp: "isrlfm p"
  shows "\<forall>(t,k) \<in> set (uset p). numbound0 t \<and> k > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>(t, k)\<in>set (uset p). numbound0 t \<and> 0 < k
[PROOF STEP]
using lp
[PROOF STATE]
proof (prove)
using this:
isrlfm p

goal (1 subgoal):
 1. \<forall>(t, k)\<in>set (uset p). numbound0 t \<and> 0 < k
[PROOF STEP]
by (induct p rule: uset.induct) auto


[STATEMENT]
lemma stream_rel_sconst[iff]: "stream_all2 P (sconst x) (sconst y) \<longleftrightarrow> P x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stream_all2 P (sconst x) (sconst y) = P x y
[PROOF STEP]
unfolding stream_rel_snth
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i. P (sconst x !! i) (sconst y !! i)) = P x y
[PROOF STEP]
by simp


[STATEMENT]
lemma cube_form_mult: "\<lbrakk> is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1 \<rbrakk>
  \<Longrightarrow> is_cube_form (a*c+e*3*b*d) (a*d-e*b*c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
assume ab: "is_cube_form a b" and c_d: "is_cube_form c d" and e: "\<bar>e\<bar> = 1"
[PROOF STATE]
proof (state)
this:
is_cube_form a b
is_cube_form c d
\<bar>e\<bar> = 1

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
from ab
[PROOF STATE]
proof (chain)
picking this:
is_cube_form a b
[PROOF STEP]
obtain p q where pq: "a = p^3 - 9*p*q^2 \<and> b = 3*p^2*q - 3*q^3"
[PROOF STATE]
proof (prove)
using this:
is_cube_form a b

goal (1 subgoal):
 1. (\<And>p q. a = p ^ 3 - 9 * p * q\<^sup>2 \<and> b = 3 * p\<^sup>2 * q - 3 * q ^ 3 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp only: is_cube_form_def)
[PROOF STATE]
proof (state)
this:
a = p ^ 3 - 9 * p * q\<^sup>2 \<and> b = 3 * p\<^sup>2 * q - 3 * q ^ 3

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
from c_d
[PROOF STATE]
proof (chain)
picking this:
is_cube_form c d
[PROOF STEP]
obtain r s where rs: "c = r^3 - 9*r*s^2 \<and> d = 3*r^2*s - 3*s^3"
[PROOF STATE]
proof (prove)
using this:
is_cube_form c d

goal (1 subgoal):
 1. (\<And>r s. c = r ^ 3 - 9 * r * s\<^sup>2 \<and> d = 3 * r\<^sup>2 * s - 3 * s ^ 3 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp only: is_cube_form_def)
[PROOF STATE]
proof (state)
this:
c = r ^ 3 - 9 * r * s\<^sup>2 \<and> d = 3 * r\<^sup>2 * s - 3 * s ^ 3

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
let ?t = "p*r + e*3*q*s"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
let ?u = "p*s - e*r*q"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
have e2: "e^2=1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
from e
[PROOF STATE]
proof (chain)
picking this:
\<bar>e\<bar> = 1
[PROOF STEP]
have "e=1 \<or> e=-1"
[PROOF STATE]
proof (prove)
using this:
\<bar>e\<bar> = 1

goal (1 subgoal):
 1. e = 1 \<or> e = - 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
e = 1 \<or> e = - 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
e = 1 \<or> e = - 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
e = 1 \<or> e = - 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
assume "e=1"
[PROOF STATE]
proof (state)
this:
e = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
hence ?thesis
[PROOF STATE]
proof (prove)
using this:
e = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e\<^sup>2 = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
e = 1 \<Longrightarrow> e\<^sup>2 = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
e = 1 \<Longrightarrow> e\<^sup>2 = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
e = 1 \<Longrightarrow> e\<^sup>2 = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
assume "e=-1"
[PROOF STATE]
proof (state)
this:
e = - 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
hence ?thesis
[PROOF STATE]
proof (prove)
using this:
e = - 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
e\<^sup>2 = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
e = - 1 \<Longrightarrow> e\<^sup>2 = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
e = 1 \<or> e = - 1
e = 1 \<Longrightarrow> e\<^sup>2 = 1
e = - 1 \<Longrightarrow> e\<^sup>2 = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
e = 1 \<or> e = - 1
e = 1 \<Longrightarrow> e\<^sup>2 = 1
e = - 1 \<Longrightarrow> e\<^sup>2 = 1

goal (1 subgoal):
 1. e\<^sup>2 = 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
e\<^sup>2 = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
e\<^sup>2 = 1

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
hence "e*e^2 = e"
[PROOF STATE]
proof (prove)
using this:
e\<^sup>2 = 1

goal (1 subgoal):
 1. e * e\<^sup>2 = e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
e * e\<^sup>2 = e

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
hence e3: "e*1 = e^3"
[PROOF STATE]
proof (prove)
using this:
e * e\<^sup>2 = e

goal (1 subgoal):
 1. e * 1 = e ^ 3
[PROOF STEP]
by (simp only: power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
e * 1 = e ^ 3

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
have "a*c+e*3*b*d = ?t^3 - 9*?t*?u^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
have "?t^3 - 9*?t*?u^2 = p^3*r^3 + e*9*p^2*q*r^2*s + e^2*27*p*q^2*r*s^2
      + e^3*27*q^3*s^3 - 9*p*p^2*r*s^2 + e*18*p^2*q*r^2*s - e^2*9*p*q^2*(r*r^2)
      - e*27*p^2*q*(s*s^2) + e^2*54*p*q^2*r*s^2 - e*e^2*27*(q*q^2)*r^2*s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2 = p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s
[PROOF STEP]
by (simp add: eval_nat_numeral field_simps)
[PROOF STATE]
proof (state)
this:
(p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2 = p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s

goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2 = p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s

goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
with e2 e3
[PROOF STATE]
proof (chain)
picking this:
e\<^sup>2 = 1
e * 1 = e ^ 3
(p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2 = p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s
[PROOF STEP]
have "\<dots> =
      p^3*r^3 + e*27*p^2*q*r^2*s + 81*p*q^2*r*s^2 + e*27*q^3*s^3
      - 9*p^3*r*s^2 - 9*p*q^2*r^3 - e*27*p^2*q*s^3 - e*27*q^3*r^2*s"
[PROOF STATE]
proof (prove)
using this:
e\<^sup>2 = 1
e * 1 = e ^ 3
(p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2 = p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s

goal (1 subgoal):
 1. p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s = p ^ 3 * r ^ 3 + e * 27 * p\<^sup>2 * q * r\<^sup>2 * s + 81 * p * q\<^sup>2 * r * s\<^sup>2 + e * 27 * q ^ 3 * s ^ 3 - 9 * p ^ 3 * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r ^ 3 - e * 27 * p\<^sup>2 * q * s ^ 3 - e * 27 * q ^ 3 * r\<^sup>2 * s
[PROOF STEP]
by (simp add: power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s = p ^ 3 * r ^ 3 + e * 27 * p\<^sup>2 * q * r\<^sup>2 * s + 81 * p * q\<^sup>2 * r * s\<^sup>2 + e * 27 * q ^ 3 * s ^ 3 - 9 * p ^ 3 * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r ^ 3 - e * 27 * p\<^sup>2 * q * s ^ 3 - e * 27 * q ^ 3 * r\<^sup>2 * s

goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s = p ^ 3 * r ^ 3 + e * 27 * p\<^sup>2 * q * r\<^sup>2 * s + 81 * p * q\<^sup>2 * r * s\<^sup>2 + e * 27 * q ^ 3 * s ^ 3 - 9 * p ^ 3 * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r ^ 3 - e * 27 * p\<^sup>2 * q * s ^ 3 - e * 27 * q ^ 3 * r\<^sup>2 * s

goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
with pq rs
[PROOF STATE]
proof (chain)
picking this:
a = p ^ 3 - 9 * p * q\<^sup>2 \<and> b = 3 * p\<^sup>2 * q - 3 * q ^ 3
c = r ^ 3 - 9 * r * s\<^sup>2 \<and> d = 3 * r\<^sup>2 * s - 3 * s ^ 3
p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s = p ^ 3 * r ^ 3 + e * 27 * p\<^sup>2 * q * r\<^sup>2 * s + 81 * p * q\<^sup>2 * r * s\<^sup>2 + e * 27 * q ^ 3 * s ^ 3 - 9 * p ^ 3 * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r ^ 3 - e * 27 * p\<^sup>2 * q * s ^ 3 - e * 27 * q ^ 3 * r\<^sup>2 * s
[PROOF STEP]
have "\<dots> = a*c + e*3*b*d"
[PROOF STATE]
proof (prove)
using this:
a = p ^ 3 - 9 * p * q\<^sup>2 \<and> b = 3 * p\<^sup>2 * q - 3 * q ^ 3
c = r ^ 3 - 9 * r * s\<^sup>2 \<and> d = 3 * r\<^sup>2 * s - 3 * s ^ 3
p ^ 3 * r ^ 3 + e * 9 * p\<^sup>2 * q * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * r * s\<^sup>2 + e ^ 3 * 27 * q ^ 3 * s ^ 3 - 9 * p * p\<^sup>2 * r * s\<^sup>2 + e * 18 * p\<^sup>2 * q * r\<^sup>2 * s - e\<^sup>2 * 9 * p * q\<^sup>2 * (r * r\<^sup>2) - e * 27 * p\<^sup>2 * q * (s * s\<^sup>2) + e\<^sup>2 * 54 * p * q\<^sup>2 * r * s\<^sup>2 - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r\<^sup>2 * s = p ^ 3 * r ^ 3 + e * 27 * p\<^sup>2 * q * r\<^sup>2 * s + 81 * p * q\<^sup>2 * r * s\<^sup>2 + e * 27 * q ^ 3 * s ^ 3 - 9 * p ^ 3 * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r ^ 3 - e * 27 * p\<^sup>2 * q * s ^ 3 - e * 27 * q ^ 3 * r\<^sup>2 * s

goal (1 subgoal):
 1. p ^ 3 * r ^ 3 + e * 27 * p\<^sup>2 * q * r\<^sup>2 * s + 81 * p * q\<^sup>2 * r * s\<^sup>2 + e * 27 * q ^ 3 * s ^ 3 - 9 * p ^ 3 * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r ^ 3 - e * 27 * p\<^sup>2 * q * s ^ 3 - e * 27 * q ^ 3 * r\<^sup>2 * s = a * c + e * 3 * b * d
[PROOF STEP]
by (simp only: left_diff_distrib right_diff_distrib ac_simps)
[PROOF STATE]
proof (state)
this:
p ^ 3 * r ^ 3 + e * 27 * p\<^sup>2 * q * r\<^sup>2 * s + 81 * p * q\<^sup>2 * r * s\<^sup>2 + e * 27 * q ^ 3 * s ^ 3 - 9 * p ^ 3 * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r ^ 3 - e * 27 * p\<^sup>2 * q * s ^ 3 - e * 27 * q ^ 3 * r\<^sup>2 * s = a * c + e * 3 * b * d

goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2 = a * c + e * 3 * b * d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2 = a * c + e * 3 * b * d

goal (1 subgoal):
 1. a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
have "a*d-e*b*c = 3*?t^2*?u - 3*?u^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
have "3*?t^2*?u - 3*?u^3 =
      3*(p*p^2)*r^2*s - e*3*p^2*q*(r*r^2) + e*18*p^2*q*r*s^2
      - e^2*18*p*q^2*r^2*s + e^2*27*p*q^2*(s*s^2) - e*e^2*27*(q*q^2)*r*s^2
      - 3*p^3*s^3 + e*9*p^2*q*r*s^2 - e^2*9*p*q^2*r^2*s + e^3*3*r^3*q^3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3 = 3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3
[PROOF STEP]
by (simp add: eval_nat_numeral field_simps)
[PROOF STATE]
proof (state)
this:
3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3 = 3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3

goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3 = 3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3

goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
with e2 e3
[PROOF STATE]
proof (chain)
picking this:
e\<^sup>2 = 1
e * 1 = e ^ 3
3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3 = 3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3
[PROOF STEP]
have "\<dots> = 3*p^3*r^2*s - e*3*p^2*q*r^3 + e*18*p^2*q*r*s^2
      - 18*p*q^2*r^2*s + 27*p*q^2*s^3 - e*27*q^3*r*s^2 - 3*p^3*s^3
      + e*9*p^2*q*r*s^2 - 9*p*q^2*r^2*s + e*3*r^3*q^3"
[PROOF STATE]
proof (prove)
using this:
e\<^sup>2 = 1
e * 1 = e ^ 3
3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3 = 3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3

goal (1 subgoal):
 1. 3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3 = 3 * p ^ 3 * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * r ^ 3 + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - 18 * p * q\<^sup>2 * r\<^sup>2 * s + 27 * p * q\<^sup>2 * s ^ 3 - e * 27 * q ^ 3 * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r\<^sup>2 * s + e * 3 * r ^ 3 * q ^ 3
[PROOF STEP]
by (simp add: power2_eq_square power3_eq_cube)
[PROOF STATE]
proof (state)
this:
3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3 = 3 * p ^ 3 * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * r ^ 3 + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - 18 * p * q\<^sup>2 * r\<^sup>2 * s + 27 * p * q\<^sup>2 * s ^ 3 - e * 27 * q ^ 3 * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r\<^sup>2 * s + e * 3 * r ^ 3 * q ^ 3

goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3 = 3 * p ^ 3 * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * r ^ 3 + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - 18 * p * q\<^sup>2 * r\<^sup>2 * s + 27 * p * q\<^sup>2 * s ^ 3 - e * 27 * q ^ 3 * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r\<^sup>2 * s + e * 3 * r ^ 3 * q ^ 3

goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
with pq rs
[PROOF STATE]
proof (chain)
picking this:
a = p ^ 3 - 9 * p * q\<^sup>2 \<and> b = 3 * p\<^sup>2 * q - 3 * q ^ 3
c = r ^ 3 - 9 * r * s\<^sup>2 \<and> d = 3 * r\<^sup>2 * s - 3 * s ^ 3
3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3 = 3 * p ^ 3 * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * r ^ 3 + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - 18 * p * q\<^sup>2 * r\<^sup>2 * s + 27 * p * q\<^sup>2 * s ^ 3 - e * 27 * q ^ 3 * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r\<^sup>2 * s + e * 3 * r ^ 3 * q ^ 3
[PROOF STEP]
have "\<dots> = a*d-e*b*c"
[PROOF STATE]
proof (prove)
using this:
a = p ^ 3 - 9 * p * q\<^sup>2 \<and> b = 3 * p\<^sup>2 * q - 3 * q ^ 3
c = r ^ 3 - 9 * r * s\<^sup>2 \<and> d = 3 * r\<^sup>2 * s - 3 * s ^ 3
3 * (p * p\<^sup>2) * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * (r * r\<^sup>2) + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 18 * p * q\<^sup>2 * r\<^sup>2 * s + e\<^sup>2 * 27 * p * q\<^sup>2 * (s * s\<^sup>2) - e * e\<^sup>2 * 27 * (q * q\<^sup>2) * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - e\<^sup>2 * 9 * p * q\<^sup>2 * r\<^sup>2 * s + e ^ 3 * 3 * r ^ 3 * q ^ 3 = 3 * p ^ 3 * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * r ^ 3 + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - 18 * p * q\<^sup>2 * r\<^sup>2 * s + 27 * p * q\<^sup>2 * s ^ 3 - e * 27 * q ^ 3 * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r\<^sup>2 * s + e * 3 * r ^ 3 * q ^ 3

goal (1 subgoal):
 1. 3 * p ^ 3 * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * r ^ 3 + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - 18 * p * q\<^sup>2 * r\<^sup>2 * s + 27 * p * q\<^sup>2 * s ^ 3 - e * 27 * q ^ 3 * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r\<^sup>2 * s + e * 3 * r ^ 3 * q ^ 3 = a * d - e * b * c
[PROOF STEP]
by (simp only: left_diff_distrib right_diff_distrib ac_simps)
[PROOF STATE]
proof (state)
this:
3 * p ^ 3 * r\<^sup>2 * s - e * 3 * p\<^sup>2 * q * r ^ 3 + e * 18 * p\<^sup>2 * q * r * s\<^sup>2 - 18 * p * q\<^sup>2 * r\<^sup>2 * s + 27 * p * q\<^sup>2 * s ^ 3 - e * 27 * q ^ 3 * r * s\<^sup>2 - 3 * p ^ 3 * s ^ 3 + e * 9 * p\<^sup>2 * q * r * s\<^sup>2 - 9 * p * q\<^sup>2 * r\<^sup>2 * s + e * 3 * r ^ 3 * q ^ 3 = a * d - e * b * c

goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3 = a * d - e * b * c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3 = a * d - e * b * c

goal (1 subgoal):
 1. a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3

goal (1 subgoal):
 1. \<lbrakk>is_cube_form a b; is_cube_form c d; \<bar>e\<bar> = 1\<rbrakk> \<Longrightarrow> is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a * c + e * 3 * b * d = (p * r + e * 3 * q * s) ^ 3 - 9 * (p * r + e * 3 * q * s) * (p * s - e * r * q)\<^sup>2
a * d - e * b * c = 3 * (p * r + e * 3 * q * s)\<^sup>2 * (p * s - e * r * q) - 3 * (p * s - e * r * q) ^ 3

goal (1 subgoal):
 1. is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)
[PROOF STEP]
by (auto simp only: is_cube_form_def)
[PROOF STATE]
proof (state)
this:
is_cube_form (a * c + e * 3 * b * d) (a * d - e * b * c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_first_last_append[simp]:
  assumes "v \<in> carrier_vec (n+m)" shows "vec_first v n @\<^sub>v vec_last v m = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_first v n @\<^sub>v vec_last v m = v
[PROOF STEP]
apply(rule)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec v \<Longrightarrow> (vec_first v n @\<^sub>v vec_last v m) $ i = v $ i
 2. dim_vec (vec_first v n @\<^sub>v vec_last v m) = dim_vec v
[PROOF STEP]
unfolding vec_first_def vec_last_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < dim_vec v \<Longrightarrow> (vec n (($) v) @\<^sub>v vec m (\<lambda>i. v $ (dim_vec v - m + i))) $ i = v $ i
 2. dim_vec (vec n (($) v) @\<^sub>v vec m (\<lambda>i. v $ (dim_vec v - m + i))) = dim_vec v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec (n + m)

goal (2 subgoals):
 1. \<And>i. i < dim_vec v \<Longrightarrow> (vec n (($) v) @\<^sub>v vec m (\<lambda>i. v $ (dim_vec v - m + i))) $ i = v $ i
 2. dim_vec (vec n (($) v) @\<^sub>v vec m (\<lambda>i. v $ (dim_vec v - m + i))) = dim_vec v
[PROOF STEP]
by auto


[STATEMENT]
lemma degree_sum_list_le: "(\<And>p. p \<in> set ps \<Longrightarrow> degree p \<le> T) \<Longrightarrow> degree (sum_list ps) \<le> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>p. p \<in> set ps \<Longrightarrow> degree p \<le> T) \<Longrightarrow> degree (sum_list ps) \<le> T
[PROOF STEP]
by (induction ps) (auto intro: degree_add_le)


[STATEMENT]
lemma Bernstein_symmetry:
  assumes "j \<le> p"
  shows "(Bernstein_Poly_01 j p) \<circ>\<^sub>p [:1, -1:] = Bernstein_Poly_01 (p-j) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
have "(Bernstein_Poly_01 j p) \<circ>\<^sub>p [:1, -1:]
         = ((monom (p choose j) j) * (monom 1 (p-j) \<circ>\<^sub>p [:1, -1:])) \<circ>\<^sub>p [:1, -1:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = (monom (real (p choose j)) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:]
[PROOF STEP]
by (simp add: Bernstein_Poly_01_def)
[PROOF STATE]
proof (state)
this:
Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = (monom (real (p choose j)) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:]

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = (monom (real (p choose j)) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:]

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
have "... = (monom (p choose (p-j)) j *
                    (monom 1 (p-j) \<circ>\<^sub>p [:1, -1:])) \<circ>\<^sub>p [:1, -1:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (monom (real (p choose j)) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:] = (monom (real (p choose (p - j))) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:]
[PROOF STEP]
by (fastforce simp: binomial_symmetric[OF assms])
[PROOF STATE]
proof (state)
this:
(monom (real (p choose j)) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:] = (monom (real (p choose (p - j))) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:]

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(monom (real (p choose j)) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:] = (monom (real (p choose (p - j))) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:]

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
have "... = monom (p choose (p-j)) j \<circ>\<^sub>p [:1, -1:] *
                   (monom 1 (p-j)) \<circ>\<^sub>p ([:1, -1:] \<circ>\<^sub>p [:1, -1:])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (monom (real (p choose (p - j))) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:] = monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) \<circ>\<^sub>p ([:1, - 1:] \<circ>\<^sub>p [:1, - 1:])
[PROOF STEP]
by (force simp: pcompose_mult pcompose_assoc)
[PROOF STATE]
proof (state)
this:
(monom (real (p choose (p - j))) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:] = monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) \<circ>\<^sub>p ([:1, - 1:] \<circ>\<^sub>p [:1, - 1:])

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(monom (real (p choose (p - j))) j * monom 1 (p - j) \<circ>\<^sub>p [:1, - 1:]) \<circ>\<^sub>p [:1, - 1:] = monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) \<circ>\<^sub>p ([:1, - 1:] \<circ>\<^sub>p [:1, - 1:])

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
have "... = (monom (p choose (p-j)) j \<circ>\<^sub>p [:1, -1:]) * monom 1 (p-j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) \<circ>\<^sub>p ([:1, - 1:] \<circ>\<^sub>p [:1, - 1:]) = monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j)
[PROOF STEP]
by (force simp: pcompose_pCons)
[PROOF STATE]
proof (state)
this:
monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) \<circ>\<^sub>p ([:1, - 1:] \<circ>\<^sub>p [:1, - 1:]) = monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j)

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) \<circ>\<^sub>p ([:1, - 1:] \<circ>\<^sub>p [:1, - 1:]) = monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j)

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
have "... = smult (p choose (p-j)) (monom 1 j \<circ>\<^sub>p [:1, -1:])
                    * monom 1 (p-j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) = smult (real (p choose (p - j))) (monom 1 j \<circ>\<^sub>p [:1, - 1:]) * monom 1 (p - j)
[PROOF STEP]
by (simp add: assms smult_monom pcompose_smult[symmetric])
[PROOF STATE]
proof (state)
this:
monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) = smult (real (p choose (p - j))) (monom 1 j \<circ>\<^sub>p [:1, - 1:]) * monom 1 (p - j)

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
monom (real (p choose (p - j))) j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j) = smult (real (p choose (p - j))) (monom 1 j \<circ>\<^sub>p [:1, - 1:]) * monom 1 (p - j)

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
have "... = (monom 1 j \<circ>\<^sub>p [:1, -1:]) * monom (p choose (p-j)) (p-j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (real (p choose (p - j))) (monom 1 j \<circ>\<^sub>p [:1, - 1:]) * monom 1 (p - j) = monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j)
[PROOF STEP]
apply (subst mult_smult_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult (real (p choose (p - j))) (monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom 1 (p - j)) = monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j)
[PROOF STEP]
apply (subst mult_smult_right[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom 1 j \<circ>\<^sub>p [:1, - 1:] * smult (real (p choose (p - j))) (monom 1 (p - j)) = monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j)
[PROOF STEP]
apply (subst smult_monom)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j)) * 1) (p - j) = monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
smult (real (p choose (p - j))) (monom 1 j \<circ>\<^sub>p [:1, - 1:]) * monom 1 (p - j) = monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j)

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
smult (real (p choose (p - j))) (monom 1 j \<circ>\<^sub>p [:1, - 1:]) * monom 1 (p - j) = monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j)

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
have "... = Bernstein_Poly_01 (p-j) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j) = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j \<le> p

goal (1 subgoal):
 1. monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j) = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
by (auto simp: Bernstein_Poly_01_def)
[PROOF STATE]
proof (state)
this:
monom 1 j \<circ>\<^sub>p [:1, - 1:] * monom (real (p choose (p - j))) (p - j) = Bernstein_Poly_01 (p - j) p

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p

goal (1 subgoal):
 1. Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Bernstein_Poly_01 j p \<circ>\<^sub>p [:1, - 1:] = Bernstein_Poly_01 (p - j) p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma infinite_lessThan_infty: "\<not> finite {..<\<infinity> :: enat}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite {..<\<infinity>}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {..<\<infinity>} \<Longrightarrow> False
[PROOF STEP]
have "range enat \<subseteq> {..<\<infinity>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range enat \<subseteq> {..<\<infinity>}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
range enat \<subseteq> {..<\<infinity>}

goal (1 subgoal):
 1. finite {..<\<infinity>} \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
range enat \<subseteq> {..<\<infinity>}

goal (1 subgoal):
 1. finite {..<\<infinity>} \<Longrightarrow> False
[PROOF STEP]
assume "finite {..<\<infinity> :: enat}"
[PROOF STATE]
proof (state)
this:
finite {..<\<infinity>}

goal (1 subgoal):
 1. finite {..<\<infinity>} \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
range enat \<subseteq> {..<\<infinity>}
finite {..<\<infinity>}
[PROOF STEP]
have "finite (range enat)"
[PROOF STATE]
proof (prove)
using this:
range enat \<subseteq> {..<\<infinity>}
finite {..<\<infinity>}

goal (1 subgoal):
 1. finite (range enat)
[PROOF STEP]
by(rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite (range enat)

goal (1 subgoal):
 1. finite {..<\<infinity>} \<Longrightarrow> False
[PROOF STEP]
hence "finite (UNIV :: nat set)"
[PROOF STATE]
proof (prove)
using this:
finite (range enat)

goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
by(rule finite_imageD)(simp add: inj_on_def)
[PROOF STATE]
proof (state)
this:
finite UNIV

goal (1 subgoal):
 1. finite {..<\<infinity>} \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
finite UNIV

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

goal:
No subgoals!
[PROOF STEP]
qed