[STATEMENT]
lemma measurable_gaussian_density[measurable]:
  "case_prod gaussian_density \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
have "case_prod gaussian_density =
              (\<lambda>(x,y). (if snd x > 0 then exp (-((y - fst x)^2) / (2 * snd x^2)) /
                             sqrt (2 * pi * snd x^2) else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). gaussian_density x y) = (\<lambda>x. ennreal (case x of (x, y) \<Rightarrow> if 0 < snd x then exp (- (y - fst x)\<^sup>2 / (2 * (snd x)\<^sup>2)) / sqrt (2 * pi * (snd x)\<^sup>2) else 0))
[PROOF STEP]
unfolding gaussian_density_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, xa). ennreal ((case x of (m, s) \<Rightarrow> \<lambda>x. if 0 < s then exp (- (x - m)\<^sup>2 / (2 * s\<^sup>2)) / sqrt (2 * pi * s\<^sup>2) else 0) xa)) = (\<lambda>x. ennreal (case x of (x, y) \<Rightarrow> if 0 < snd x then exp (- (y - fst x)\<^sup>2 / (2 * (snd x)\<^sup>2)) / sqrt (2 * pi * (snd x)\<^sup>2) else 0))
[PROOF STEP]
by (intro ext) (simp split: prod.split)
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). gaussian_density x y) = (\<lambda>x. ennreal (case x of (x, y) \<Rightarrow> if 0 < snd x then exp (- (y - fst x)\<^sup>2 / (2 * (snd x)\<^sup>2)) / sqrt (2 * pi * (snd x)\<^sup>2) else 0))

goal (1 subgoal):
 1. (\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). gaussian_density x y) = (\<lambda>x. ennreal (case x of (x, y) \<Rightarrow> if 0 < snd x then exp (- (y - fst x)\<^sup>2 / (2 * (snd x)\<^sup>2)) / sqrt (2 * pi * (snd x)\<^sup>2) else 0))

goal (1 subgoal):
 1. (\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
have "... \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ennreal (case x of (x, y) \<Rightarrow> if 0 < snd x then exp (- (y - fst x)\<^sup>2 / (2 * (snd x)\<^sup>2)) / sqrt (2 * pi * (snd x)\<^sup>2) else 0)) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
by (simp add: borel_prod[symmetric])
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ennreal (case x of (x, y) \<Rightarrow> if 0 < snd x then exp (- (y - fst x)\<^sup>2 / (2 * (snd x)\<^sup>2)) / sqrt (2 * pi * (snd x)\<^sup>2) else 0)) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)

goal (1 subgoal):
 1. (\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)

goal (1 subgoal):
 1. (\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>(x, y). gaussian_density x y) \<in> borel_measurable (borel \<Otimes>\<^sub>M borel)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma insert_set_delete_index:
  "n < length xs \<Longrightarrow> insert (xs ! n) (set (delete_index n xs)) = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < length xs \<Longrightarrow> insert (xs ! n) (set (delete_index n xs)) = set xs
[PROOF STEP]
by (induction n xs rule: delete_index.induct) auto


[STATEMENT]
theorem block_exists:
  "a \<in> S \<Longrightarrow> \<exists>A. a \<in> A \<and> A \<in> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> S \<Longrightarrow> \<exists>A. a \<in> A \<and> A \<in> P
[PROOF STEP]
using complete
[PROOF STATE]
proof (prove)
using this:
\<Union> P = S

goal (1 subgoal):
 1. a \<in> S \<Longrightarrow> \<exists>A. a \<in> A \<and> A \<in> P
[PROOF STEP]
by blast


[STATEMENT]
lemma not_subseq_length [simp]: "length ys < length xs \<Longrightarrow> \<not> subseq xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys < length xs \<Longrightarrow> \<not> subseq xs ys
[PROOF STEP]
by (metis list_emb_length linorder_not_less)


[STATEMENT]
lemma in_sets_PiFI:
  assumes "X = (Pi' J S)" "J \<in> I" "\<And>i. i\<in>J \<Longrightarrow> S i \<in> sets (M i)"
  shows "X \<in> sets (PiF I M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> sets (Pi\<^sub>F I M)
[PROOF STEP]
unfolding sets_PiF
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X \<in> sigma_sets (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j)) {Pi' J X |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
X = Pi' J S
J \<in> I
?i \<in> J \<Longrightarrow> S ?i \<in> sets (M ?i)

goal (1 subgoal):
 1. X \<in> sigma_sets (\<Union>J\<in>I. \<Pi>' j\<in>J. space (M j)) {Pi' J X |X J. J \<in> I \<and> X \<in> (\<Pi> j\<in>J. sets (M j))}
[PROOF STEP]
by blast


[STATEMENT]
lemma Infinitesimal_hcmod_add_diff:
     "u \<approx> 0 \<Longrightarrow> hcmod(x + u) - hcmod x \<in> Infinitesimal"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<approx> 0 \<Longrightarrow> hcmod (x + u) - hcmod x \<in> Infinitesimal
[PROOF STEP]
by (metis add.commute add.left_neutral approx_add_right_iff approx_def approx_hnorm)


[STATEMENT]
lemma measure_negligible_symdiff:
  assumes S: "S \<in> lmeasurable"
    and neg: "negligible (S - T \<union> (T - S))"
  shows "measure lebesgue T = measure lebesgue S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue T = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue T = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
have "measure lebesgue (S - T) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (S - T) = 0
[PROOF STEP]
using neg negligible_Un_eq negligible_imp_measure0
[PROOF STATE]
proof (prove)
using this:
negligible (S - T \<union> (T - S))
negligible (?s \<union> ?t) = (negligible ?s \<and> negligible ?t)
negligible ?S \<Longrightarrow> Sigma_Algebra.measure lebesgue ?S = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue (S - T) = 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue (S - T) = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue T = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure lebesgue (S - T) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure lebesgue (S - T) = 0

goal (1 subgoal):
 1. Sigma_Algebra.measure lebesgue T = Sigma_Algebra.measure lebesgue S
[PROOF STEP]
by (metis S Un_commute add.right_neutral lmeasurable_negligible_symdiff measure_Un2 neg negligible_Un_eq negligible_imp_measure0)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure lebesgue T = Sigma_Algebra.measure lebesgue S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in category) Yoneda_functor_ObjMap_vrange:
  "\<R>\<^sub>\<circ> (Yoneda_functor \<alpha> \<CC>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (Yoneda_functor \<alpha> \<CC>\<lparr>ObjMap\<rparr>) \<subseteq>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>
[PROOF STEP]
proof
  (
    unfold Yoneda_functor_components,
    rule vrange_VLambda_vsubset,
    unfold cat_op_simps
  )
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr> \<Longrightarrow> cf_map Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(x,-) \<in>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>
[PROOF STEP]
fix c
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr> \<Longrightarrow> cf_map Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(x,-) \<in>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>
[PROOF STEP]
assume "c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (state)
this:
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<And>x. x \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr> \<Longrightarrow> cf_map Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(x,-) \<in>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>
[PROOF STEP]
with category_axioms
[PROOF STATE]
proof (chain)
picking this:
category \<alpha> \<CC>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>
[PROOF STEP]
show
    "cf_map Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(c,-) \<in>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>"
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. cf_map Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(c,-) \<in>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>
[PROOF STEP]
unfolding cat_op_simps cat_FUNCT_components
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
c \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. cf_map Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(c,-) \<in>\<^sub>\<circ> cf_maps \<alpha> \<CC> (cat_Set \<alpha>)
[PROOF STEP]
by (cs_concl cs_shallow cs_intro: cat_cs_intros cat_FUNCT_cs_intros)
[PROOF STATE]
proof (state)
this:
cf_map Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(c,-) \<in>\<^sub>\<circ> cat_FUNCT \<alpha> \<CC> (cat_Set \<alpha>)\<lparr>Obj\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma scaleQ_add_left: "a + b *\<^sub>Q x = (a *\<^sub>Q x) + (b *\<^sub>Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + b *\<^sub>Q x = (a *\<^sub>Q x) + (b *\<^sub>Q x)
[PROOF STEP]
by (si_simp add: distrib_right)


