[STATEMENT]
lemma disj_Union2:
  assumes "\<And>i. A i \<in> sets M"
  obtains B where "disjoint_family B" and "(\<Union>(i::nat). B i) = (\<Union>(i::nat). A i)"
    and "\<And>i. B i \<in> sets M" and "\<And>i. B i \<subseteq> A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> disjoint_family ?B2
 2. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<Union> (range ?B2) = \<Union> (range A)
 3. \<And>i. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> ?B2 i \<in> sets M
 4. \<And>i. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> ?B2 i \<subseteq> A i
[PROOF STEP]
define B where "B = (\<lambda>(i::nat). A i - (\<Union> j\<in>{..<i}. A j))"
[PROOF STATE]
proof (state)
this:
B = (\<lambda>i. A i - \<Union> (A ` {..<i}))

goal (4 subgoals):
 1. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> disjoint_family ?B2
 2. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> \<Union> (range ?B2) = \<Union> (range A)
 3. \<And>i. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> ?B2 i \<in> sets M
 4. \<And>i. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> ?B2 i \<subseteq> A i
[PROOF STEP]
show "\<And>i. B i \<subseteq> A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. B i \<subseteq> A i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. B i \<subseteq> A i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. B i \<subseteq> A i
[PROOF STEP]
show "B i \<subseteq> A i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B i \<subseteq> A i
[PROOF STEP]
proof (cases "i = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = 0 \<Longrightarrow> B i \<subseteq> A i
 2. i \<noteq> 0 \<Longrightarrow> B i \<subseteq> A i
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. i = 0 \<Longrightarrow> B i \<subseteq> A i
 2. i \<noteq> 0 \<Longrightarrow> B i \<subseteq> A i
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. B i \<subseteq> A i
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. A i - \<Union> (A ` {..<i}) \<subseteq> A i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B i \<subseteq> A i

goal (1 subgoal):
 1. i \<noteq> 0 \<Longrightarrow> B i \<subseteq> A i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<noteq> 0 \<Longrightarrow> B i \<subseteq> A i
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
i \<noteq> 0

goal (1 subgoal):
 1. i \<noteq> 0 \<Longrightarrow> B i \<subseteq> A i
[PROOF STEP]
hence "\<exists>j. i = Suc j"
[PROOF STATE]
proof (prove)
using this:
i \<noteq> 0

goal (1 subgoal):
 1. \<exists>j. i = Suc j
[PROOF STEP]
by (simp add: not0_implies_Suc)
[PROOF STATE]
proof (state)
this:
\<exists>j. i = Suc j

goal (1 subgoal):
 1. i \<noteq> 0 \<Longrightarrow> B i \<subseteq> A i
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>j. i = Suc j
[PROOF STEP]
obtain j where "i = Suc j"
[PROOF STATE]
proof (prove)
using this:
\<exists>j. i = Suc j

goal (1 subgoal):
 1. (\<And>j. i = Suc j \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i = Suc j

goal (1 subgoal):
 1. i \<noteq> 0 \<Longrightarrow> B i \<subseteq> A i
[PROOF STEP]
thus "B i \<subseteq> A i"
[PROOF STATE]
proof (prove)
using this:
i = Suc j

goal (1 subgoal):
 1. B i \<subseteq> A i
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
using this:
i = Suc j

goal (1 subgoal):
 1. A i - \<Union> (A ` {..<i}) \<subseteq> A i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B i \<subseteq> A i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
B i \<subseteq> A i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
B ?i \<subseteq> A ?i

goal (3 subgoals):
 1. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> disjoint_family (\<lambda>i. A i - \<Union> (A ` {..<i}))
 2. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (\<Union>i. A i - \<Union> (A ` {..<i})) = \<Union> (range A)
 3. \<And>i. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> A i - \<Union> (A ` {..<i}) \<in> sets M
[PROOF STEP]
show "disjoint_family B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_family B
[PROOF STEP]
unfolding disjoint_family_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
fix n m::nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
assume "n <m"
[PROOF STATE]
proof (state)
this:
n < m

goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
hence "B n \<subseteq> (\<Union> j\<in>{..<m}. A j)"
[PROOF STATE]
proof (prove)
using this:
n < m

goal (1 subgoal):
 1. B n \<subseteq> \<Union> (A ` {..<m})
[PROOF STEP]
using \<open>\<And>i. B i \<subseteq> A i\<close>
[PROOF STATE]
proof (prove)
using this:
n < m
B ?i \<subseteq> A ?i

goal (1 subgoal):
 1. B n \<subseteq> \<Union> (A ` {..<m})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B n \<subseteq> \<Union> (A ` {..<m})

goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
hence "B n \<inter> B m = {}"
[PROOF STATE]
proof (prove)
using this:
B n \<subseteq> \<Union> (A ` {..<m})

goal (1 subgoal):
 1. B n \<inter> B m = {}
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
using this:
A n - \<Union> (A ` {..<n}) \<subseteq> \<Union> (A ` {..<m})

goal (1 subgoal):
 1. (A n - \<Union> (A ` {..<n})) \<inter> (A m - \<Union> (A ` {..<m})) = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B n \<inter> B m = {}

goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?n2 < ?m2 \<Longrightarrow> B ?n2 \<inter> B ?m2 = {}

goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
thus "\<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}"
[PROOF STATE]
proof (prove)
using this:
?n2 < ?m2 \<Longrightarrow> B ?n2 \<inter> B ?m2 = {}

goal (1 subgoal):
 1. \<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}
[PROOF STEP]
by (metis Int_commute antisym_conv3)
[PROOF STATE]
proof (state)
this:
\<forall>m\<in>UNIV. \<forall>n\<in>UNIV. m \<noteq> n \<longrightarrow> B m \<inter> B n = {}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
disjoint_family B

goal (2 subgoals):
 1. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> (\<Union>i. A i - \<Union> (A ` {..<i})) = \<Union> (range A)
 2. \<And>i. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> A i - \<Union> (A ` {..<i}) \<in> sets M
[PROOF STEP]
show "(\<Union>(i::nat). B i) = (\<Union>(i::nat). A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (range B) = \<Union> (range A)
[PROOF STEP]
proof (rule disj_subsets)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B 0 = A 0
 2. \<And>i. B (Suc i) = A (Suc i) - \<Union> (A ` {..i})
[PROOF STEP]
show "B 0 = A 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B 0 = A 0
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A 0 - \<Union> (A ` {..<0}) = A 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
B 0 = A 0

goal (1 subgoal):
 1. \<And>i. B (Suc i) = A (Suc i) - \<Union> (A ` {..i})
[PROOF STEP]
show "\<And>i. B (Suc i) = A (Suc i) - \<Union> (A ` {..i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. B (Suc i) = A (Suc i) - \<Union> (A ` {..i})
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. A (Suc i) - \<Union> (A ` {..<Suc i}) = A (Suc i) - \<Union> (A ` {..i})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B (Suc ?i) = A (Suc ?i) - \<Union> (A ` {..?i})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Union> (range B) = \<Union> (range A)

goal (1 subgoal):
 1. \<And>i. (\<And>B. \<lbrakk>disjoint_family B; \<Union> (range B) = \<Union> (range A); \<And>i. B i \<in> sets M; \<And>i. B i \<subseteq> A i\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> A i - \<Union> (A ` {..<i}) \<in> sets M
[PROOF STEP]
show "\<And>i. B i \<in> sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. B i \<in> sets M
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. A i - \<Union> (A ` {..<i}) \<in> sets M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A ?i \<in> sets M

goal (1 subgoal):
 1. \<And>i. A i - \<Union> (A ` {..<i}) \<in> sets M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B ?i \<in> sets M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma psign_diff_cancel:
  assumes "poly r x\<noteq>0"
  shows "psign_diff (r*p) (r*q) x = psign_diff p q x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
proof  -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
have "poly (r * p) x = 0 \<longleftrightarrow> poly p x=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (r * p) x = 0) = (poly p x = 0)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
(poly (r * p) x = 0) = (poly p x = 0)

goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(poly (r * p) x = 0) = (poly p x = 0)

goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
have "poly (r * q) x = 0 \<longleftrightarrow> poly q x=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (r * q) x = 0) = (poly q x = 0)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
(poly (r * q) x = 0) = (poly q x = 0)

goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(poly (r * q) x = 0) = (poly q x = 0)

goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
have "\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar>
                    = \<bar>sign (poly p x) - sign (poly q x)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
have "\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar>
       = \<bar>sign (poly r x) * (sign (poly p x) - sign (poly q x))\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly r x) * (sign (poly p x) - sign (poly q x))\<bar>
[PROOF STEP]
by (simp add:algebra_simps sign_times)
[PROOF STATE]
proof (state)
this:
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly r x) * (sign (poly p x) - sign (poly q x))\<bar>

goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly r x) * (sign (poly p x) - sign (poly q x))\<bar>

goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
have "... = \<bar>sign (poly r x) \<bar>
                        * \<bar>sign (poly p x) - sign (poly q x)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sign (poly r x) * (sign (poly p x) - sign (poly q x))\<bar> = \<bar>sign (poly r x)\<bar> * \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
unfolding abs_mult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sign (poly r x)\<bar> * \<bar>sign (poly p x) - sign (poly q x)\<bar> = \<bar>sign (poly r x)\<bar> * \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>sign (poly r x) * (sign (poly p x) - sign (poly q x))\<bar> = \<bar>sign (poly r x)\<bar> * \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>sign (poly r x) * (sign (poly p x) - sign (poly q x))\<bar> = \<bar>sign (poly r x)\<bar> * \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
have "... = \<bar>sign (poly p x) - sign (poly q x)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>sign (poly r x)\<bar> * \<bar>sign (poly p x) - sign (poly q x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
by (simp add: Sturm_Tarski.sign_def assms)
[PROOF STATE]
proof (state)
this:
\<bar>sign (poly r x)\<bar> * \<bar>sign (poly p x) - sign (poly q x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal (1 subgoal):
 1. \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(poly (r * p) x = 0) = (poly p x = 0)
(poly (r * q) x = 0) = (poly q x = 0)
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(poly (r * p) x = 0) = (poly p x = 0)
(poly (r * q) x = 0) = (poly q x = 0)
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal (1 subgoal):
 1. psign_diff (r * p) (r * q) x = psign_diff p q x
[PROOF STEP]
unfolding psign_diff_def
[PROOF STATE]
proof (prove)
using this:
(poly (r * p) x = 0) = (poly p x = 0)
(poly (r * q) x = 0) = (poly q x = 0)
\<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar> = \<bar>sign (poly p x) - sign (poly q x)\<bar>

goal (1 subgoal):
 1. (if poly (r * p) x = 0 \<and> poly (r * q) x = 0 then 1 else \<bar>sign (poly (r * p) x) - sign (poly (r * q) x)\<bar>) = (if poly p x = 0 \<and> poly q x = 0 then 1 else \<bar>sign (poly p x) - sign (poly q x)\<bar>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
psign_diff (r * p) (r * q) x = psign_diff p q x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in pair_sigma_finite) emeasure_pair_measure_finite:
  assumes A: "A \<in> sets (M1 \<Otimes>\<^sub>M M2)" and finite: "emeasure (M1 \<Otimes>\<^sub>M M2) A < \<infinity>"
  shows "AE x in M1. emeasure M2 {y\<in>space M2. (x, y) \<in> A} < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>
[PROOF STEP]
from M2.emeasure_pair_measure_alt[OF A] finite
[PROOF STATE]
proof (chain)
picking this:
emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ x. emeasure M2 (Pair x -` A) \<partial>M1
emeasure (M1 \<Otimes>\<^sub>M M2) A < \<infinity>
[PROOF STEP]
have "(\<integral>\<^sup>+ x. emeasure M2 (Pair x -` A) \<partial>M1) \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
using this:
emeasure (M1 \<Otimes>\<^sub>M M2) A = \<integral>\<^sup>+ x. emeasure M2 (Pair x -` A) \<partial>M1
emeasure (M1 \<Otimes>\<^sub>M M2) A < \<infinity>

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. emeasure M2 (Pair x -` A) \<partial>M1 \<noteq> \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. emeasure M2 (Pair x -` A) \<partial>M1 \<noteq> \<infinity>

goal (1 subgoal):
 1. AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. emeasure M2 (Pair x -` A) \<partial>M1 \<noteq> \<infinity>
[PROOF STEP]
have "AE x in M1. emeasure M2 (Pair x -` A) \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. emeasure M2 (Pair x -` A) \<partial>M1 \<noteq> \<infinity>

goal (1 subgoal):
 1. AE x in M1. emeasure M2 (Pair x -` A) \<noteq> \<infinity>
[PROOF STEP]
by (rule nn_integral_PInf_AE[rotated]) (intro M2.measurable_emeasure_Pair A)
[PROOF STATE]
proof (state)
this:
AE x in M1. emeasure M2 (Pair x -` A) \<noteq> \<infinity>

goal (1 subgoal):
 1. AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
AE x in M1. emeasure M2 (Pair x -` A) \<noteq> \<infinity>

goal (1 subgoal):
 1. AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>
[PROOF STEP]
have "\<And>x. x \<in> space M1 \<Longrightarrow> Pair x -` A = {y\<in>space M2. (x, y) \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> space M1 \<Longrightarrow> Pair x -` A = {y \<in> space M2. (x, y) \<in> A}
[PROOF STEP]
using sets.sets_into_space[OF A]
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> space (M1 \<Otimes>\<^sub>M M2)

goal (1 subgoal):
 1. \<And>x. x \<in> space M1 \<Longrightarrow> Pair x -` A = {y \<in> space M2. (x, y) \<in> A}
[PROOF STEP]
by (auto simp: space_pair_measure)
[PROOF STATE]
proof (state)
this:
?x \<in> space M1 \<Longrightarrow> Pair ?x -` A = {y \<in> space M2. (?x, y) \<in> A}

goal (1 subgoal):
 1. AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
AE x in M1. emeasure M2 (Pair x -` A) \<noteq> \<infinity>
?x \<in> space M1 \<Longrightarrow> Pair ?x -` A = {y \<in> space M2. (?x, y) \<in> A}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in M1. emeasure M2 (Pair x -` A) \<noteq> \<infinity>
?x \<in> space M1 \<Longrightarrow> Pair ?x -` A = {y \<in> space M2. (?x, y) \<in> A}

goal (1 subgoal):
 1. AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>
[PROOF STEP]
by (auto simp: less_top)
[PROOF STATE]
proof (state)
this:
AE x in M1. emeasure M2 {y \<in> space M2. (x, y) \<in> A} < \<infinity>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma suminf_minus: "summable f \<Longrightarrow> (\<Sum>n. - f n) = - (\<Sum>n. f n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<Sum>n. - f n) = - (\<Sum>n. f n)
[PROOF STEP]
by (intro sums_unique [symmetric] sums_minus summable_sums)


[STATEMENT]
lemma Fvars_softSubst_subst_notIn:
  "\<phi> \<in> fmla \<Longrightarrow> t \<in> trm \<Longrightarrow> x \<in> var \<Longrightarrow> x \<notin> FvarsT t \<Longrightarrow> x \<notin> Fvars \<phi> \<Longrightarrow>
 Fvars (softSubst \<phi> t x) = Fvars (subst \<phi> t x) \<union> FvarsT t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<phi> \<in> fmla; t \<in> trm; x \<in> var; x \<notin> FvarsT t; x \<notin> Fvars \<phi>\<rbrakk> \<Longrightarrow> Fvars (softSubst \<phi> t x) = Fvars (subst \<phi> t x) \<union> FvarsT t
[PROOF STEP]
by auto


[STATEMENT]
lemma multiplicity_diff_pow_coprime:
  assumes "coprime p n"
  shows "multiplicity p (x^n - y^n) = multiplicity p (x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)
[PROOF STEP]
have factor: "x^n - y^n = (\<Sum>i<n. y^(n - Suc i) * x^i) * (x - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ n - y ^ n = (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) * (x - y)
[PROOF STEP]
by (simp add: power_diff_sumr2)
[PROOF STATE]
proof (state)
this:
x ^ n - y ^ n = (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) * (x - y)

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x ^ n - y ^ n = (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) * (x - y)

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)
[PROOF STEP]
have "\<not> p dvd (\<Sum>i<n. y^(n - Suc i) * x^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
assume "p dvd (\<Sum>i<n. y^(n - Suc i) * x^i)"
[PROOF STATE]
proof (state)
this:
int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)

goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
with decompose_mod_p
[PROOF STATE]
proof (chain)
picking this:
[\<Sum>i<?n. y ^ (?n - Suc i) * x ^ i = int ?n * x ^ (?n - 1)] (mod int p)
int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)
[PROOF STEP]
have "p dvd n * x^(n-1)"
[PROOF STATE]
proof (prove)
using this:
[\<Sum>i<?n. y ^ (?n - Suc i) * x ^ i = int ?n * x ^ (?n - 1)] (mod int p)
int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)

goal (1 subgoal):
 1. int p dvd int n * x ^ (n - 1)
[PROOF STEP]
using cong_dvd_iff
[PROOF STATE]
proof (prove)
using this:
[\<Sum>i<?n. y ^ (?n - Suc i) * x ^ i = int ?n * x ^ (?n - 1)] (mod int p)
int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)
[?b = ?c] (mod ?a) \<Longrightarrow> (?a dvd ?b) = (?a dvd ?c)

goal (1 subgoal):
 1. int p dvd int n * x ^ (n - 1)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
int p dvd int n * x ^ (n - 1)

goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
with \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
prime p
int p dvd int n * x ^ (n - 1)
[PROOF STEP]
have "p dvd n \<or> p dvd x^(n-1)"
[PROOF STATE]
proof (prove)
using this:
prime p
int p dvd int n * x ^ (n - 1)

goal (1 subgoal):
 1. p dvd n \<or> int p dvd x ^ (n - 1)
[PROOF STEP]
by (simp add: prime_dvd_mult_eq_int)
[PROOF STATE]
proof (state)
this:
p dvd n \<or> int p dvd x ^ (n - 1)

goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p dvd n \<or> int p dvd x ^ (n - 1)

goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
from \<open>coprime p n\<close> and \<open>prime p\<close>
[PROOF STATE]
proof (chain)
picking this:
coprime p n
prime p
[PROOF STEP]
have "\<not>p dvd n"
[PROOF STATE]
proof (prove)
using this:
coprime p n
prime p

goal (1 subgoal):
 1. \<not> p dvd n
[PROOF STEP]
using coprime_absorb_right not_prime_unit
[PROOF STATE]
proof (prove)
using this:
coprime p n
prime p
?y dvd ?x \<Longrightarrow> coprime ?x ?y = is_unit ?y
is_unit ?x \<Longrightarrow> \<not> prime ?x

goal (1 subgoal):
 1. \<not> p dvd n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<not> p dvd n

goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p dvd n \<or> int p dvd x ^ (n - 1)
\<not> p dvd n
[PROOF STEP]
have "p dvd x^(n-1)"
[PROOF STATE]
proof (prove)
using this:
p dvd n \<or> int p dvd x ^ (n - 1)
\<not> p dvd n

goal (1 subgoal):
 1. int p dvd x ^ (n - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int p dvd x ^ (n - 1)

goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
hence "p dvd x"
[PROOF STATE]
proof (prove)
using this:
int p dvd x ^ (n - 1)

goal (1 subgoal):
 1. int p dvd x
[PROOF STEP]
using \<open>prime p\<close> prime_dvd_power_int prime_nat_int_transfer
[PROOF STATE]
proof (prove)
using this:
int p dvd x ^ (n - 1)
prime p
\<lbrakk>prime ?p; ?p dvd ?x ^ ?n\<rbrakk> \<Longrightarrow> ?p dvd ?x
prime (int ?n) = prime ?n

goal (1 subgoal):
 1. int p dvd x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
int p dvd x

goal (1 subgoal):
 1. int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) \<Longrightarrow> False
[PROOF STEP]
with \<open>\<not>p dvd x\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> int p dvd x
int p dvd x
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
\<not> int p dvd x
int p dvd x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x ^ n - y ^ n = (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) * (x - y)
\<not> int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)
[PROOF STEP]
show "multiplicity p (x^n - y^n) = multiplicity p (x - y)"
[PROOF STATE]
proof (prove)
using this:
x ^ n - y ^ n = (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) * (x - y)
\<not> int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)
[PROOF STEP]
using \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
x ^ n - y ^ n = (\<Sum>i<n. y ^ (n - Suc i) * x ^ i) * (x - y)
\<not> int p dvd (\<Sum>i<n. y ^ (n - Suc i) * x ^ i)
prime p

goal (1 subgoal):
 1. multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)
[PROOF STEP]
by (auto intro: multiplicity_prime_elem_times_other)
[PROOF STATE]
proof (state)
this:
multiplicity (int p) (x ^ n - y ^ n) = multiplicity (int p) (x - y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hom_swaprows: "i < dim_row A \<Longrightarrow> j < dim_row A \<Longrightarrow>
  swaprows i j (mat\<^sub>h A) = mat\<^sub>h (swaprows i j A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row A; j < dim_row A\<rbrakk> \<Longrightarrow> swaprows i j (mat\<^sub>h A) = mat\<^sub>h (swaprows i j A)
[PROOF STEP]
unfolding mat_swaprows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < dim_row A; j < dim_row A\<rbrakk> \<Longrightarrow> mat (dim_row (mat\<^sub>h A)) (dim_col (mat\<^sub>h A)) (\<lambda>(ia, ja). if i = ia then mat\<^sub>h A $$ (j, ja) else if j = ia then mat\<^sub>h A $$ (i, ja) else mat\<^sub>h A $$ (ia, ja)) = mat\<^sub>h (mat (dim_row A) (dim_col A) (\<lambda>(ia, ja). if i = ia then A $$ (j, ja) else if j = ia then A $$ (i, ja) else A $$ (ia, ja)))
[PROOF STEP]
by (rule eq_matI, auto)


[STATEMENT]
lemma streamValue9:
assumes h1:"\<forall>j\<le>2 * d. str (t + j + Suc (i + k)) = x"
       and h2:"j\<le>d"
shows      "str (t + i + k + d + Suc j) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. str (t + i + k + d + Suc j) = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. str (t + i + k + d + Suc j) = x
[PROOF STEP]
from h2
[PROOF STATE]
proof (chain)
picking this:
j \<le> d
[PROOF STEP]
have "(j+d) \<le>2 * d"
[PROOF STATE]
proof (prove)
using this:
j \<le> d

goal (1 subgoal):
 1. j + d \<le> 2 * d
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
j + d \<le> 2 * d

goal (1 subgoal):
 1. str (t + i + k + d + Suc j) = x
[PROOF STEP]
from h1 and this
[PROOF STATE]
proof (chain)
picking this:
\<forall>j\<le>2 * d. str (t + j + Suc (i + k)) = x
j + d \<le> 2 * d
[PROOF STEP]
have "str (t + (j + d) + Suc (i + k)) = x"
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<le>2 * d. str (t + j + Suc (i + k)) = x
j + d \<le> 2 * d

goal (1 subgoal):
 1. str (t + (j + d) + Suc (i + k)) = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
str (t + (j + d) + Suc (i + k)) = x

goal (1 subgoal):
 1. str (t + i + k + d + Suc j) = x
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
str (t + (j + d) + Suc (i + k)) = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
str (t + (j + d) + Suc (i + k)) = x

goal (1 subgoal):
 1. str (t + i + k + d + Suc j) = x
[PROOF STEP]
by (simp add: arith_streamValue9aux)
[PROOF STATE]
proof (state)
this:
str (t + i + k + d + Suc j) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_gcd1:
  assumes a_not0: "a \<noteq> 0"
  shows "degree (gcd a b) \<le> degree a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
let ?g = "gcd a b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
have gcd_dvd_b: "?g dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a b dvd a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd a b dvd a

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
gcd a b dvd a
[PROOF STEP]
obtain c where a_gc: "a = ?g * c"
[PROOF STATE]
proof (prove)
using this:
gcd a b dvd a

goal (1 subgoal):
 1. (\<And>c. a = gcd a b * c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. a = gcd a b * k

goal (1 subgoal):
 1. (\<And>c. a = gcd a b * c \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = gcd a b * c

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
have g_not0: "?g \<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd a b \<noteq> 0
[PROOF STEP]
using a_not0 a_gc
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
a = gcd a b * c

goal (1 subgoal):
 1. gcd a b \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gcd a b \<noteq> 0

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
have c0: "c \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> 0
[PROOF STEP]
using a_not0 a_gc
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0
a = gcd a b * c

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

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
have "degree ?g \<le> degree (?g * c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (gcd a b) \<le> degree (gcd a b * c)
[PROOF STEP]
by (rule degree_mult_right_le[OF c0])
[PROOF STATE]
proof (state)
this:
degree (gcd a b) \<le> degree (gcd a b * c)

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (gcd a b) \<le> degree (gcd a b * c)

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
have "... = degree a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (gcd a b * c) = degree a
[PROOF STEP]
using a_gc
[PROOF STATE]
proof (prove)
using this:
a = gcd a b * c

goal (1 subgoal):
 1. degree (gcd a b * c) = degree a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (gcd a b * c) = degree a

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (gcd a b) \<le> degree a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (gcd a b) \<le> degree a

goal (1 subgoal):
 1. degree (gcd a b) \<le> degree a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
degree (gcd a b) \<le> degree a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma IVT':
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
  assumes y: "f a \<le> y" "y \<le> f b" "a \<le> b"
    and *: "continuous_on {a .. b} f"
  shows "\<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x\<ge>a. x \<le> b \<and> f x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x\<ge>a. x \<le> b \<and> f x = y
[PROOF STEP]
have "connected {a..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. connected {a..b}
[PROOF STEP]
unfolding connected_iff_interval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>{a..b}. \<forall>y\<in>{a..b}. \<forall>z\<ge>x. z \<le> y \<longrightarrow> z \<in> {a..b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
connected {a..b}

goal (1 subgoal):
 1. \<exists>x\<ge>a. x \<le> b \<and> f x = y
[PROOF STEP]
from connected_continuous_image[OF * this, THEN connectedD_interval, of "f a" "f b" y] y
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>f a \<in> f ` {a..b}; f b \<in> f ` {a..b}; f a \<le> y; y \<le> f b\<rbrakk> \<Longrightarrow> y \<in> f ` {a..b}
f a \<le> y
y \<le> f b
a \<le> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f a \<in> f ` {a..b}; f b \<in> f ` {a..b}; f a \<le> y; y \<le> f b\<rbrakk> \<Longrightarrow> y \<in> f ` {a..b}
f a \<le> y
y \<le> f b
a \<le> b

goal (1 subgoal):
 1. \<exists>x\<ge>a. x \<le> b \<and> f x = y
[PROOF STEP]
by (auto simp add: atLeastAtMost_def atLeast_def atMost_def)
[PROOF STATE]
proof (state)
this:
\<exists>x\<ge>a. x \<le> b \<and> f x = y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma i_set_mult_imp_not_empty: "I \<in> i_set_mult k \<Longrightarrow> I \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<in> i_set_mult k \<Longrightarrow> I \<noteq> {}
[PROOF STEP]
by (induct I rule: i_set_mult.induct, simp_all add: iT_not_empty)


[STATEMENT]
lemma zero_notin_S: "0\<notin>S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<notin> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}) \<Longrightarrow> False
[PROOF STEP]
assume "0\<in>S"
[PROOF STATE]
proof (state)
this:
0 \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g})

goal (1 subgoal):
 1. 0 \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}) \<Longrightarrow> False
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
0 \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g})
[PROOF STEP]
obtain f g
    where "(f,g)\<in>fundfoldpairs" "0 = Abs_induced_automorph f g"
[PROOF STATE]
proof (prove)
using this:
0 \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g})

goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>(f, g) \<in> fundfoldpairs; 0 = Abs_induced_automorph f g\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by    fast
[PROOF STATE]
proof (state)
this:
(f, g) \<in> fundfoldpairs
0 = Abs_induced_automorph f g

goal (1 subgoal):
 1. 0 \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}) \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
(f, g) \<in> fundfoldpairs
0 = Abs_induced_automorph f g

goal (1 subgoal):
 1. False
[PROOF STEP]
using Abs_permutation_inject[of id "induced_automorph f g"]
          bij_id fundfoldpairs_induced_autormorph_bij
          fundfoldpairs_induced_autormorph_ntrivial
[PROOF STATE]
proof (prove)
using this:
(f, g) \<in> fundfoldpairs
0 = Abs_induced_automorph f g
\<lbrakk>id \<in> {f. bij f}; induced_automorph f g \<in> {f. bij f}\<rbrakk> \<Longrightarrow> (Abs_permutation id = Abs_induced_automorph f g) = (id = induced_automorph f g)
bij id
(?f, ?g) \<in> fundfoldpairs \<Longrightarrow> bij (induced_automorph ?f ?g)
(?f, ?g) \<in> fundfoldpairs \<Longrightarrow> induced_automorph ?f ?g \<noteq> id

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iFROM_mult: "[n\<dots>] \<otimes> k = [ n * k, mod k ]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [n\<dots>] \<otimes> k = [ n * k, mod k ]
[PROOF STEP]
apply (case_tac "k = 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> [n\<dots>] \<otimes> k = [ n * k, mod k ]
 2. k \<noteq> 0 \<Longrightarrow> [n\<dots>] \<otimes> k = [ n * k, mod k ]
[PROOF STEP]
apply (simp add: iMOD_0 iT_mult_0 iIN_0 iTILL_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<noteq> 0 \<Longrightarrow> [n\<dots>] \<otimes> k = [ n * k, mod k ]
[PROOF STEP]
apply (clarsimp simp: set_eq_iff iT_Mult_mem_iff iT_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < k \<Longrightarrow> (x mod k = 0 \<and> n \<le> x div k) = (x mod k = 0 \<and> n * k \<le> x)
[PROOF STEP]
apply (rule conj_cong, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < k; x mod k = 0\<rbrakk> \<Longrightarrow> (n \<le> x div k) = (n * k \<le> x)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>0 < k; x mod k = 0; n \<le> x div k\<rbrakk> \<Longrightarrow> n * k \<le> x
 2. \<And>x. \<lbrakk>0 < k; x mod k = 0; n * k \<le> x\<rbrakk> \<Longrightarrow> n \<le> x div k
[PROOF STEP]
apply (drule mult_le_mono1[of _ _ k])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>0 < k; x mod k = 0; n * k \<le> x div k * k\<rbrakk> \<Longrightarrow> n * k \<le> x
 2. \<And>x. \<lbrakk>0 < k; x mod k = 0; n * k \<le> x\<rbrakk> \<Longrightarrow> n \<le> x div k
[PROOF STEP]
apply (rule order_trans, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>0 < k; x mod k = 0; n * k \<le> x div k * k\<rbrakk> \<Longrightarrow> x div k * k \<le> x
 2. \<And>x. \<lbrakk>0 < k; x mod k = 0; n * k \<le> x\<rbrakk> \<Longrightarrow> n \<le> x div k
[PROOF STEP]
apply (simp add: div_mult_cancel)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < k; x mod k = 0; n * k \<le> x\<rbrakk> \<Longrightarrow> n \<le> x div k
[PROOF STEP]
apply (drule div_le_mono[of _ _ k])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>0 < k; x mod k = 0; n * k div k \<le> x div k\<rbrakk> \<Longrightarrow> n \<le> x div k
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem "P \<sim>\<cdot>\<^sub>S Q \<longrightarrow> P \<sim>\<cdot> Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<sim>\<cdot>\<^sub>S Q \<longrightarrow> P \<sim>\<cdot> Q
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<sim>\<cdot>\<^sub>S Q \<Longrightarrow> P \<sim>\<cdot> Q
[PROOF STEP]
assume "P \<sim>\<cdot>\<^sub>S Q"
[PROOF STATE]
proof (state)
this:
P \<sim>\<cdot>\<^sub>S Q

goal (1 subgoal):
 1. P \<sim>\<cdot>\<^sub>S Q \<Longrightarrow> P \<sim>\<cdot> Q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P \<sim>\<cdot>\<^sub>S Q
[PROOF STEP]
have "S_transform.logically_equivalent P Q"
[PROOF STATE]
proof (prove)
using this:
P \<sim>\<cdot>\<^sub>S Q

goal (1 subgoal):
 1. S_transform.logically_equivalent P Q
[PROOF STEP]
by (fact S_transform.bisimilarity_implies_equivalence)
[PROOF STATE]
proof (state)
this:
S_transform.logically_equivalent P Q

goal (1 subgoal):
 1. P \<sim>\<cdot>\<^sub>S Q \<Longrightarrow> P \<sim>\<cdot> Q
[PROOF STEP]
with valid_iff_valid_S_transform
[PROOF STATE]
proof (chain)
picking this:
?P \<Turnstile> ?x = ?P \<Turnstile>\<^sub>S S_transform ?x
S_transform.logically_equivalent P Q
[PROOF STEP]
have "logically_equivalent P Q"
[PROOF STATE]
proof (prove)
using this:
?P \<Turnstile> ?x = ?P \<Turnstile>\<^sub>S S_transform ?x
S_transform.logically_equivalent P Q

goal (1 subgoal):
 1. P =\<cdot> Q
[PROOF STEP]
using logically_equivalent_def S_transform.logically_equivalent_def
[PROOF STATE]
proof (prove)
using this:
?P \<Turnstile> ?x = ?P \<Turnstile>\<^sub>S S_transform ?x
S_transform.logically_equivalent P Q
?P =\<cdot> ?Q \<equiv> \<forall>x. ?P \<Turnstile> x = ?Q \<Turnstile> x
S_transform.logically_equivalent ?P ?Q \<equiv> \<forall>x. ?P \<Turnstile>\<^sub>S x = ?Q \<Turnstile>\<^sub>S x

goal (1 subgoal):
 1. P =\<cdot> Q
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
P =\<cdot> Q

goal (1 subgoal):
 1. P \<sim>\<cdot>\<^sub>S Q \<Longrightarrow> P \<sim>\<cdot> Q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P =\<cdot> Q
[PROOF STEP]
show "P \<sim>\<cdot> Q"
[PROOF STATE]
proof (prove)
using this:
P =\<cdot> Q

goal (1 subgoal):
 1. P \<sim>\<cdot> Q
[PROOF STEP]
by (fact equivalence_implies_bisimilarity)
[PROOF STATE]
proof (state)
this:
P \<sim>\<cdot> Q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_vector_box: "\<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}
[PROOF STEP]
have "{x. \<forall>i. x $ i \<in> S i} = (\<Inter>i. (\<lambda>x. x $ i) -` S i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. \<forall>i. x $ i \<in> S i} = (\<Inter>i. (\<lambda>x. x $ i) -` S i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. \<forall>i. x $ i \<in> S i} = (\<Inter>i. (\<lambda>x. x $ i) -` S i)

goal (1 subgoal):
 1. \<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}
[PROOF STEP]
thus "\<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}"
[PROOF STATE]
proof (prove)
using this:
{x. \<forall>i. x $ i \<in> S i} = (\<Inter>i. (\<lambda>x. x $ i) -` S i)

goal (1 subgoal):
 1. \<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}
[PROOF STEP]
by (simp add: closed_INT closed_vimage_vec_nth)
[PROOF STATE]
proof (state)
this:
\<forall>i. closed (S i) \<Longrightarrow> closed {x. \<forall>i. x $ i \<in> S i}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Gram_Schmidt_column_k_iarrays_efficient_eq[code]: "Gram_Schmidt_column_k_iarrays_efficient A k
  = Gram_Schmidt_column_k_iarrays_efficient2 A k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gram_Schmidt_column_k_iarrays_efficient A k = Gram_Schmidt_column_k_iarrays_efficient2 A k
[PROOF STEP]
unfolding Gram_Schmidt_column_k_iarrays_efficient_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tabulate2 (nrows_iarray A) (ncols_iarray A) (\<lambda>a b. let column_b_A = column_iarray b A in (if b = k then column_b_A - (\<Sum>x\<leftarrow>map (\<lambda>n. column_iarray n A) [0..<b]. (column_b_A \<bullet>i x / (x \<bullet>i x)) *\<^sub>R x) else column_b_A) !! a) = Gram_Schmidt_column_k_iarrays_efficient2 A k
[PROOF STEP]
unfolding Gram_Schmidt_column_k_iarrays_efficient2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tabulate2 (nrows_iarray A) (ncols_iarray A) (\<lambda>a b. let column_b_A = column_iarray b A in (if b = k then column_b_A - (\<Sum>x\<leftarrow>map (\<lambda>n. column_iarray n A) [0..<b]. (column_b_A \<bullet>i x / (x \<bullet>i x)) *\<^sub>R x) else column_b_A) !! a) = tabulate2 (nrows_iarray A) (ncols_iarray A) (let col_k = column_iarray k A; col = col_k - (\<Sum>x\<leftarrow>map (\<lambda>n. column_iarray n A) [0..<k]. (col_k \<bullet>i x / (x \<bullet>i x)) *\<^sub>R x) in (\<lambda>a b. (if b = k then col else column_iarray b A) !! a))
[PROOF STEP]
unfolding Let_def tabulate2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>i. IArray.of_fun (\<lambda>b. (if b = k then column_iarray b A - (\<Sum>x\<leftarrow>map (\<lambda>n. column_iarray n A) [0..<b]. (column_iarray b A \<bullet>i x / (x \<bullet>i x)) *\<^sub>R x) else column_iarray b A) !! i) (ncols_iarray A)) (nrows_iarray A) = IArray.of_fun (\<lambda>i. IArray.of_fun (\<lambda>b. (if b = k then column_iarray k A - (\<Sum>x\<leftarrow>map (\<lambda>n. column_iarray n A) [0..<k]. (column_iarray k A \<bullet>i x / (x \<bullet>i x)) *\<^sub>R x) else column_iarray b A) !! i) (ncols_iarray A)) (nrows_iarray A)
[PROOF STEP]
by simp


[STATEMENT]
lemma compute_msum_pdevs[code]: "msum_pdevs m (Pdevs xs) (Pdevs ys) = Pdevs (msum_slist m xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. msum_pdevs m (Pdevs xs) (Pdevs ys) = Pdevs (msum_slist m xs ys)
[PROOF STEP]
by (rule pdevs_eqI) (auto simp: pdevs_apply_msum_slist pdevs_apply_msum_pdevs)


[STATEMENT]
lemma disc_rfr_proc_positive:
  assumes "-1 < r"
  shows "\<And>n w . 0 < disc_rfr_proc r n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n w. 0 < disc_rfr_proc r n w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. 0 < disc_rfr_proc r n w
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. 0 < disc_rfr_proc r n w
[PROOF STEP]
fix w::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n w. 0 < disc_rfr_proc r n w
[PROOF STEP]
show "0 < disc_rfr_proc r n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < disc_rfr_proc r n w
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < disc_rfr_proc r 0 w
 2. \<And>n. 0 < disc_rfr_proc r n w \<Longrightarrow> 0 < disc_rfr_proc r (Suc n) w
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. 0 < disc_rfr_proc r 0 w
 2. \<And>n. 0 < disc_rfr_proc r n w \<Longrightarrow> 0 < disc_rfr_proc r (Suc n) w
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < disc_rfr_proc r 0 w
[PROOF STEP]
using assms  "disc_rfr_proc.simps"
[PROOF STATE]
proof (prove)
using this:
- 1 < r
disc_rfr_proc ?r 0 ?w = 1
disc_rfr_proc ?r (Suc ?n) ?w = (1 + ?r) * disc_rfr_proc ?r ?n ?w

goal (1 subgoal):
 1. 0 < disc_rfr_proc r 0 w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < disc_rfr_proc r 0 w

goal (1 subgoal):
 1. \<And>n. 0 < disc_rfr_proc r n w \<Longrightarrow> 0 < disc_rfr_proc r (Suc n) w
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. 0 < disc_rfr_proc r n w \<Longrightarrow> 0 < disc_rfr_proc r (Suc n) w
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
0 < disc_rfr_proc r n w

goal (1 subgoal):
 1. \<And>n. 0 < disc_rfr_proc r n w \<Longrightarrow> 0 < disc_rfr_proc r (Suc n) w
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 < disc_rfr_proc r n w

goal (1 subgoal):
 1. 0 < disc_rfr_proc r (Suc n) w
[PROOF STEP]
using  assms "disc_rfr_proc.simps"
[PROOF STATE]
proof (prove)
using this:
0 < disc_rfr_proc r n w
- 1 < r
disc_rfr_proc ?r 0 ?w = 1
disc_rfr_proc ?r (Suc ?n) ?w = (1 + ?r) * disc_rfr_proc ?r ?n ?w

goal (1 subgoal):
 1. 0 < disc_rfr_proc r (Suc n) w
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < disc_rfr_proc r (Suc n) w

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 < disc_rfr_proc r n w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_image_reversepath[simp]: "path_image (reversepath g) = path_image g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (reversepath g) = path_image g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_image (reversepath g) = path_image g
[PROOF STEP]
have *: "\<And>g. path_image (reversepath g) \<subseteq> path_image g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>g. path_image (reversepath g) \<subseteq> path_image g
[PROOF STEP]
unfolding path_image_def subset_eq reversepath_def Ball_def image_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>g. \<forall>x. (\<exists>xa\<in>{0..1}. x = g (1 - xa)) \<longrightarrow> (\<exists>xa\<in>{0..1}. x = g xa)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
path_image (reversepath ?g) \<subseteq> path_image ?g

goal (1 subgoal):
 1. path_image (reversepath g) = path_image g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (reversepath g) = path_image g
[PROOF STEP]
using *[of g] *[of "reversepath g"]
[PROOF STATE]
proof (prove)
using this:
path_image (reversepath g) \<subseteq> path_image g
path_image (reversepath (reversepath g)) \<subseteq> path_image (reversepath g)

goal (1 subgoal):
 1. path_image (reversepath g) = path_image g
[PROOF STEP]
unfolding reversepath_reversepath
[PROOF STATE]
proof (prove)
using this:
path_image (reversepath g) \<subseteq> path_image g
path_image g \<subseteq> path_image (reversepath g)

goal (1 subgoal):
 1. path_image (reversepath g) = path_image g
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
path_image (reversepath g) = path_image g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SCSubset[rule_format]: " singleCombinators b \<longrightarrow> set a \<subseteq> set b \<longrightarrow>
                              singleCombinators a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singleCombinators b \<longrightarrow> set a \<subseteq> set b \<longrightarrow> singleCombinators a
[PROOF STEP]
proof (induct a)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. singleCombinators b \<longrightarrow> set [] \<subseteq> set b \<longrightarrow> singleCombinators []
 2. \<And>a1 a2. singleCombinators b \<longrightarrow> set a2 \<subseteq> set b \<longrightarrow> singleCombinators a2 \<Longrightarrow> singleCombinators b \<longrightarrow> set (a1 # a2) \<subseteq> set b \<longrightarrow> singleCombinators (a1 # a2)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. singleCombinators b \<longrightarrow> set [] \<subseteq> set b \<longrightarrow> singleCombinators []
 2. \<And>a1 a2. singleCombinators b \<longrightarrow> set a2 \<subseteq> set b \<longrightarrow> singleCombinators a2 \<Longrightarrow> singleCombinators b \<longrightarrow> set (a1 # a2) \<subseteq> set b \<longrightarrow> singleCombinators (a1 # a2)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singleCombinators b \<longrightarrow> set [] \<subseteq> set b \<longrightarrow> singleCombinators []
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
singleCombinators b \<longrightarrow> set [] \<subseteq> set b \<longrightarrow> singleCombinators []

goal (1 subgoal):
 1. \<And>a1 a2. singleCombinators b \<longrightarrow> set a2 \<subseteq> set b \<longrightarrow> singleCombinators a2 \<Longrightarrow> singleCombinators b \<longrightarrow> set (a1 # a2) \<subseteq> set b \<longrightarrow> singleCombinators (a1 # a2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a1 a2. singleCombinators b \<longrightarrow> set a2 \<subseteq> set b \<longrightarrow> singleCombinators a2 \<Longrightarrow> singleCombinators b \<longrightarrow> set (a1 # a2) \<subseteq> set b \<longrightarrow> singleCombinators (a1 # a2)
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
singleCombinators b \<longrightarrow> set xs \<subseteq> set b \<longrightarrow> singleCombinators xs

goal (1 subgoal):
 1. \<And>a1 a2. singleCombinators b \<longrightarrow> set a2 \<subseteq> set b \<longrightarrow> singleCombinators a2 \<Longrightarrow> singleCombinators b \<longrightarrow> set (a1 # a2) \<subseteq> set b \<longrightarrow> singleCombinators (a1 # a2)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
singleCombinators b \<longrightarrow> set xs \<subseteq> set b \<longrightarrow> singleCombinators xs

goal (1 subgoal):
 1. singleCombinators b \<longrightarrow> set (x # xs) \<subseteq> set b \<longrightarrow> singleCombinators (x # xs)
[PROOF STEP]
by (meson aux0_0 aux0_5 subsetCE)
[PROOF STATE]
proof (state)
this:
singleCombinators b \<longrightarrow> set (x # xs) \<subseteq> set b \<longrightarrow> singleCombinators (x # xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compare_sym:
  "compare\<cdot>x\<cdot>y = (case compare\<cdot>y\<cdot>x of LT \<Rightarrow> GT | EQ \<Rightarrow> EQ | GT \<Rightarrow> LT)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compare\<cdot>x\<cdot>y = (case compare\<cdot>y\<cdot>x of LT \<Rightarrow> GT | EQ \<Rightarrow> EQ | GT \<Rightarrow> LT)
[PROOF STEP]
by (subst oppOrdering_compare [symmetric]) (simp add: oppOrdering_def)


[STATEMENT]
lemma arg_cnj_not_pi:
  assumes "Arg z \<noteq> pi"
  shows "Arg (cnj z) = -Arg z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (cnj z) = - Arg z
[PROOF STEP]
proof(cases "Arg z = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Arg z = 0 \<Longrightarrow> Arg (cnj z) = - Arg z
 2. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
Arg z = 0

goal (2 subgoals):
 1. Arg z = 0 \<Longrightarrow> Arg (cnj z) = - Arg z
 2. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Arg z = 0

goal (1 subgoal):
 1. Arg (cnj z) = - Arg z
[PROOF STEP]
using eq_cnj_iff_real[of z] is_real_arg1[of z]
[PROOF STATE]
proof (prove)
using this:
Arg z = 0
(cnj z = z) = is_real z
Arg z = 0 \<or> Arg z = pi \<Longrightarrow> is_real z

goal (1 subgoal):
 1. Arg (cnj z) = - Arg z
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
Arg (cnj z) = - Arg z

goal (1 subgoal):
 1. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
Arg z \<noteq> 0

goal (1 subgoal):
 1. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
have "Arg (cnj z) = Arg z \<or> Arg(cnj z) = -Arg z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (cnj z) = Arg z \<or> Arg (cnj z) = - Arg z
[PROOF STEP]
using Arg_bounded[of z] Arg_bounded[of "cnj z"]
[PROOF STATE]
proof (prove)
using this:
- pi < Arg z \<and> Arg z \<le> pi
- pi < Arg (cnj z) \<and> Arg (cnj z) \<le> pi

goal (1 subgoal):
 1. Arg (cnj z) = Arg z \<or> Arg (cnj z) = - Arg z
[PROOF STEP]
by (smt (verit, best) arccos_cos arccos_cos2 cnj.sel(1) complex_cnj_zero_iff complex_mod_cnj cos_arg)
[PROOF STATE]
proof (state)
this:
Arg (cnj z) = Arg z \<or> Arg (cnj z) = - Arg z

goal (1 subgoal):
 1. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Arg (cnj z) = Arg z \<or> Arg (cnj z) = - Arg z

goal (1 subgoal):
 1. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
have "Arg (cnj z) \<noteq> Arg z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Arg (cnj z) \<noteq> Arg z
[PROOF STEP]
using sin_0_iff_canon[of "Arg (cnj z)"] Arg_bounded False assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>sin (Arg (cnj z)) = 0; - pi < Arg (cnj z); Arg (cnj z) \<le> pi\<rbrakk> \<Longrightarrow> Arg (cnj z) = 0 \<or> Arg (cnj z) = pi
- pi < Arg ?z \<and> Arg ?z \<le> pi
Arg z \<noteq> 0
Arg z \<noteq> pi

goal (1 subgoal):
 1. Arg (cnj z) \<noteq> Arg z
[PROOF STEP]
by (metis complex_mod_cnj eq_cnj_iff_real is_real_arg2 rcis_cmod_Arg)
[PROOF STATE]
proof (state)
this:
Arg (cnj z) \<noteq> Arg z

goal (1 subgoal):
 1. Arg z \<noteq> 0 \<Longrightarrow> Arg (cnj z) = - Arg z
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Arg (cnj z) = Arg z \<or> Arg (cnj z) = - Arg z
Arg (cnj z) \<noteq> Arg z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Arg (cnj z) = Arg z \<or> Arg (cnj z) = - Arg z
Arg (cnj z) \<noteq> Arg z

goal (1 subgoal):
 1. Arg (cnj z) = - Arg z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Arg (cnj z) = - Arg z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in cring) finsum_remove:
  assumes "\<And>i. i \<in> Y \<Longrightarrow> f i \<in> carrier R"
  assumes "finite Y"
  assumes "i \<in> Y"
  shows "finsum R f Y = f i \<oplus> finsum R f (Y - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f Y = f i \<oplus> finsum R f (Y - {i})
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finsum R f Y = f i \<oplus> finsum R f (Y - {i})
[PROOF STEP]
have "finsum R f (insert i (Y - {i})) = f i \<oplus> finsum R f (Y - {i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finsum R f (insert i (Y - {i})) = f i \<oplus> finsum R f (Y - {i})
[PROOF STEP]
apply(rule finsum_insert)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. finite (Y - {i})
 2. i \<notin> Y - {i}
 3. f \<in> Y - {i} \<rightarrow> carrier R
 4. f i \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i \<in> Y \<Longrightarrow> f ?i \<in> carrier R
finite Y
i \<in> Y

goal (4 subgoals):
 1. finite (Y - {i})
 2. i \<notin> Y - {i}
 3. f \<in> Y - {i} \<rightarrow> carrier R
 4. f i \<in> carrier R
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. i \<notin> Y - {i}
 2. f \<in> Y - {i} \<rightarrow> carrier R
 3. f i \<in> carrier R
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f \<in> Y - {i} \<rightarrow> carrier R
 2. f i \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i \<in> Y \<Longrightarrow> f ?i \<in> carrier R
finite Y
i \<in> Y

goal (2 subgoals):
 1. f \<in> Y - {i} \<rightarrow> carrier R
 2. f i \<in> carrier R
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f i \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i \<in> Y \<Longrightarrow> f ?i \<in> carrier R
finite Y
i \<in> Y

goal (1 subgoal):
 1. f i \<in> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finsum R f (insert i (Y - {i})) = f i \<oplus> finsum R f (Y - {i})

goal (1 subgoal):
 1. finsum R f Y = f i \<oplus> finsum R f (Y - {i})
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finsum R f (insert i (Y - {i})) = f i \<oplus> finsum R f (Y - {i})

goal (1 subgoal):
 1. finsum R f Y = f i \<oplus> finsum R f (Y - {i})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finsum R f (insert i (Y - {i})) = f i \<oplus> finsum R f (Y - {i})
?i \<in> Y \<Longrightarrow> f ?i \<in> carrier R
finite Y
i \<in> Y

goal (1 subgoal):
 1. finsum R f Y = f i \<oplus> finsum R f (Y - {i})
[PROOF STEP]
by (metis insert_Diff)
[PROOF STATE]
proof (state)
this:
finsum R f Y = f i \<oplus> finsum R f (Y - {i})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma orthonormal_basis_exists:
  fixes S :: \<open>'a::chilbert_space set\<close>
  assumes \<open>is_ortho_set S\<close> and \<open>\<And>x. x\<in>S \<Longrightarrow> norm x = 1\<close>
  shows \<open>\<exists>B. B \<supseteq> S \<and> is_onb B\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
from \<open>is_ortho_set S\<close>
[PROOF STATE]
proof (chain)
picking this:
is_ortho_set S
[PROOF STEP]
obtain B where \<open>is_ortho_set B\<close> and \<open>B \<supseteq> S\<close> and \<open>closure (cspan B) = UNIV\<close>
[PROOF STATE]
proof (prove)
using this:
is_ortho_set S

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>is_ortho_set B; S \<subseteq> B; closure (cspan B) = UNIV\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ortho_basis_exists
[PROOF STATE]
proof (prove)
using this:
is_ortho_set S
is_ortho_set ?S \<Longrightarrow> \<exists>B. ?S \<subseteq> B \<and> is_ortho_set B \<and> closure (cspan B) = UNIV

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>is_ortho_set B; S \<subseteq> B; closure (cspan B) = UNIV\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
is_ortho_set B
S \<subseteq> B
closure (cspan B) = UNIV

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
define B' where \<open>B' = (\<lambda>x. x /\<^sub>R norm x) ` B\<close>
[PROOF STATE]
proof (state)
this:
B' = (\<lambda>x. x /\<^sub>R norm x) ` B

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
have \<open>S = (\<lambda>x. x /\<^sub>R norm x) ` S\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = (\<lambda>x. x /\<^sub>R norm x) ` S
[PROOF STEP]
by (simp add: assms(2))
[PROOF STATE]
proof (state)
this:
S = (\<lambda>x. x /\<^sub>R norm x) ` S

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
S = (\<lambda>x. x /\<^sub>R norm x) ` S
[PROOF STEP]
have \<open>B' \<supseteq> S\<close>
[PROOF STATE]
proof (prove)
using this:
S = (\<lambda>x. x /\<^sub>R norm x) ` S

goal (1 subgoal):
 1. S \<subseteq> B'
[PROOF STEP]
using B'_def \<open>S \<subseteq> B\<close>
[PROOF STATE]
proof (prove)
using this:
S = (\<lambda>x. x /\<^sub>R norm x) ` S
B' = (\<lambda>x. x /\<^sub>R norm x) ` B
S \<subseteq> B

goal (1 subgoal):
 1. S \<subseteq> B'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
S \<subseteq> B'

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S \<subseteq> B'

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
have \<open>ccspan B' = top\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ccspan B' = top
[PROOF STEP]
apply (transfer fixing: B')
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (cspan B') = UNIV
[PROOF STEP]
apply (simp add: B'_def scaleR_scaleC)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (cspan ((\<lambda>x. x /\<^sub>C complex_of_real (norm x)) ` B)) = UNIV
[PROOF STEP]
apply (subst complex_vector.span_image_scale')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> B \<Longrightarrow> inverse (complex_of_real (norm x)) \<noteq> 0
 2. closure (cspan B) = UNIV
[PROOF STEP]
using \<open>is_ortho_set B\<close> \<open>closure (cspan B) = UNIV\<close> is_ortho_set_def
[PROOF STATE]
proof (prove)
using this:
is_ortho_set B
closure (cspan B) = UNIV
is_ortho_set ?S = ((\<forall>x\<in>?S. \<forall>y\<in>?S. x \<noteq> y \<longrightarrow> is_orthogonal x y) \<and> (0::?'a) \<notin> ?S)

goal (2 subgoals):
 1. \<And>x. x \<in> B \<Longrightarrow> inverse (complex_of_real (norm x)) \<noteq> 0
 2. closure (cspan B) = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ccspan B' = top

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ccspan B' = top

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
have \<open>is_ortho_set B'\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_ortho_set B'
[PROOF STEP]
using \<open>is_ortho_set B\<close>
[PROOF STATE]
proof (prove)
using this:
is_ortho_set B

goal (1 subgoal):
 1. is_ortho_set B'
[PROOF STEP]
by (auto simp: B'_def is_ortho_set_def)
[PROOF STATE]
proof (state)
this:
is_ortho_set B'

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
is_ortho_set B'

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
have \<open>\<forall>b\<in>B'. norm b = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b\<in>B'. norm b = 1
[PROOF STEP]
using \<open>is_ortho_set B\<close>
[PROOF STATE]
proof (prove)
using this:
is_ortho_set B

goal (1 subgoal):
 1. \<forall>b\<in>B'. norm b = 1
[PROOF STEP]
apply (auto simp: B'_def is_ortho_set_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b. \<lbrakk>b \<in> B; \<forall>x\<in>B. \<forall>y\<in>B. x \<noteq> y \<longrightarrow> is_orthogonal x y; (0::'a) \<notin> B\<rbrakk> \<Longrightarrow> inverse (norm b) * norm b = 1
[PROOF STEP]
by (metis field_class.field_inverse norm_eq_zero)
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>B'. norm b = 1

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> B'
ccspan B' = top
is_ortho_set B'
\<forall>b\<in>B'. norm b = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> B'
ccspan B' = top
is_ortho_set B'
\<forall>b\<in>B'. norm b = 1

goal (1 subgoal):
 1. \<exists>B. S \<subseteq> B \<and> is_onb B
[PROOF STEP]
by (auto simp: is_onb_def)
[PROOF STATE]
proof (state)
this:
\<exists>B. S \<subseteq> B \<and> is_onb B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in module) in_own_span:
  fixes S
  assumes  inC:"S\<subseteq>carrier M"
  shows "S \<subseteq> span S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> span S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<subseteq> span S
[PROOF STEP]
from inC
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> carrier M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> carrier M

goal (1 subgoal):
 1. S \<subseteq> span S
[PROOF STEP]
apply (unfold span_def, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>S \<subseteq> carrier M; x \<in> S\<rbrakk> \<Longrightarrow> \<exists>a A. x = lincomb a A \<and> finite A \<and> A \<subseteq> S \<and> a \<in> A \<rightarrow> carrier R
[PROOF STEP]
apply (rename_tac v)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>S \<subseteq> carrier M; v \<in> S\<rbrakk> \<Longrightarrow> \<exists>a A. v = lincomb a A \<and> finite A \<and> A \<subseteq> S \<and> a \<in> A \<rightarrow> carrier R
[PROOF STEP]
apply (rule_tac x="(\<lambda> w. if (w=v) then \<one>\<^bsub>R\<^esub> else \<zero>\<^bsub>R\<^esub>)" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>S \<subseteq> carrier M; v \<in> S\<rbrakk> \<Longrightarrow> \<exists>A. v = lincomb (\<lambda>w. if w = v then \<one> else \<zero>) A \<and> finite A \<and> A \<subseteq> S \<and> (\<lambda>w. if w = v then \<one> else \<zero>) \<in> A \<rightarrow> carrier R
[PROOF STEP]
apply (rule_tac x="{v}" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>S \<subseteq> carrier M; v \<in> S\<rbrakk> \<Longrightarrow> v = lincomb (\<lambda>w. if w = v then \<one> else \<zero>) {v} \<and> finite {v} \<and> {v} \<subseteq> S \<and> (\<lambda>w. if w = v then \<one> else \<zero>) \<in> {v} \<rightarrow> carrier R
[PROOF STEP]
apply (unfold lincomb_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<lbrakk>S \<subseteq> carrier M; v \<in> S\<rbrakk> \<Longrightarrow> v = (\<Oplus>\<^bsub>M\<^esub>va\<in>{v}. (if va = v then \<one> else \<zero>) \<odot>\<^bsub>M\<^esub> va) \<and> finite {v} \<and> {v} \<subseteq> S \<and> (\<lambda>w. if w = v then \<one> else \<zero>) \<in> {v} \<rightarrow> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> span S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eucl_truncate_down_mono:
  fixes x::"'a::executable_euclidean_space"
  shows "x \<le> y \<Longrightarrow> eucl_truncate_down p x \<le> eucl_truncate_down p y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> eucl_truncate_down p x \<le> eucl_truncate_down p y
[PROOF STEP]
by (auto simp: eucl_le[where 'a='a] intro!: truncate_down_mono)


[STATEMENT]
lemma equal_ccsubspace_code[code]:
  \<comment> \<open>Code equation for equality test. By checking mutual inclusion
      (for which we have code by the preceding code equation).\<close>
  "HOL.equal (A::_ ccsubspace) B = (A\<le>B \<and> B\<le>A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. equal_class.equal A B = (A \<le> B \<and> B \<le> A)
[PROOF STEP]
unfolding equal_ccsubspace_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = B) = (A \<le> B \<and> B \<le> A)
[PROOF STEP]
by auto


[STATEMENT]
lemma diff_fun_space_add: "f + g \<in> diff_fun_space"
  if "f \<in> diff_fun_space" "g \<in> diff_fun_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f + g \<in> diff_fun_space
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
f \<in> diff_fun_space
g \<in> diff_fun_space

goal (1 subgoal):
 1. f + g \<in> diff_fun_space
[PROOF STEP]
by (auto simp: diff_fun_space_def intro!: diff_fun_add)


[STATEMENT]
lemma bl_to_bin_append: "bl_to_bin (bs @ cs) = bl_to_bin_aux cs (bl_to_bin bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bl_to_bin (bs @ cs) = bl_to_bin_aux cs (bl_to_bin bs)
[PROOF STEP]
unfolding bl_to_bin_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bl_to_bin_aux (bs @ cs) 0 = bl_to_bin_aux cs (bl_to_bin_aux bs 0)
[PROOF STEP]
by (rule bl_to_bin_aux_append)


[STATEMENT]
lemma primitive_imp_unit_iff:
  fixes p :: "'a :: {comm_semiring_1,semiring_no_zero_divisors} poly"
  assumes pr: "primitive p"
  shows "p dvd 1 \<longleftrightarrow> degree p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p dvd 1) = (degree p = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p dvd 1 \<Longrightarrow> degree p = 0
 2. degree p = 0 \<Longrightarrow> p dvd 1
[PROOF STEP]
assume "degree p = 0"
[PROOF STATE]
proof (state)
this:
degree p = 0

goal (2 subgoals):
 1. p dvd 1 \<Longrightarrow> degree p = 0
 2. degree p = 0 \<Longrightarrow> p dvd 1
[PROOF STEP]
from degree0_coeffs[OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. p = [:a:]
[PROOF STEP]
obtain p0 where p: "p = [:p0:]"
[PROOF STATE]
proof (prove)
using this:
\<exists>a. p = [:a:]

goal (1 subgoal):
 1. (\<And>p0. p = [:p0:] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = [:p0:]

goal (2 subgoals):
 1. p dvd 1 \<Longrightarrow> degree p = 0
 2. degree p = 0 \<Longrightarrow> p dvd 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = [:p0:]
[PROOF STEP]
have "\<forall>c \<in> set (coeffs p). p0 dvd c"
[PROOF STATE]
proof (prove)
using this:
p = [:p0:]

goal (1 subgoal):
 1. \<forall>c\<in>set (coeffs p). p0 dvd c
[PROOF STEP]
by (simp add: cCons_def)
[PROOF STATE]
proof (state)
this:
\<forall>c\<in>set (coeffs p). p0 dvd c

goal (2 subgoals):
 1. p dvd 1 \<Longrightarrow> degree p = 0
 2. degree p = 0 \<Longrightarrow> p dvd 1
[PROOF STEP]
with pr
[PROOF STATE]
proof (chain)
picking this:
primitive p
\<forall>c\<in>set (coeffs p). p0 dvd c
[PROOF STEP]
have "p0 dvd 1"
[PROOF STATE]
proof (prove)
using this:
primitive p
\<forall>c\<in>set (coeffs p). p0 dvd c

goal (1 subgoal):
 1. p0 dvd (1::'a)
[PROOF STEP]
by (auto dest: primitiveD)
[PROOF STATE]
proof (state)
this:
p0 dvd (1::'a)

goal (2 subgoals):
 1. p dvd 1 \<Longrightarrow> degree p = 0
 2. degree p = 0 \<Longrightarrow> p dvd 1
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
p = [:p0:]
p0 dvd (1::'a)
[PROOF STEP]
show "p dvd 1"
[PROOF STATE]
proof (prove)
using this:
p = [:p0:]
p0 dvd (1::'a)

goal (1 subgoal):
 1. p dvd 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p dvd 1

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

goal (1 subgoal):
 1. p dvd 1 \<Longrightarrow> degree p = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p dvd 1
[PROOF STEP]
show "degree p = 0"
[PROOF STATE]
proof (prove)
using this:
p dvd 1

goal (1 subgoal):
 1. degree p = 0
[PROOF STEP]
by (auto simp: poly_dvd_1)
[PROOF STATE]
proof (state)
this:
degree p = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma conjugate_eq: "residuated f \<Longrightarrow> conjugate f y = \<Sqinter>{x. y \<le> -f(-x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
assume assm: "residuated f"
[PROOF STATE]
proof (state)
this:
residuated f

goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
obtain g where g_def: "g = conjugate f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. g = conjugate f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
g = conjugate f

goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
have "g y = \<Sqinter>{x. x \<ge> g y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g y = \<Sqinter> {x. g y \<le> x}
[PROOF STEP]
by (auto intro!: order.antisym Inf_lower Inf_greatest)
[PROOF STATE]
proof (state)
this:
g y = \<Sqinter> {x. g y \<le> x}

goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
g y = \<Sqinter> {x. g y \<le> x}

goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
have "... = \<Sqinter>{x. -x \<sqinter> g y = \<bottom>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> {x. g y \<le> x} = \<Sqinter> {x. - x \<sqinter> g y = \<bottom>}
[PROOF STEP]
by (simp add: inf_bot_iff_le)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {x. g y \<le> x} = \<Sqinter> {x. - x \<sqinter> g y = \<bottom>}

goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sqinter> {x. g y \<le> x} = \<Sqinter> {x. - x \<sqinter> g y = \<bottom>}

goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
have "... = \<Sqinter>{x. f(-x) \<sqinter> y = \<bottom>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> {x. - x \<sqinter> g y = \<bottom>} = \<Sqinter> {x. f (- x) \<sqinter> y = \<bottom>}
[PROOF STEP]
by (metis conjugate_iff_def assm g_def)
[PROOF STATE]
proof (state)
this:
\<Sqinter> {x. - x \<sqinter> g y = \<bottom>} = \<Sqinter> {x. f (- x) \<sqinter> y = \<bottom>}

goal (1 subgoal):
 1. residuated f \<Longrightarrow> conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
g y = \<Sqinter> {x. f (- x) \<sqinter> y = \<bottom>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
g y = \<Sqinter> {x. f (- x) \<sqinter> y = \<bottom>}

goal (1 subgoal):
 1. conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}
[PROOF STEP]
by (simp add: g_def le_iff_inf_bot inf_commute)
[PROOF STATE]
proof (state)
this:
conjugate f y = \<Sqinter> {x. y \<le> - f (- x)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma knights_path_max1: "knights_path (board n m) ps \<Longrightarrow> max1 ps = int n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. knights_path (board n m) ps \<Longrightarrow> max1 ps = int n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. knights_path (board n m) ps \<Longrightarrow> max1 ps = int n
[PROOF STEP]
assume assms: "knights_path (board n m) ps"
[PROOF STATE]
proof (state)
this:
knights_path (board n m) ps

goal (1 subgoal):
 1. knights_path (board n m) ps \<Longrightarrow> max1 ps = int n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
knights_path (board n m) ps
[PROOF STEP]
have "min n m \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
knights_path (board n m) ps

goal (1 subgoal):
 1. 1 \<le> min n m
[PROOF STEP]
using knights_path_board_m_n_geq_1
[PROOF STATE]
proof (prove)
using this:
knights_path (board n m) ps
knights_path (board ?n ?m) ?ps \<Longrightarrow> 1 \<le> min ?n ?m

goal (1 subgoal):
 1. 1 \<le> min n m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 \<le> min n m

goal (1 subgoal):
 1. knights_path (board n m) ps \<Longrightarrow> max1 ps = int n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> min n m
[PROOF STEP]
have "(int n,1) \<in> board n m" and leq_n: "\<forall>(i,j) \<in> board n m. i \<le> int n"
[PROOF STATE]
proof (prove)
using this:
1 \<le> min n m

goal (1 subgoal):
 1. (int n, 1) \<in> board n m &&& \<forall>(i, j)\<in>board n m. i \<le> int n
[PROOF STEP]
unfolding board_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> min n m

goal (1 subgoal):
 1. (int n, 1) \<in> {(i, j) |i j. 1 \<le> i \<and> i \<le> int n \<and> 1 \<le> j \<and> j \<le> int m} &&& \<forall>(i, j)\<in>{(i, j) |i j. 1 \<le> i \<and> i \<le> int n \<and> 1 \<le> j \<and> j \<le> int m}. i \<le> int n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(int n, 1) \<in> board n m
\<forall>(i, j)\<in>board n m. i \<le> int n

goal (1 subgoal):
 1. knights_path (board n m) ps \<Longrightarrow> max1 ps = int n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(int n, 1) \<in> board n m
\<forall>(i, j)\<in>board n m. i \<le> int n
[PROOF STEP]
have finite: "finite ((fst) ` board n m)" and
          non_empty: "(fst) ` board n m \<noteq> {}" and
          mem_1: "int n \<in> (fst) ` board n m"
[PROOF STATE]
proof (prove)
using this:
(int n, 1) \<in> board n m
\<forall>(i, j)\<in>board n m. i \<le> int n

goal (1 subgoal):
 1. finite (fst ` board n m) &&& fst ` board n m \<noteq> {} &&& int n \<in> fst ` board n m
[PROOF STEP]
using board_finite
[PROOF STATE]
proof (prove)
using this:
(int n, 1) \<in> board n m
\<forall>(i, j)\<in>board n m. i \<le> int n
finite (board ?n ?m)

goal (1 subgoal):
 1. finite (fst ` board n m) &&& fst ` board n m \<noteq> {} &&& int n \<in> fst ` board n m
[PROOF STEP]
by auto (metis fstI image_eqI)
[PROOF STATE]
proof (state)
this:
finite (fst ` board n m)
fst ` board n m \<noteq> {}
int n \<in> fst ` board n m

goal (1 subgoal):
 1. knights_path (board n m) ps \<Longrightarrow> max1 ps = int n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (fst ` board n m)
fst ` board n m \<noteq> {}
int n \<in> fst ` board n m
[PROOF STEP]
have "Max ((fst) ` board n m) = int n"
[PROOF STATE]
proof (prove)
using this:
finite (fst ` board n m)
fst ` board n m \<noteq> {}
int n \<in> fst ` board n m

goal (1 subgoal):
 1. Max (fst ` board n m) = int n
[PROOF STEP]
using leq_n
[PROOF STATE]
proof (prove)
using this:
finite (fst ` board n m)
fst ` board n m \<noteq> {}
int n \<in> fst ` board n m
\<forall>(i, j)\<in>board n m. i \<le> int n

goal (1 subgoal):
 1. Max (fst ` board n m) = int n
[PROOF STEP]
by (auto simp: Max_eq_iff)
[PROOF STATE]
proof (state)
this:
Max (fst ` board n m) = int n

goal (1 subgoal):
 1. knights_path (board n m) ps \<Longrightarrow> max1 ps = int n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Max (fst ` board n m) = int n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Max (fst ` board n m) = int n

goal (1 subgoal):
 1. max1 ps = int n
[PROOF STEP]
using assms knights_path_set_eq
[PROOF STATE]
proof (prove)
using this:
Max (fst ` board n m) = int n
knights_path (board n m) ps
knights_path ?b ?ps \<Longrightarrow> set ?ps = ?b

goal (1 subgoal):
 1. max1 ps = int n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
max1 ps = int n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lm074:
  "\<Union> (finestpart ` XX) \<subseteq> finestpart (\<Union> XX)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (finestpart ` XX) \<subseteq> finestpart (\<Union> XX)
[PROOF STEP]
using finestpart_def lm073
[PROOF STATE]
proof (prove)
using this:
finestpart ?X = (\<lambda>x. {x}) ` ?X
?x \<in> ?X \<Longrightarrow> finestpart ?x \<subseteq> finestpart (\<Union> ?X)

goal (1 subgoal):
 1. \<Union> (finestpart ` XX) \<subseteq> finestpart (\<Union> XX)
[PROOF STEP]
by force


[STATEMENT]
lemma atoms_finite:
  assumes "finite Xs"
  shows "finite ((atoms_of (gen_boolean_algebra S Xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
have 0: "gen_boolean_algebra S Xs =gen_boolean_algebra S ((\<inter>) S ` Xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S Xs = gen_boolean_algebra S ((\<inter>) S ` Xs)
[PROOF STEP]
using gen_boolean_algebra_restrict_generators
[PROOF STATE]
proof (prove)
using this:
gen_boolean_algebra ?S ?Xs = gen_boolean_algebra ?S ((\<inter>) ?S ` ?Xs)

goal (1 subgoal):
 1. gen_boolean_algebra S Xs = gen_boolean_algebra S ((\<inter>) S ` Xs)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
gen_boolean_algebra S Xs = gen_boolean_algebra S ((\<inter>) S ` Xs)

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
have 1: "gen_boolean_algebra S Xs = gen_boolean_algebra S (insert S ((\<inter>) S ` Xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S Xs = gen_boolean_algebra S (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
unfolding 0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_boolean_algebra S ((\<inter>) S ` Xs) = gen_boolean_algebra S (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
by(rule add_generators, rule gen_boolean_algebra.universe)
[PROOF STATE]
proof (state)
this:
gen_boolean_algebra S Xs = gen_boolean_algebra S (insert S ((\<inter>) S ` Xs))

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
obtain Ys where Ys_def: "Ys = (insert S ((\<inter>) S ` Xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Ys. Ys = insert S ((\<inter>) S ` Xs) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Ys = insert S ((\<inter>) S ` Xs)

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
have Ys_finite: "finite Ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite Ys
[PROOF STEP]
unfolding Ys_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite Xs

goal (1 subgoal):
 1. finite (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite Ys

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
have 2: "\<Union> Ys = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> Ys = S
[PROOF STEP]
unfolding Ys_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (insert S ((\<inter>) S ` Xs)) = S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<Union> Ys = S

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
have 3: "atoms_of Ys = atoms_of (gen_boolean_algebra S Xs) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atoms_of Ys = atoms_of (gen_boolean_algebra S Xs)
[PROOF STEP]
unfolding Ys_def 1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atoms_of (insert S ((\<inter>) S ` Xs)) = atoms_of (gen_boolean_algebra S (insert S ((\<inter>) S ` Xs)))
[PROOF STEP]
apply(rule atoms_of_sets_eq_atoms_of_algebra)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (insert S ((\<inter>) S ` Xs))
 2. S = \<Union> (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
using Ys_finite
[PROOF STATE]
proof (prove)
using this:
finite Ys

goal (2 subgoals):
 1. finite (insert S ((\<inter>) S ` Xs))
 2. S = \<Union> (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
unfolding Ys_def
[PROOF STATE]
proof (prove)
using this:
finite (insert S ((\<inter>) S ` Xs))

goal (2 subgoals):
 1. finite (insert S ((\<inter>) S ` Xs))
 2. S = \<Union> (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S = \<Union> (insert S ((\<inter>) S ` Xs))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
atoms_of Ys = atoms_of (gen_boolean_algebra S Xs)

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
have 4: "finite (atoms_of Ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (atoms_of Ys)
[PROOF STEP]
by(rule finite_set_imp_finite_atoms, rule Ys_finite)
[PROOF STATE]
proof (state)
this:
finite (atoms_of Ys)

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
using 4
[PROOF STATE]
proof (prove)
using this:
finite (atoms_of Ys)

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
unfolding 3
[PROOF STATE]
proof (prove)
using this:
finite (atoms_of (gen_boolean_algebra S Xs))

goal (1 subgoal):
 1. finite (atoms_of (gen_boolean_algebra S Xs))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (atoms_of (gen_boolean_algebra S Xs))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_arcosh [simp]:
  fixes x :: real
  assumes "x \<ge> 1"
  shows "cosh (arcosh x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
1 \<le> x
[PROOF STEP]
have  **: "x + sqrt(x\<^sup>2 - 1) \<ge> 1"
[PROOF STATE]
proof (prove)
using this:
1 \<le> x

goal (1 subgoal):
 1. 1 \<le> x + sqrt (x\<^sup>2 - 1)
[PROOF STEP]
by (smt one_le_power real_sqrt_ge_zero)
[PROOF STATE]
proof (state)
this:
1 \<le> x + sqrt (x\<^sup>2 - 1)

goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
hence *: "x + sqrt(x\<^sup>2 - 1) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
1 \<le> x + sqrt (x\<^sup>2 - 1)

goal (1 subgoal):
 1. x + sqrt (x\<^sup>2 - 1) \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x + sqrt (x\<^sup>2 - 1) \<noteq> 0

goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x + sqrt (x\<^sup>2 - 1) \<noteq> 0

goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
have "sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x" (is "?lhs = x")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
[PROOF STEP]
have "?lhs = (x*sqrt(x\<^sup>2 - 1) + x\<^sup>2) / (x + sqrt(x\<^sup>2 - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = (x * sqrt (x\<^sup>2 - 1) + x\<^sup>2) / (x + sqrt (x\<^sup>2 - 1))
[PROOF STEP]
using * \<open>x \<ge> 1\<close>
[PROOF STATE]
proof (prove)
using this:
x + sqrt (x\<^sup>2 - 1) \<noteq> 0
1 \<le> x

goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = (x * sqrt (x\<^sup>2 - 1) + x\<^sup>2) / (x + sqrt (x\<^sup>2 - 1))
[PROOF STEP]
by (subst add_divide_eq_iff, simp, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = (x * sqrt (x\<^sup>2 - 1) + x\<^sup>2) / (x + sqrt (x\<^sup>2 - 1))

goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = (x * sqrt (x\<^sup>2 - 1) + x\<^sup>2) / (x + sqrt (x\<^sup>2 - 1))

goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
[PROOF STEP]
have "... = x * (sqrt(x\<^sup>2 - 1) + x) / (x + sqrt(x\<^sup>2 - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * sqrt (x\<^sup>2 - 1) + x\<^sup>2) / (x + sqrt (x\<^sup>2 - 1)) = x * (sqrt (x\<^sup>2 - 1) + x) / (x + sqrt (x\<^sup>2 - 1))
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(x * sqrt (x\<^sup>2 - 1) + x\<^sup>2) / (x + sqrt (x\<^sup>2 - 1)) = x * (sqrt (x\<^sup>2 - 1) + x) / (x + sqrt (x\<^sup>2 - 1))

goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x * (sqrt (x\<^sup>2 - 1) + x) / (x + sqrt (x\<^sup>2 - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x * (sqrt (x\<^sup>2 - 1) + x) / (x + sqrt (x\<^sup>2 - 1))

goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
[PROOF STEP]
using nonzero_mult_div_cancel_right[OF *, of x]
[PROOF STATE]
proof (prove)
using this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x * (sqrt (x\<^sup>2 - 1) + x) / (x + sqrt (x\<^sup>2 - 1))
x * (x + sqrt (x\<^sup>2 - 1)) / (x + sqrt (x\<^sup>2 - 1)) = x

goal (1 subgoal):
 1. sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x

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

goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x

goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
using arcosh_real_def[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
arcosh x = ln (x + sqrt (x\<^sup>2 - 1))

goal (1 subgoal):
 1. cosh (arcosh x) = x
[PROOF STEP]
unfolding cosh_def
[PROOF STATE]
proof (prove)
using this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
arcosh x = ln (x + sqrt (x\<^sup>2 - 1))

goal (1 subgoal):
 1. (exp (arcosh x) + exp (- arcosh x)) /\<^sub>R 2 = x
[PROOF STEP]
using ln_div[of 1, symmetric] **
[PROOF STATE]
proof (prove)
using this:
sqrt (x\<^sup>2 - 1) + 1 / (x + sqrt (x\<^sup>2 - 1)) = x
arcosh x = ln (x + sqrt (x\<^sup>2 - 1))
\<lbrakk>0 < 1; 0 < ?y\<rbrakk> \<Longrightarrow> ln 1 - ln ?y = ln (1 / ?y)
1 \<le> x + sqrt (x\<^sup>2 - 1)

goal (1 subgoal):
 1. (exp (arcosh x) + exp (- arcosh x)) /\<^sub>R 2 = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cosh (arcosh x) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cis_minus_one [simp]:
  assumes "sin \<phi> = 0" and "cos \<phi> = -1"
  shows "cis \<phi> = -1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis \<phi> = - 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sin \<phi> = 0
cos \<phi> = - 1

goal (1 subgoal):
 1. cis \<phi> = - 1
[PROOF STEP]
by (auto simp add: cis.ctr Complex_eq_neg_1)


[STATEMENT]
lemma open_segment_separate_right:
  fixes u v x a b::'a
  assumes u:"u \<in> {a <--< b}"
  assumes v:"v \<in> {a <--< u}"
  assumes x: "dist x u < dist u v" "x \<in> {a <--< b}"
  shows "x \<in> {v <--< b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
have "v \<noteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<noteq> x
[PROOF STEP]
by (smt dist_commute x(1))
[PROOF STATE]
proof (state)
this:
v \<noteq> x

goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
v \<noteq> x

goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
have "x \<notin> {a<--<v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> {a<--<v}
[PROOF STEP]
by (smt dist_commute dist_in_open_segment open_segment_commute open_segment_subsegment v x(1))
[PROOF STATE]
proof (state)
this:
x \<notin> {a<--<v}

goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<notin> {a<--<v}

goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
have "v \<in> {a<--<b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> {a<--<b}
[PROOF STEP]
using v
[PROOF STATE]
proof (prove)
using this:
v \<in> {a<--<u}

goal (1 subgoal):
 1. v \<in> {a<--<b}
[PROOF STEP]
by (metis ends_in_segment(1) segment_open_subset_closed subset_eq subset_segment(4) u)
[PROOF STATE]
proof (state)
this:
v \<in> {a<--<b}

goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
v \<noteq> x
x \<notin> {a<--<v}
v \<in> {a<--<b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
v \<noteq> x
x \<notin> {a<--<v}
v \<in> {a<--<b}

goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
using open_segment_trichotomy[OF _ x(2)]
[PROOF STATE]
proof (prove)
using this:
v \<noteq> x
x \<notin> {a<--<v}
v \<in> {a<--<b}
?x \<in> {a<--<b} \<Longrightarrow> ?x = x \<or> x \<in> {?x<--<b} \<or> x \<in> {a<--<?x}

goal (1 subgoal):
 1. x \<in> {v<--<b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> {v<--<b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_deriv_fds_ln [simp]: "fds_deriv (fds_ln l f) = fds_deriv f / f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv (fds_ln l f) = fds_deriv f / f
[PROOF STEP]
unfolding fds_ln_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_deriv (fds_integral l (fds_deriv f / f)) = fds_deriv f / f
[PROOF STEP]
by (subst fds_deriv_fds_integral) (simp_all add: divide_fds_def)