[STATEMENT]
lemma vifintersection_vintersection:
  assumes "I \<noteq> 0" and "J \<noteq> 0"
  shows "(\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i) \<inter>\<^sub>\<circ> (\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>J. f i) = (\<Inter>\<^sub>\<circ>i\<in>\<^sub>\<circ>I \<union>\<^sub>\<circ> J. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Inter>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) \<inter>\<^sub>\<circ> \<Inter>\<^sub>\<circ> (VLambda J f `\<^sub>\<circ> J) = \<Inter>\<^sub>\<circ> (VLambda (I \<union>\<^sub>\<circ> J) f `\<^sub>\<circ> (I \<union>\<^sub>\<circ> J))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
I \<noteq> 0
J \<noteq> 0

goal (1 subgoal):
 1. \<Inter>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) \<inter>\<^sub>\<circ> \<Inter>\<^sub>\<circ> (VLambda J f `\<^sub>\<circ> J) = \<Inter>\<^sub>\<circ> (VLambda (I \<union>\<^sub>\<circ> J) f `\<^sub>\<circ> (I \<union>\<^sub>\<circ> J))
[PROOF STEP]
by (auto intro!: vsubset_antisym)


[STATEMENT]
lemma polytope_empty: "polytope {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polytope {}
[PROOF STEP]
using convex_hull_empty polytope_def
[PROOF STATE]
proof (prove)
using this:
convex hull {} = {}
polytope ?S \<equiv> \<exists>v. finite v \<and> ?S = convex hull v

goal (1 subgoal):
 1. polytope {}
[PROOF STEP]
by blast


[STATEMENT]
lemma poly_ring_add_mono:
  assumes "n \<le> m"
  assumes "A \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  assumes "B \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  shows "A \<oplus>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> B = A \<oplus>\<^bsub>coord_ring R m\<^esub> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> B = A \<oplus>\<^bsub>R [\<X>\<^bsub>m\<^esub>]\<^esub> B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<le> m
A \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
B \<in> carrier (R [\<X>\<^bsub>n\<^esub>])

goal (1 subgoal):
 1. A \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> B = A \<oplus>\<^bsub>R [\<X>\<^bsub>m\<^esub>]\<^esub> B
[PROOF STEP]
unfolding coord_ring_def
[PROOF STATE]
proof (prove)
using this:
n \<le> m
A \<in> carrier (Pring R {..<n})
B \<in> carrier (Pring R {..<n})

goal (1 subgoal):
 1. A \<oplus>\<^bsub>Pring R {..<n}\<^esub> B = A \<oplus>\<^bsub>Pring R {..<m}\<^esub> B
[PROOF STEP]
by (metis R.Pring_add_eq)


[STATEMENT]
lemma basis_col_space_code[code]: "basis_col_space A = (let A' = Gauss_Jordan (transpose A) in {row i A' |i. row i A' \<noteq> 0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_col_space A = (let A' = Gauss_Jordan (Finite_Cartesian_Product.transpose A) in {row i A' |i. row i A' \<noteq> 0})
[PROOF STEP]
unfolding basis_col_space_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {row i (Gauss_Jordan (Finite_Cartesian_Product.transpose A)) |i. row i (Gauss_Jordan (Finite_Cartesian_Product.transpose A)) \<noteq> 0} = {row i (Gauss_Jordan (Finite_Cartesian_Product.transpose A)) |i. row i (Gauss_Jordan (Finite_Cartesian_Product.transpose A)) \<noteq> 0}
[PROOF STEP]
..


[STATEMENT]
lemma diagonal_admits_SNF_imp_bezout_ring:
  assumes admits_SNF: "\<forall>A::'a::comm_ring_1^'n::{mod_type}^'n::{mod_type}. isDiagonal A
    \<longrightarrow> (\<exists>P Q. invertible (P::'a::comm_ring_1^'n::{mod_type}^'n::{mod_type})
        \<and> invertible (Q::'a::comm_ring_1^'n::{mod_type}^'n::{mod_type})
        \<and> Smith_normal_form (P**A**Q))"
  shows "OFCLASS('a::comm_ring_1, bezout_ring_class)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OFCLASS('a, bezout_ring_class)
[PROOF STEP]
proof (rule diagonal_admits_SNF_imp_bezout_ring_JNF, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A n. \<lbrakk>A \<in> carrier_mat n n; isDiagonal_mat A\<rbrakk> \<Longrightarrow> \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
fix A::"'a mat" and n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A n. \<lbrakk>A \<in> carrier_mat n n; isDiagonal_mat A\<rbrakk> \<Longrightarrow> \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
assume A: "A \<in> carrier_mat n n" and diag_A: "isDiagonal_mat A"
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat n n
isDiagonal_mat A

goal (1 subgoal):
 1. \<And>A n. \<lbrakk>A \<in> carrier_mat n n; isDiagonal_mat A\<rbrakk> \<Longrightarrow> \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
have a: "\<forall>A::'a::comm_ring_1^'n::{mod_type}^'n::{mod_type}. admits_SNF_HA A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. admits_SNF_HA A
[PROOF STEP]
using admits_SNF
[PROOF STATE]
proof (prove)
using this:
\<forall>A. isDiagonal A \<longrightarrow> (\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q))

goal (1 subgoal):
 1. \<forall>A. admits_SNF_HA A
[PROOF STEP]
unfolding admits_SNF_HA_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A. isDiagonal A \<longrightarrow> (\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q))

goal (1 subgoal):
 1. \<forall>A. isDiagonal A \<longrightarrow> (\<exists>P Q. invertible P \<and> invertible Q \<and> Smith_normal_form (P ** A ** Q))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<forall>A. admits_SNF_HA A

goal (1 subgoal):
 1. \<And>A n. \<lbrakk>A \<in> carrier_mat n n; isDiagonal_mat A\<rbrakk> \<Longrightarrow> \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
have JNF: "\<forall>(A::'a mat)\<in> carrier_mat CARD('n) CARD('n). admits_SNF_JNF A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A\<in>carrier_mat CARD('n) CARD('n). admits_SNF_JNF A
[PROOF STEP]
(*We can get this result, but this does not imply that it holds for any n \<times> n matrix, just
    for the concrete case that n = CARD('n). Within this proof, we cannot apply local type
    definitions, since the 'n is not an schematic variable any more, it is fixed.*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A\<in>carrier_mat CARD('n) CARD('n). admits_SNF_JNF A
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> admits_SNF_JNF A
[PROOF STEP]
fix A::"'a mat"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> admits_SNF_JNF A
[PROOF STEP]
assume A: "A \<in> carrier_mat CARD('n) CARD('n)"
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat CARD('n) CARD('n)

goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> admits_SNF_JNF A
[PROOF STEP]
let ?B = "(Mod_Type_Connect.to_hma\<^sub>m  A::'a::comm_ring_1^'n::{mod_type}^'n::{mod_type})"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> admits_SNF_JNF A
[PROOF STEP]
have [transfer_rule]: "Mod_Type_Connect.HMA_M A ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M A (Mod_Type_Connect.to_hma\<^sub>m A)
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat CARD('n) CARD('n)

goal (1 subgoal):
 1. Mod_Type_Connect.HMA_M A (Mod_Type_Connect.to_hma\<^sub>m A)
[PROOF STEP]
unfolding Mod_Type_Connect.HMA_M_def
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat CARD('n) CARD('n)

goal (1 subgoal):
 1. A = Mod_Type_Connect.from_hma\<^sub>m (Mod_Type_Connect.to_hma\<^sub>m A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Mod_Type_Connect.HMA_M A (Mod_Type_Connect.to_hma\<^sub>m A)

goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> admits_SNF_JNF A
[PROOF STEP]
have b: "admits_SNF_HA ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. admits_SNF_HA (Mod_Type_Connect.to_hma\<^sub>m A)
[PROOF STEP]
using a
[PROOF STATE]
proof (prove)
using this:
\<forall>A. admits_SNF_HA A

goal (1 subgoal):
 1. admits_SNF_HA (Mod_Type_Connect.to_hma\<^sub>m A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
admits_SNF_HA (Mod_Type_Connect.to_hma\<^sub>m A)

goal (1 subgoal):
 1. \<And>A. A \<in> carrier_mat CARD('n) CARD('n) \<Longrightarrow> admits_SNF_JNF A
[PROOF STEP]
show "admits_SNF_JNF A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. admits_SNF_JNF A
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
admits_SNF_HA (Mod_Type_Connect.to_hma\<^sub>m A)

goal (1 subgoal):
 1. admits_SNF_JNF A
[PROOF STEP]
by transfer
[PROOF STATE]
proof (state)
this:
admits_SNF_JNF A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>carrier_mat CARD('n) CARD('n). admits_SNF_JNF A

goal (1 subgoal):
 1. \<And>A n. \<lbrakk>A \<in> carrier_mat n n; isDiagonal_mat A\<rbrakk> \<Longrightarrow> \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
(*Here we cannot apply local type definitions (either cancel_card_constraint or
  cancel_type_definition) to thm JNF*)
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>carrier_mat CARD('n) CARD('n). admits_SNF_JNF A

goal (1 subgoal):
 1. \<And>A n. \<lbrakk>A \<in> carrier_mat n n; isDiagonal_mat A\<rbrakk> \<Longrightarrow> \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
thus "\<exists>P. P \<in> carrier_mat n n \<and>
             (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P
        \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))"
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat CARD('n) CARD('n). admits_SNF_JNF A

goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
using JNF A diag_A
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat CARD('n) CARD('n). admits_SNF_JNF A
\<forall>A\<in>carrier_mat CARD('n) CARD('n). admits_SNF_JNF A
A \<in> carrier_mat n n
isDiagonal_mat A

goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
unfolding admits_SNF_JNF_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat CARD('n) CARD('n). square_mat A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
\<forall>A\<in>carrier_mat CARD('n) CARD('n). square_mat A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
A \<in> carrier_mat n n
isDiagonal_mat A

goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
unfolding square_mat.simps
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat CARD('n) CARD('n). dim_col A = dim_row A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
\<forall>A\<in>carrier_mat CARD('n) CARD('n). dim_col A = dim_row A \<and> isDiagonal_mat A \<longrightarrow> (\<exists>P Q. P \<in> carrier_mat (dim_row A) (dim_row A) \<and> Q \<in> carrier_mat (dim_row A) (dim_row A) \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
A \<in> carrier_mat n n
isDiagonal_mat A

goal (1 subgoal):
 1. \<exists>P. P \<in> carrier_mat n n \<and> (\<exists>Q. Q \<in> carrier_mat n n \<and> invertible_mat P \<and> invertible_mat Q \<and> Smith_normal_form_mat (P * A * Q))
[PROOF STEP]
oops


[STATEMENT]
lemma hcnj_one [simp]: "hcnj 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hcnj 1 = 1
[PROOF STEP]
by transfer (rule complex_cnj_one)


[STATEMENT]
lemma word_of_integer_code [code]:
  "word_of_integer k =
  (if k < 0 then - word_of_integer (- k)
   else if k = 0 then 0
   else let (q, r) = divmod_integer k 2
        in if r = 0 then 2 * word_of_integer q else 2 * word_of_integer q + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_of_integer k = (if k < 0 then - word_of_integer (- k) else if k = 0 then 0 else let (q, r) = divmod_integer k 2 in if r = 0 then 2 * word_of_integer q else 2 * word_of_integer q + 1)
[PROOF STEP]
apply (unfold word_of_integer_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (word_of_int \<circ> int_of_integer) k = (if k < 0 then - (word_of_int \<circ> int_of_integer) (- k) else if k = 0 then 0 else let (q, r) = divmod_integer k 2 in if r = 0 then 2 * (word_of_int \<circ> int_of_integer) q else 2 * (word_of_int \<circ> int_of_integer) q + 1)
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. take_bit LENGTH('a) (((\<lambda>k. k) \<circ> int_of_integer) k) = take_bit LENGTH('a) (if k < 0 then - ((\<lambda>k. k) \<circ> int_of_integer) (- k) else if k = 0 then 0 else let (q, r) = divmod_integer k 2 in if r = 0 then 2 * ((\<lambda>k. k) \<circ> int_of_integer) q else 2 * ((\<lambda>k. k) \<circ> int_of_integer) q + 1)
[PROOF STEP]
apply (auto simp add: not_less comp_def split_beta)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k mod 2 = 1; k \<noteq> 0; 0 \<le> k\<rbrakk> \<Longrightarrow> take_bit LENGTH('a) (int_of_integer k) = take_bit LENGTH('a) (2 * (int_of_integer k div 2) + 1)
[PROOF STEP]
apply (subst int_of_integer_code)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k mod 2 = 1; k \<noteq> 0; 0 \<le> k\<rbrakk> \<Longrightarrow> take_bit LENGTH('a) (if k < 0 then - int_of_integer (- k) else if k = 0 then 0 else let (l, j) = divmod_integer k 2; l' = 2 * int_of_integer l in if j = 0 then l' else l' + 1) = take_bit LENGTH('a) (2 * (int_of_integer k div 2) + 1)
[PROOF STEP]
apply (clarsimp simp add: divmod_integer_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma SNF_preserved_multiples_identity:
  assumes S: "S \<in> carrier_mat m n" and SNF: "Smith_normal_form_mat (S::'a::comm_ring_1 mat)"
  shows "Smith_normal_form_mat (S*(k \<cdot>\<^sub>m 1\<^sub>m n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Smith_normal_form_mat (S * (k \<cdot>\<^sub>m 1\<^sub>m n))
[PROOF STEP]
proof (rule Smith_normal_form_mat_intro)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>a. a + 1 < min (dim_row (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) (dim_col (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) \<longrightarrow> (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a, a) dvd (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a + 1, a + 1)
 2. isDiagonal_mat (S * (k \<cdot>\<^sub>m 1\<^sub>m n))
[PROOF STEP]
have rw: "S*(k \<cdot>\<^sub>m 1\<^sub>m n) = Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S * (k \<cdot>\<^sub>m 1\<^sub>m n) = Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k)
[PROOF STEP]
unfolding mat_diag_smult[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S * mat_diag n (\<lambda>x. k) = Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k)
[PROOF STEP]
by (rule mat_diag_mult_right[OF S])
[PROOF STATE]
proof (state)
this:
S * (k \<cdot>\<^sub>m 1\<^sub>m n) = Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k)

goal (2 subgoals):
 1. \<forall>a. a + 1 < min (dim_row (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) (dim_col (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) \<longrightarrow> (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a, a) dvd (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a + 1, a + 1)
 2. isDiagonal_mat (S * (k \<cdot>\<^sub>m 1\<^sub>m n))
[PROOF STEP]
show "isDiagonal_mat (S * (k \<cdot>\<^sub>m 1\<^sub>m n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal_mat (S * (k \<cdot>\<^sub>m 1\<^sub>m n))
[PROOF STEP]
using SNF S
[PROOF STATE]
proof (prove)
using this:
Smith_normal_form_mat S
S \<in> carrier_mat m n

goal (1 subgoal):
 1. isDiagonal_mat (S * (k \<cdot>\<^sub>m 1\<^sub>m n))
[PROOF STEP]
unfolding Smith_normal_form_mat_def isDiagonal_mat_def rw
[PROOF STATE]
proof (prove)
using this:
(\<forall>a. a + 1 < min (dim_row S) (dim_col S) \<longrightarrow> S $$ (a, a) dvd S $$ (a + 1, a + 1)) \<and> (\<forall>i j. i \<noteq> j \<and> i < dim_row S \<and> j < dim_col S \<longrightarrow> S $$ (i, j) = (0::'a))
S \<in> carrier_mat m n

goal (1 subgoal):
 1. \<forall>i j. i \<noteq> j \<and> i < dim_row (Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k)) \<and> j < dim_col (Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k)) \<longrightarrow> Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k) $$ (i, j) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isDiagonal_mat (S * (k \<cdot>\<^sub>m 1\<^sub>m n))

goal (1 subgoal):
 1. \<forall>a. a + 1 < min (dim_row (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) (dim_col (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) \<longrightarrow> (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a, a) dvd (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a + 1, a + 1)
[PROOF STEP]
show "\<forall>a. a + 1 < min (dim_row (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) (dim_col (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) \<longrightarrow>
        (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a, a) dvd (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a + 1, a + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. a + 1 < min (dim_row (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) (dim_col (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) \<longrightarrow> (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a, a) dvd (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a + 1, a + 1)
[PROOF STEP]
using SNF S
[PROOF STATE]
proof (prove)
using this:
Smith_normal_form_mat S
S \<in> carrier_mat m n

goal (1 subgoal):
 1. \<forall>a. a + 1 < min (dim_row (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) (dim_col (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) \<longrightarrow> (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a, a) dvd (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a + 1, a + 1)
[PROOF STEP]
unfolding Smith_normal_form_mat_def isDiagonal_mat_def rw
[PROOF STATE]
proof (prove)
using this:
(\<forall>a. a + 1 < min (dim_row S) (dim_col S) \<longrightarrow> S $$ (a, a) dvd S $$ (a + 1, a + 1)) \<and> (\<forall>i j. i \<noteq> j \<and> i < dim_row S \<and> j < dim_col S \<longrightarrow> S $$ (i, j) = (0::'a))
S \<in> carrier_mat m n

goal (1 subgoal):
 1. \<forall>a. a + 1 < min (dim_row (Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k))) (dim_col (Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k))) \<longrightarrow> Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k) $$ (a, a) dvd Matrix.mat m n (\<lambda>(i, j). S $$ (i, j) * k) $$ (a + 1, a + 1)
[PROOF STEP]
by (auto simp add: mult_dvd_mono)
[PROOF STATE]
proof (state)
this:
\<forall>a. a + 1 < min (dim_row (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) (dim_col (S * (k \<cdot>\<^sub>m 1\<^sub>m n))) \<longrightarrow> (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a, a) dvd (S * (k \<cdot>\<^sub>m 1\<^sub>m n)) $$ (a + 1, a + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mono_tokens: "mono tokens"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono sum_list
[PROOF STEP]
using tokens_mono_prefix
[PROOF STATE]
proof (prove)
using this:
?xs \<le> ?ys \<Longrightarrow> sum_list ?xs \<le> sum_list ?ys

goal (1 subgoal):
 1. mono sum_list
[PROOF STEP]
by (rule monoI)


[STATEMENT]
lemma upclosed_mono:
  fixes f :: "'a::order_with_dual \<Rightarrow> 'b::order_with_dual"
  assumes "\<forall>Y. upclosed_set Y \<longrightarrow> upclosed_set (f -` Y)"
  shows "mono f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f
[PROOF STEP]
by (metis (mono_tags, lifting) assms dual_order.refl mem_Collect_eq monoI order.trans upclosed_set_iff vimageE vimageI2)


[STATEMENT]
lemma sccs_verts_disjoint:
    assumes "S \<in> sccs_verts" "T \<in> sccs_verts" "S \<noteq> T" shows "S \<inter> T = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<inter> T = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
S \<in> sccs_verts
T \<in> sccs_verts
S \<noteq> T

goal (1 subgoal):
 1. S \<inter> T = {}
[PROOF STEP]
unfolding in_sccs_verts_conv_reachable
[PROOF STATE]
proof (prove)
using this:
S \<noteq> {} \<and> (\<forall>u\<in>S. Ball S (reachable G u)) \<and> (\<forall>u\<in>S. \<forall>v. v \<notin> S \<longrightarrow> \<not> u \<rightarrow>\<^sup>* v \<or> \<not> v \<rightarrow>\<^sup>* u)
T \<noteq> {} \<and> (\<forall>u\<in>T. Ball T (reachable G u)) \<and> (\<forall>u\<in>T. \<forall>v. v \<notin> T \<longrightarrow> \<not> u \<rightarrow>\<^sup>* v \<or> \<not> v \<rightarrow>\<^sup>* u)
S \<noteq> T

goal (1 subgoal):
 1. S \<inter> T = {}
[PROOF STEP]
by safe meson+


[STATEMENT]
lemma quad_part_1_eq :
  assumes lLength : "length L > var"
  assumes hdeg : "MPoly_Type.degree (p::real mpoly) var = (deg::nat)"
  assumes nonzero : "D \<noteq> 0"
  assumes ha : "\<forall>x. insertion (nth_default 0 (list_update L var x)) a = (A::real)"
  assumes hb : "\<forall>x. insertion (nth_default 0 (list_update L var x)) b = (B::real)"
  assumes hd : "\<forall>x. insertion (nth_default 0 (list_update L var x)) d = (D::real)"
  shows "aEval (Eq p) (list_update L var ((A+B*C)/D)) = aEval (Eq(quadratic_part_1 var a b d (Eq p))) (list_update L var C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
define f where "f i = insertion (nth_default 0 (list_update L var C)) (isolate_variable_sparse p var i) * ((A + B * C) ^ i)" for i
[PROOF STATE]
proof (state)
this:
f ?i = insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var ?i) * (A + B * C) ^ ?i

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have h1 : "\<forall>i. (insertion (nth_default 0 (list_update L var C)) (isolate_variable_sparse p var i)) = (insertion (nth_default 0 (list_update L var ((A+B*C)/D))) (isolate_variable_sparse p var i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) = insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i)
[PROOF STEP]
by(simp add: insertion_isovarspars_free)
[PROOF STATE]
proof (state)
this:
\<forall>i. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) = insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have h2 : "((\<Sum>i = 0..<deg+1. f i / D ^ i) = 0) =((\<Sum>i = 0..<deg+1. (f i) * D ^ (deg - i)) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. f i / D ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. f i * D ^ (deg - i)) = 0)
[PROOF STEP]
using normalize_summation nonzero
[PROOF STATE]
proof (prove)
using this:
?B \<noteq> 0 \<Longrightarrow> ((\<Sum>i = 0..<?n + 1. ?f i * ?B ^ (?n - i)) = 0) = ((\<Sum>i = 0..<?n + 1. ?f i / ?B ^ i) = 0)
D \<noteq> 0

goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. f i / D ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. f i * D ^ (deg - i)) = 0)
[PROOF STEP]
by(auto)
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. f i / D ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. f i * D ^ (deg - i)) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have "aEval (Eq(quadratic_part_1 var a b d (Eq p))) (list_update L var C) =
      ((\<Sum>i = 0..<deg+1. (insertion (nth_default 0 (list_update L var C)) (isolate_variable_sparse p var i) * ((A + B * C) ^ i)) * D ^ (deg - i)) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C]) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i * D ^ (deg - i)) = 0)
[PROOF STEP]
by(simp add: hdeg insertion_sum insertion_add insertion_mult insertion_var insertion_pow ha hb hd lLength)
[PROOF STATE]
proof (state)
this:
aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C]) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i * D ^ (deg - i)) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C]) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i * D ^ (deg - i)) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have "... =((\<Sum>i = 0..<deg+1. (insertion (nth_default 0 (list_update L var C)) (isolate_variable_sparse p var i) * ((A + B * C) ^ i)) / D ^ i) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i * D ^ (deg - i)) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i / D ^ i) = 0)
[PROOF STEP]
using f_def h2
[PROOF STATE]
proof (prove)
using this:
f ?i = insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var ?i) * (A + B * C) ^ ?i
((\<Sum>i = 0..<deg + 1. f i / D ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. f i * D ^ (deg - i)) = 0)

goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i * D ^ (deg - i)) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i / D ^ i) = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i * D ^ (deg - i)) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i / D ^ i) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i * D ^ (deg - i)) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i / D ^ i) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have "... =((\<Sum>i = 0..<deg+1. (insertion (nth_default 0 (list_update L var C)) (isolate_variable_sparse p var i) * ((A + B * C)^i / (D ^ i)))) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i / D ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) ^ i / D ^ i)) = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i / D ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) ^ i / D ^ i)) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * (A + B * C) ^ i / D ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) ^ i / D ^ i)) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have "... =((\<Sum>i = 0..<deg+1. (insertion (nth_default 0 (list_update L var C)) (isolate_variable_sparse p var i) * ((A + B * C)/D) ^ i)) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) ^ i / D ^ i)) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0)
[PROOF STEP]
by (metis (no_types, lifting) power_divide sum.cong)
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) ^ i / D ^ i)) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) ^ i / D ^ i)) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have "... =((\<Sum>i = 0..<deg+1. (insertion (nth_default 0 (list_update L var ((A+B*C)/D))) (isolate_variable_sparse p var i) * ((A + B * C)/D) ^ i))=0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0)
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
\<forall>i. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) = insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i)

goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := C])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have "... = (insertion (nth_default 0 (list_update L var ((A+B*C)/D))) p =0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = (insertion (nth_default 0 (L[var := (A + B * C) / D])) p = 0)
[PROOF STEP]
using sum_over_degree_insertion hdeg lLength
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?var < length ?L; MPoly_Type.degree ?p ?var = ?d\<rbrakk> \<Longrightarrow> (\<Sum>i = 0..<?d + 1. insertion (nth_default 0 (?L[?var := ?x])) (isolate_variable_sparse ?p ?var i) * ?x ^ i) = insertion (nth_default 0 (?L[?var := ?x])) ?p
MPoly_Type.degree p var = deg
var < length L

goal (1 subgoal):
 1. ((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = (insertion (nth_default 0 (L[var := (A + B * C) / D])) p = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = (insertion (nth_default 0 (L[var := (A + B * C) / D])) p = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<Sum>i = 0..<deg + 1. insertion (nth_default 0 (L[var := (A + B * C) / D])) (isolate_variable_sparse p var i) * ((A + B * C) / D) ^ i) = 0) = (insertion (nth_default 0 (L[var := (A + B * C) / D])) p = 0)

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
have "... = aEval (Eq p) (list_update L var ((A+B*C)/D))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (insertion (nth_default 0 (L[var := (A + B * C) / D])) p = 0) = aEval (Eq p) (L[var := (A + B * C) / D])
[PROOF STEP]
using aEval.simps(1)
[PROOF STATE]
proof (prove)
using this:
aEval (Eq ?p) ?L = (insertion (nth_default 0 ?L) ?p = 0)

goal (1 subgoal):
 1. (insertion (nth_default 0 (L[var := (A + B * C) / D])) p = 0) = aEval (Eq p) (L[var := (A + B * C) / D])
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(insertion (nth_default 0 (L[var := (A + B * C) / D])) p = 0) = aEval (Eq p) (L[var := (A + B * C) / D])

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C]) = aEval (Eq p) (L[var := (A + B * C) / D])
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C]) = aEval (Eq p) (L[var := (A + B * C) / D])

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C]) = aEval (Eq p) (L[var := (A + B * C) / D])
var < length L
MPoly_Type.degree p var = deg
D \<noteq> 0
\<forall>x. insertion (nth_default 0 (L[var := x])) a = A
\<forall>x. insertion (nth_default 0 (L[var := x])) b = B
\<forall>x. insertion (nth_default 0 (L[var := x])) d = D

goal (1 subgoal):
 1. aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
aEval (Eq p) (L[var := (A + B * C) / D]) = aEval (Eq (quadratic_part_1 var a b d (Eq p))) (L[var := C])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gauge_integral_Fubini_curve_bounded_region_x:
  fixes f g :: "('a::euclidean_space * 'b::euclidean_space) \<Rightarrow> 'c::euclidean_space" and
    g1 g2:: "'a \<Rightarrow> 'b" and
    s:: "('a * 'b) set"
  assumes fun_lesbegue_integrable: "integrable lborel f" and
    x_axis_gauge_integrable: "\<And>x. (\<lambda>y. f(x, y)) integrable_on UNIV" and
    (*IS THIS redundant? NO IT IS NOT*)
    x_axis_integral_measurable: "(\<lambda>x. integral UNIV (\<lambda>y. f(x, y))) \<in> borel_measurable lborel" and
    f_is_g_indicator: "f = (\<lambda>x. if x \<in> s then g x else 0)" and
    s_is_bounded_by_g1_and_g2: "s = {(x,y). (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and>
                                      (\<forall>i\<in>Basis. (g1 x) \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> (g2 x) \<bullet> i)}"
  shows "integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(x,y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have two_D_integral_to_one_D: "integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f(x,y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y)))
[PROOF STEP]
using gauge_integral_Fubini_universe_x and fun_lesbegue_integrable and x_axis_integral_measurable
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable lborel ?f; (\<lambda>x. integral UNIV (\<lambda>y. ?f (x, y))) \<in> borel_measurable lborel\<rbrakk> \<Longrightarrow> integral UNIV ?f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. ?f (x, y)))
\<lbrakk>integrable lborel ?f; (\<lambda>x. integral UNIV (\<lambda>y. ?f (x, y))) \<in> borel_measurable lborel\<rbrakk> \<Longrightarrow> (\<lambda>x. integral UNIV (\<lambda>y. ?f (x, y))) integrable_on UNIV
integrable lborel f
(\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) \<in> borel_measurable lborel

goal (1 subgoal):
 1. integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y)))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have one_d_integral_integrable: "(\<lambda>x. integral UNIV (\<lambda>y. f(x,y))) integrable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) integrable_on UNIV
[PROOF STEP]
using gauge_integral_Fubini_universe_x(2) and assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>integrable lborel ?f; (\<lambda>x. integral UNIV (\<lambda>y. ?f (x, y))) \<in> borel_measurable lborel\<rbrakk> \<Longrightarrow> (\<lambda>x. integral UNIV (\<lambda>y. ?f (x, y))) integrable_on UNIV
integrable lborel f
(\<lambda>y. f (?x, y)) integrable_on UNIV
(\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) \<in> borel_measurable lborel
f = (\<lambda>x. if x \<in> s then g x else (0::'c))
s = {(x, y). (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i)}

goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) integrable_on UNIV
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) integrable_on UNIV

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have case_x_in_range:
    "\<forall> x \<in> cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(x,y)) = integral UNIV (\<lambda>y. f(x,y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
fix x:: 'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
assume within_range: "x \<in> (cbox a b)"
[PROOF STATE]
proof (state)
this:
x \<in> cbox a b

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
let ?f_one_D_spec = "(\<lambda>y. if y \<in> (cbox (g1 x) (g2 x)) then g(x,y) else 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
have f_one_D_region: "(\<lambda>y. f(x,y)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g(x,y) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. f (x, y) = (if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))
[PROOF STEP]
fix y::'b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. f (x, y) = (if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))
[PROOF STEP]
show "f (x, y) = (if y \<in> (cbox (g1 x) (g2 x)) then g (x, y) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f (x, y) = (if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))
[PROOF STEP]
apply (simp add: f_is_g_indicator s_is_bounded_by_g1_and_g2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> g (x, y) = (0::'c)) \<and> ((\<exists>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<longrightarrow> \<not> x \<bullet> i \<le> b \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (x, y) = (0::'c)) \<and> ((\<exists>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<longrightarrow> \<not> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (x, y) = (0::'c))
[PROOF STEP]
using within_range
[PROOF STATE]
proof (prove)
using this:
x \<in> cbox a b

goal (1 subgoal):
 1. ((\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> g (x, y) = (0::'c)) \<and> ((\<exists>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<longrightarrow> \<not> x \<bullet> i \<le> b \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (x, y) = (0::'c)) \<and> ((\<exists>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<longrightarrow> \<not> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> y \<in> cbox (g1 x) (g2 x) \<longrightarrow> g (x, y) = (0::'c))
[PROOF STEP]
apply (simp add: cbox_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i \<Longrightarrow> (\<exists>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<longrightarrow> \<not> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> g (x, y) = (0::'c)
[PROOF STEP]
by smt
[PROOF STATE]
proof (state)
this:
f (x, y) = (if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>y. f (x, y)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
have zero_out_of_bound: "\<forall> y.  y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (x,y) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (x, y) = (0::'c)
[PROOF STEP]
using f_is_g_indicator and s_is_bounded_by_g1_and_g2
[PROOF STATE]
proof (prove)
using this:
f = (\<lambda>x. if x \<in> s then g x else (0::'c))
s = {(x, y). (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i)}

goal (1 subgoal):
 1. \<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (x, y) = (0::'c)
[PROOF STEP]
by (auto simp add: cbox_def)
[PROOF STATE]
proof (state)
this:
\<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (x, y) = (0::'c)

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
have "(\<lambda>y. f(x,y)) integrable_on cbox (g1 x)  (g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
have "?f_one_D_spec integrable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on UNIV
[PROOF STEP]
using f_one_D_region and x_axis_gauge_integrable
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. f (x, y)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))
(\<lambda>y. f (?x, y)) integrable_on UNIV

goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on UNIV
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on UNIV

goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on UNIV
[PROOF STEP]
have "?f_one_D_spec integrable_on cbox(g1 x) (g2 x)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on UNIV

goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
using integrable_on_subcbox
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on UNIV
\<lbrakk>?f integrable_on ?S; cbox ?a ?b \<subseteq> ?S\<rbrakk> \<Longrightarrow> ?f integrable_on cbox ?a ?b

goal (1 subgoal):
 1. (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
using f_one_D_region
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c)) integrable_on cbox (g1 x) (g2 x)
(\<lambda>y. f (x, y)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))

goal (1 subgoal):
 1. (\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
[PROOF STEP]
have f_integrale_x: "((\<lambda>y. f(x,y)) has_integral (integral (cbox (g1 x) (g2 x)) (\<lambda>y. f(x,y)))) (cbox (g1 x) (g2 x))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)

goal (1 subgoal):
 1. ((\<lambda>y. f (x, y)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
using integrable_integral and within_range and x_axis_gauge_integrable
[PROOF STATE]
proof (prove)
using this:
(\<lambda>y. f (x, y)) integrable_on cbox (g1 x) (g2 x)
?f integrable_on ?i \<Longrightarrow> (?f has_integral integral ?i ?f) ?i
x \<in> cbox a b
(\<lambda>y. f (?x, y)) integrable_on UNIV

goal (1 subgoal):
 1. ((\<lambda>y. f (x, y)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>y. f (x, y)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
have "integral (cbox (g1 x)  (g2 x)) (\<lambda>y. f (x, y)) = integral UNIV (\<lambda>y. f (x, y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
using has_integral_on_superset[OF f_integrale_x _ Set.subset_UNIV] zero_out_of_bound
[PROOF STATE]
proof (prove)
using this:
(\<And>xa. xa \<notin> cbox (g1 x) (g2 x) \<Longrightarrow> f (x, xa) = (0::'c)) \<Longrightarrow> ((\<lambda>y. f (x, y)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y))) UNIV
\<forall>y. y \<notin> cbox (g1 x) (g2 x) \<longrightarrow> f (x, y) = (0::'c)

goal (1 subgoal):
 1. integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
by (simp add: integral_unique)
[PROOF STATE]
proof (state)
this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y)) = integral UNIV (\<lambda>y. f (x, y))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
have "((\<lambda>y. f(x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))"
[PROOF STATE]
proof (prove)
using this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y)) = integral UNIV (\<lambda>y. f (x, y))

goal (1 subgoal):
 1. ((\<lambda>y. f (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
using f_integrale_x
[PROOF STATE]
proof (prove)
using this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y)) = integral UNIV (\<lambda>y. f (x, y))
((\<lambda>y. f (x, y)) has_integral integral (cbox (g1 x) (g2 x)) (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. ((\<lambda>y. f (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
((\<lambda>y. f (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>y. f (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
have "((\<lambda>y. g(x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x)(g2 x))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. f (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. ((\<lambda>y. g (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
using  Henstock_Kurzweil_Integration.has_integral_restrict [OF subset_refl ] and
        f_one_D_region
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. f (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
((\<lambda>x. if x \<in> ?S then ?f x else (0::?'b)) has_integral ?i) ?S = (?f has_integral ?i) ?S
(\<lambda>y. f (x, y)) = (\<lambda>y. if y \<in> cbox (g1 x) (g2 x) then g (x, y) else (0::'c))

goal (1 subgoal):
 1. ((\<lambda>y. g (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
by (smt has_integral_eq)
[PROOF STATE]
proof (state)
this:
((\<lambda>y. g (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. \<And>x. x \<in> cbox a b \<Longrightarrow> integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>y. g (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))
[PROOF STEP]
show "integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>y. g (x, y)) has_integral integral UNIV (\<lambda>y. f (x, y))) (cbox (g1 x) (g2 x))

goal (1 subgoal):
 1. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have case_x_not_in_range:
    "\<forall> x. x \<notin> cbox a  b \<longrightarrow> integral UNIV (\<lambda>y. f(x,y)) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)
[PROOF STEP]
fix x::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)
[PROOF STEP]
have "x \<notin> (cbox a b) \<longrightarrow> (\<forall>y. f(x,y) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (x, y) = (0::'c))
[PROOF STEP]
apply  (simp add: s_is_bounded_by_g1_and_g2 f_is_g_indicator cbox_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<longrightarrow> \<not> x \<bullet> i \<le> b \<bullet> i) \<longrightarrow> (\<forall>y. (\<forall>i\<in>Basis. a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> b \<bullet> i) \<and> (\<forall>i\<in>Basis. g1 x \<bullet> i \<le> y \<bullet> i \<and> y \<bullet> i \<le> g2 x \<bullet> i) \<longrightarrow> g (x, y) = (0::'c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (x, y) = (0::'c))

goal (1 subgoal):
 1. \<And>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (x, y) = (0::'c))
[PROOF STEP]
show "x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = 0"
[PROOF STATE]
proof (prove)
using this:
x \<notin> cbox a b \<longrightarrow> (\<forall>y. f (x, y) = (0::'c))

goal (1 subgoal):
 1. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have RHS: "integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f(x,y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(x,y)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
let ?first_integral = "(\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g(x,y)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
let ?x_integral_cases = "(\<lambda>x. if x \<in> cbox a b then  ?first_integral x else 0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have x_integral_cases_integral: "(\<lambda>x. integral UNIV (\<lambda>y. f(x,y))) = ?x_integral_cases"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c))
[PROOF STEP]
using case_x_in_range and case_x_not_in_range
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>cbox a b. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) = integral UNIV (\<lambda>y. f (x, y))
\<forall>x. x \<notin> cbox a b \<longrightarrow> integral UNIV (\<lambda>y. f (x, y)) = (0::'c)

goal (1 subgoal):
 1. (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c))

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have "((\<lambda>x. integral UNIV (\<lambda>y. f(x,y))) has_integral (integral UNIV f)) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) has_integral integral UNIV f) UNIV
[PROOF STEP]
using two_D_integral_to_one_D
        one_d_integral_integrable
[PROOF STATE]
proof (prove)
using this:
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y)))
(\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) integrable_on UNIV

goal (1 subgoal):
 1. ((\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) has_integral integral UNIV f) UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) has_integral integral UNIV f) UNIV
[PROOF STEP]
have "(?x_integral_cases has_integral (integral UNIV f)) UNIV"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c)) has_integral integral UNIV f) UNIV
[PROOF STEP]
using x_integral_cases_integral
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) has_integral integral UNIV f) UNIV
(\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = (\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c))

goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c)) has_integral integral UNIV f) UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c)) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c)) has_integral integral UNIV f) UNIV
[PROOF STEP]
have "(?first_integral has_integral (integral UNIV f)) (cbox a b)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c)) has_integral integral UNIV f) UNIV

goal (1 subgoal):
 1. ((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y))) has_integral integral UNIV f) (cbox a b)
[PROOF STEP]
using  has_integral_restrict_UNIV[of "cbox a b" "?first_integral" "integral UNIV f"]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c)) has_integral integral UNIV f) UNIV
((\<lambda>x. if x \<in> cbox a b then integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)) else (0::'c)) has_integral integral UNIV f) UNIV = ((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y))) has_integral integral UNIV f) (cbox a b)

goal (1 subgoal):
 1. ((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y))) has_integral integral UNIV f) (cbox a b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y))) has_integral integral UNIV f) (cbox a b)

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y))) has_integral integral UNIV f) (cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y))) has_integral integral UNIV f) (cbox a b)

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
using two_D_integral_to_one_D
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y))) has_integral integral UNIV f) (cbox a b)
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y)))

goal (1 subgoal):
 1. integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
by (simp add: integral_unique)
[PROOF STATE]
proof (state)
this:
integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
have f_integrable:"f integrable_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on UNIV
[PROOF STEP]
using fun_lesbegue_integrable and integrable_on_lborel
[PROOF STATE]
proof (prove)
using this:
integrable lborel f
integrable lborel ?f \<Longrightarrow> ?f integrable_on UNIV

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

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f integrable_on UNIV
[PROOF STEP]
have LHS: "integral UNIV f = integral s g"
[PROOF STATE]
proof (prove)
using this:
f integrable_on UNIV

goal (1 subgoal):
 1. integral UNIV f = integral s g
[PROOF STEP]
apply (simp add: f_is_g_indicator)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> s then g x else (0::'c)) integrable_on UNIV \<Longrightarrow> integral UNIV (\<lambda>x. if x \<in> s then g x else (0::'c)) = integral s g
[PROOF STEP]
using integrable_restrict_UNIV
      integral_restrict_UNIV
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> ?s then ?f x else (0::?'a)) integrable_on UNIV) = (?f integrable_on ?s)
integral UNIV (\<lambda>x. if x \<in> ?S then ?f x else (0::?'a)) = integral ?S ?f

goal (1 subgoal):
 1. (\<lambda>x. if x \<in> s then g x else (0::'c)) integrable_on UNIV \<Longrightarrow> integral UNIV (\<lambda>x. if x \<in> s then g x else (0::'c)) = integral s g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral UNIV f = integral s g

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integral UNIV f = integral s g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
integral UNIV f = integral s g

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
using RHS and two_D_integral_to_one_D
[PROOF STATE]
proof (prove)
using this:
integral UNIV f = integral s g
integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y))) = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
integral UNIV f = integral UNIV (\<lambda>x. integral UNIV (\<lambda>y. f (x, y)))

goal (1 subgoal):
 1. integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
integral s g = integral (cbox a b) (\<lambda>x. integral (cbox (g1 x) (g2 x)) (\<lambda>y. g (x, y)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_Int: "card (A \<inter> B) = card A - card (A - B)" if "finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (A \<inter> B) = card A - card (A - B)
[PROOF STEP]
by (metis Diff_Diff_Int Diff_subset card_Diff_subset finite_Diff that)


[STATEMENT]
lemma omap_eq_Cons_conv[simp]: "omap f xs = Some (y#ys') \<longleftrightarrow> (\<exists>x xs'. xs=x#xs' \<and> f x = Some y \<and> omap f xs' = Some ys')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (omap f xs = Some (y # ys')) = (\<exists>x xs'. xs = x # xs' \<and> f x = Some y \<and> omap f xs' = Some ys')
[PROOF STEP]
apply (cases xs)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> (omap f xs = Some (y # ys')) = (\<exists>x xs'. xs = x # xs' \<and> f x = Some y \<and> omap f xs' = Some ys')
 2. \<And>a list. xs = a # list \<Longrightarrow> (omap f xs = Some (y # ys')) = (\<exists>x xs'. xs = x # xs' \<and> f x = Some y \<and> omap f xs' = Some ys')
[PROOF STEP]
apply (auto split: Option.bind_splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma vec_contains_count_gt1_iff: "a \<in>$ v \<longleftrightarrow> count_vec v a \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in>$ v) = (1 \<le> count_vec v a)
[PROOF STEP]
by (simp add: vec_set_mset_contains_iff)


[STATEMENT]
lemma NOT_mask: "NOT (mask n :: 'a::len word) = - (2 ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NOT (mask n) = - (2 ^ n)
[PROOF STEP]
by (simp add : NOT_eq mask_2pm1)


[STATEMENT]
lemma normal_map_fm:
  "\<forall>a. anormal(f a) = anormal(a) \<Longrightarrow> normal (map\<^sub>f\<^sub>m f \<phi>) = normal \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a. anormal (f a) = anormal a \<Longrightarrow> normal (map\<^sub>f\<^sub>m f \<phi>) = normal \<phi>
[PROOF STEP]
by(induct \<phi>) auto


[STATEMENT]
lemma (in domain) dense_repr_monom_closed:
  assumes "subring K R" "set p \<subseteq> K"
  shows "t \<in> set (dense_repr p) \<Longrightarrow> monom (fst t) (snd t) \<in> carrier (K[X])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> set (dense_repr p) \<Longrightarrow> local.monom (fst t) (snd t) \<in> carrier (K [X])
[PROOF STEP]
using dense_repr_set_fst[OF assms(2)] monom_is_polynomial[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
fst ` set (dense_repr p) \<subseteq> K - {\<zero>}
?a \<in> K - {\<zero>} \<Longrightarrow> polynomial K (local.monom ?a ?n)

goal (1 subgoal):
 1. t \<in> set (dense_repr p) \<Longrightarrow> local.monom (fst t) (snd t) \<in> carrier (K [X])
[PROOF STEP]
by (auto simp add: univ_poly_carrier)


[STATEMENT]
lemma SA_poly_glue_cfs1:
  assumes "f \<in> carrier (UP (SA m))"
  assumes "g \<in> carrier (UP (SA m))"
  assumes "is_semialgebraic m S"
  assumes "x \<in> S"
  shows "(SA_poly_glue m S f g) n x = f n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SA_poly_glue m S f g n x = f n x
[PROOF STEP]
unfolding SA_poly_glue_def fun_glue_def restrict_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) then if x \<in> S then f n x else g n x else undefined) = f n x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (UP (SA m))
g \<in> carrier (UP (SA m))
is_semialgebraic m S
x \<in> S

goal (1 subgoal):
 1. (if x \<in> carrier (Q\<^sub>p\<^bsup>m\<^esup>) then if x \<in> S then f n x else g n x else undefined) = f n x
[PROOF STEP]
by (metis SA_car local.function_ring_not_car padic_fields.UP_SA_cfs_closed padic_fields_axioms semialg_functions_memE(2))


[STATEMENT]
lemma a_complement_inf_double_complement:
  "-(x \<sqinter> --y) = -(x \<sqinter> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x \<sqinter> - - y) = - (x \<sqinter> y)
[PROOF STEP]
using l17
[PROOF STATE]
proof (prove)
using this:
- (?x \<sqinter> ?y) = - (?x \<sqinter> - - ?y)

goal (1 subgoal):
 1. - (x \<sqinter> - - y) = - (x \<sqinter> y)
[PROOF STEP]
by auto


[STATEMENT]
lemma expands_to_root_neg:
  assumes  "n > 0" "trimmed_neg F" "basis_wf basis" "(f expands_to F) basis"
  shows   "((\<lambda>x. root n (f x)) expands_to
             -powr_expansion False (-F) (inverse (real n))) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. root n (f x)) expands_to - powr_expansion False (- F) (inverse (real n))) basis
[PROOF STEP]
proof (rule expands_to_cong)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (?f expands_to - powr_expansion False (- F) (inverse (real n))) basis
 2. \<forall>\<^sub>F x in at_top. ?f x = root n (f x)
[PROOF STEP]
show "((\<lambda>x. -root n (-f x)) expands_to
          -powr_expansion False (-F) (inverse (real n))) basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - root n (- f x)) expands_to - powr_expansion False (- F) (inverse (real n))) basis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n
trimmed_neg F
basis_wf basis
(f expands_to F) basis

goal (1 subgoal):
 1. ((\<lambda>x. - root n (- f x)) expands_to - powr_expansion False (- F) (inverse (real n))) basis
[PROOF STEP]
by (intro expands_to_uminus expands_to_root trimmed_pos_uminus) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - root n (- f x)) expands_to - powr_expansion False (- F) (inverse (real n))) basis

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. - root n (- f x) = root n (f x)
[PROOF STEP]
qed (simp_all add: real_root_minus)


[STATEMENT]
lemma add_zmset_commute: "add_zmset x (add_zmset y M) = add_zmset y (add_zmset x M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_zmset x (add_zmset y M) = add_zmset y (add_zmset x M)
[PROOF STEP]
by (auto simp: zmultiset_eq_iff)


[STATEMENT]
lemma min_maxsimpchain_betw_uniform_length:
  assumes "min_maxsimpchain (x#xs@[y])" "min_maxsimpchain (x#ys@[y])"
  shows   "length xs = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
using   min_maxsimpchainD_min_betw[OF assms(1)]
          min_maxsimpchainD_min_betw[OF assms(2)]
          min_maxsimpchainD_maxsimpchain[OF assms(1)]
          min_maxsimpchainD_maxsimpchain[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
maxsimpchain (x # ?ys @ [y]) \<Longrightarrow> length xs \<le> length ?ys
maxsimpchain (x # ?ys @ [y]) \<Longrightarrow> length ys \<le> length ?ys
maxsimpchain (x # xs @ [y])
maxsimpchain (x # ys @ [y])

goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
by      fastforce


[STATEMENT]
lemma de_lcm_pCons:"de_lcm (pCons a p) = lcm (snd (quotient_of a)) (de_lcm p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. de_lcm (pCons a p) = lcm (snd (quotient_of a)) (de_lcm p)
[PROOF STEP]
unfolding de_lcm_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lcm (set (map (\<lambda>x. snd (quotient_of x)) (coeffs (pCons a p)))) = lcm (snd (quotient_of a)) (Lcm (set (map (\<lambda>x. snd (quotient_of x)) (coeffs p))))
[PROOF STEP]
by (cases "a=0\<and>p=0",auto)


[STATEMENT]
lemma conservation_const:
    "\<forall>v \<in> V - {s, t}. (\<Sum>e \<in> incoming v. f e) = (\<Sum>e \<in> outgoing v. f e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>V - {s, t}. sum f (incoming v) = sum f (outgoing v)
[PROOF STEP]
using no_deficient_nodes no_active_nodes
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>V - {s, t}. sum f (outgoing v) \<le> sum f (incoming v)
\<forall>v\<in>V - {s, t}. sum f (incoming v) \<le> sum f (outgoing v)

goal (1 subgoal):
 1. \<forall>v\<in>V - {s, t}. sum f (incoming v) = sum f (outgoing v)
[PROOF STEP]
by force


[STATEMENT]
lemma aform_val_add_aform:
  shows "aform_val e (add_aform X Y) = aform_val e X + aform_val e Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aform_val e (add_aform X Y) = aform_val e X + aform_val e Y
[PROOF STEP]
by (auto simp: add_aform_def aform_val_def)


[STATEMENT]
lemma gather_squares: "a * (a * b) = a^2 * (b :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (a * b) = a\<^sup>2 * b
[PROOF STEP]
by (simp_all add: power2_eq_square)


[STATEMENT]
lemma loxodromic_isometryI:
  assumes "isometry f"
          "stable_translation_length f \<noteq> 0"
  shows "loxodromic_isometry f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. loxodromic_isometry f
[PROOF STEP]
using assms elliptic_isometry_stable_translation_length
[PROOF STATE]
proof (prove)
using this:
isometry f
stable_translation_length f \<noteq> 0
elliptic_isometry ?f \<Longrightarrow> stable_translation_length ?f = 0

goal (1 subgoal):
 1. loxodromic_isometry f
[PROOF STEP]
unfolding loxodromic_isometry_def
[PROOF STATE]
proof (prove)
using this:
isometry f
stable_translation_length f \<noteq> 0
elliptic_isometry ?f \<Longrightarrow> stable_translation_length ?f = 0

goal (1 subgoal):
 1. isometry f \<and> \<not> elliptic_isometry f \<and> stable_translation_length f \<noteq> 0
[PROOF STEP]
by auto