[STATEMENT]
lemma card_of_Fpow_cong[simp]:
assumes "|A| =o |B|"
shows "|Fpow A| =o |Fpow B|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |Fpow A| =o |Fpow B|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |Fpow A| =o |Fpow B|
[PROOF STEP]
obtain f where "bij_betw f A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. bij_betw f A B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms card_of_ordIso[of A B]
[PROOF STATE]
proof (prove)
using this:
|A| =o |B|
(\<exists>f. bij_betw f A B) = (|A| =o |B|)

goal (1 subgoal):
 1. (\<And>f. bij_betw f A B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij_betw f A B

goal (1 subgoal):
 1. |Fpow A| =o |Fpow B|
[PROOF STEP]
hence "bij_betw (image f) (Fpow A) (Fpow B)"
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. bij_betw ((`) f) (Fpow A) (Fpow B)
[PROOF STEP]
by (auto simp add: bij_betw_image_Fpow)
[PROOF STATE]
proof (state)
this:
bij_betw ((`) f) (Fpow A) (Fpow B)

goal (1 subgoal):
 1. |Fpow A| =o |Fpow B|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw ((`) f) (Fpow A) (Fpow B)

goal (1 subgoal):
 1. |Fpow A| =o |Fpow B|
[PROOF STEP]
using card_of_ordIso[of "Fpow A"]
[PROOF STATE]
proof (prove)
using this:
bij_betw ((`) f) (Fpow A) (Fpow B)
(\<exists>f. bij_betw f (Fpow A) ?B) = (|Fpow A| =o |?B|)

goal (1 subgoal):
 1. |Fpow A| =o |Fpow B|
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
|Fpow A| =o |Fpow B|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma numeral_eq_ereal [simp]: "numeral w = ereal (numeral w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral w = ereal (numeral w)
[PROOF STEP]
proof (induct w rule: num_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Numeral1 = ereal Numeral1
 2. \<And>x. numeral x = ereal (numeral x) \<Longrightarrow> numeral (Num.inc x) = ereal (numeral (Num.inc x))
[PROOF STEP]
case One
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. Numeral1 = ereal Numeral1
 2. \<And>x. numeral x = ereal (numeral x) \<Longrightarrow> numeral (Num.inc x) = ereal (numeral (Num.inc x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Numeral1 = ereal Numeral1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Numeral1 = ereal Numeral1

goal (1 subgoal):
 1. \<And>x. numeral x = ereal (numeral x) \<Longrightarrow> numeral (Num.inc x) = ereal (numeral (Num.inc x))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. numeral x = ereal (numeral x) \<Longrightarrow> numeral (Num.inc x) = ereal (numeral (Num.inc x))
[PROOF STEP]
case (inc x)
[PROOF STATE]
proof (state)
this:
numeral x = ereal (numeral x)

goal (1 subgoal):
 1. \<And>x. numeral x = ereal (numeral x) \<Longrightarrow> numeral (Num.inc x) = ereal (numeral (Num.inc x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
numeral x = ereal (numeral x)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
numeral x = ereal (numeral x)

goal (1 subgoal):
 1. numeral (Num.inc x) = ereal (numeral (Num.inc x))
[PROOF STEP]
by (simp add: inc numeral_inc)
[PROOF STATE]
proof (state)
this:
numeral (Num.inc x) = ereal (numeral (Num.inc x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma index_of_const_main: "nat_to_pr (index_of_const n) = (\<lambda> x. n)" (is "?P n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_pr (index_of_const n) = (\<lambda>x. n)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. nat_to_pr (index_of_const 0) = (\<lambda>x. 0)
 2. \<And>n. nat_to_pr (index_of_const n) = (\<lambda>x. n) \<Longrightarrow> nat_to_pr (index_of_const (Suc n)) = (\<lambda>x. Suc n)
[PROOF STEP]
show "?P 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_pr (index_of_const 0) = (\<lambda>x. 0)
[PROOF STEP]
by (simp add: index_of_const_at_0 nat_to_pr_at_0)
[PROOF STATE]
proof (state)
this:
nat_to_pr (index_of_const 0) = (\<lambda>x. 0)

goal (1 subgoal):
 1. \<And>n. nat_to_pr (index_of_const n) = (\<lambda>x. n) \<Longrightarrow> nat_to_pr (index_of_const (Suc n)) = (\<lambda>x. Suc n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. nat_to_pr (index_of_const n) = (\<lambda>x. n) \<Longrightarrow> nat_to_pr (index_of_const (Suc n)) = (\<lambda>x. Suc n)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. nat_to_pr (index_of_const n) = (\<lambda>x. n) \<Longrightarrow> nat_to_pr (index_of_const (Suc n)) = (\<lambda>x. Suc n)
[PROOF STEP]
assume "?P n"
[PROOF STATE]
proof (state)
this:
nat_to_pr (index_of_const n) = (\<lambda>x. n)

goal (1 subgoal):
 1. \<And>n. nat_to_pr (index_of_const n) = (\<lambda>x. n) \<Longrightarrow> nat_to_pr (index_of_const (Suc n)) = (\<lambda>x. Suc n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nat_to_pr (index_of_const n) = (\<lambda>x. n)
[PROOF STEP]
show "?P (Suc n)"
[PROOF STATE]
proof (prove)
using this:
nat_to_pr (index_of_const n) = (\<lambda>x. n)

goal (1 subgoal):
 1. nat_to_pr (index_of_const (Suc n)) = (\<lambda>x. Suc n)
[PROOF STEP]
by ((simp add: index_of_const_at_suc nat_to_sch_at_2 nat_to_pr_def loc_srj_3_1))
[PROOF STATE]
proof (state)
this:
nat_to_pr (index_of_const (Suc n)) = (\<lambda>x. Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma evenperm_inv:
  assumes "permutation p"
  shows "evenperm (inv p) = evenperm p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evenperm (inv p) = evenperm p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. evenperm (inv p) = evenperm p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
permutation p
[PROOF STEP]
obtain n where n: "swapidseq n p"
[PROOF STATE]
proof (prove)
using this:
permutation p

goal (1 subgoal):
 1. (\<And>n. swapidseq n p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding permutation_def
[PROOF STATE]
proof (prove)
using this:
\<exists>n. swapidseq n p

goal (1 subgoal):
 1. (\<And>n. swapidseq n p \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
swapidseq n p

goal (1 subgoal):
 1. evenperm (inv p) = evenperm p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evenperm (inv p) = evenperm p
[PROOF STEP]
by (rule evenperm_unique[OF swapidseq_inverse[OF n] evenperm_unique[OF n refl, symmetric]])
[PROOF STATE]
proof (state)
this:
evenperm (inv p) = evenperm p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diag_idx_to_el_less_inj:
  assumes "i < dist_el_card B"
and "j < dist_el_card B"
  and "diag_idx_to_el B i = diag_idx_to_el B j"
shows "i = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i = j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i = j
[PROOF STEP]
have "i \<in> {..< dist_el_card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> {..<dist_el_card B}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dist_el_card B
j < dist_el_card B
diag_idx_to_el B i = diag_idx_to_el B j

goal (1 subgoal):
 1. i \<in> {..<dist_el_card B}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i \<in> {..<dist_el_card B}

goal (1 subgoal):
 1. i = j
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i \<in> {..<dist_el_card B}

goal (1 subgoal):
 1. i = j
[PROOF STEP]
have "j\<in> {..< dist_el_card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<in> {..<dist_el_card B}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dist_el_card B
j < dist_el_card B
diag_idx_to_el B i = diag_idx_to_el B j

goal (1 subgoal):
 1. j \<in> {..<dist_el_card B}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
j \<in> {..<dist_el_card B}

goal (1 subgoal):
 1. i = j
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
j \<in> {..<dist_el_card B}

goal (1 subgoal):
 1. i = j
[PROOF STEP]
have "inj_on (diag_idx_to_el B) {..<dist_el_card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (diag_idx_to_el B) {..<dist_el_card B}
[PROOF STEP]
using diag_idx_to_el_bij[of B]
[PROOF STATE]
proof (prove)
using this:
bij_betw (diag_idx_to_el B) {..<dist_el_card B} (diag_elems B)

goal (1 subgoal):
 1. inj_on (diag_idx_to_el B) {..<dist_el_card B}
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
using this:
inj_on (diag_idx_to_el B) {..<dist_el_card B} \<and> diag_idx_to_el B ` {..<dist_el_card B} = diag_elems B

goal (1 subgoal):
 1. inj_on (diag_idx_to_el B) {..<dist_el_card B}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj_on (diag_idx_to_el B) {..<dist_el_card B}

goal (1 subgoal):
 1. i = j
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
i \<in> {..<dist_el_card B}
j \<in> {..<dist_el_card B}
inj_on (diag_idx_to_el B) {..<dist_el_card B}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<in> {..<dist_el_card B}
j \<in> {..<dist_el_card B}
inj_on (diag_idx_to_el B) {..<dist_el_card B}

goal (1 subgoal):
 1. i = j
[PROOF STEP]
by (meson assms(3) inj_on_contraD)
[PROOF STATE]
proof (state)
this:
i = j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_of_poly_as_vec_of_list:
  assumes "f \<noteq> 0"
  shows "vec_of_poly f = vec_of_list (rev (coeffs f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_poly f = vec_of_list (rev (coeffs f))
[PROOF STEP]
proof (insert assms, induct f)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> vec_of_poly 0 = vec_of_list (rev (coeffs 0))
 2. \<And>a f. \<lbrakk>a \<noteq> (0::'a) \<or> f \<noteq> 0; f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f)); pCons a f \<noteq> 0\<rbrakk> \<Longrightarrow> vec_of_poly (pCons a f) = vec_of_list (rev (coeffs (pCons a f)))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<noteq> 0

goal (2 subgoals):
 1. 0 \<noteq> 0 \<Longrightarrow> vec_of_poly 0 = vec_of_list (rev (coeffs 0))
 2. \<And>a f. \<lbrakk>a \<noteq> (0::'a) \<or> f \<noteq> 0; f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f)); pCons a f \<noteq> 0\<rbrakk> \<Longrightarrow> vec_of_poly (pCons a f) = vec_of_list (rev (coeffs (pCons a f)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 \<noteq> 0

goal (1 subgoal):
 1. vec_of_poly 0 = vec_of_list (rev (coeffs 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_of_poly 0 = vec_of_list (rev (coeffs 0))

goal (1 subgoal):
 1. \<And>a f. \<lbrakk>a \<noteq> (0::'a) \<or> f \<noteq> 0; f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f)); pCons a f \<noteq> 0\<rbrakk> \<Longrightarrow> vec_of_poly (pCons a f) = vec_of_list (rev (coeffs (pCons a f)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a f. \<lbrakk>a \<noteq> (0::'a) \<or> f \<noteq> 0; f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f)); pCons a f \<noteq> 0\<rbrakk> \<Longrightarrow> vec_of_poly (pCons a f) = vec_of_list (rev (coeffs (pCons a f)))
[PROOF STEP]
case (pCons a f)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<or> f \<noteq> 0
f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f))
pCons a f \<noteq> 0

goal (1 subgoal):
 1. \<And>a f. \<lbrakk>a \<noteq> (0::'a) \<or> f \<noteq> 0; f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f)); pCons a f \<noteq> 0\<rbrakk> \<Longrightarrow> vec_of_poly (pCons a f) = vec_of_list (rev (coeffs (pCons a f)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a) \<or> f \<noteq> 0
f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f))
pCons a f \<noteq> 0
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a) \<or> f \<noteq> 0
f \<noteq> 0 \<Longrightarrow> vec_of_poly f = vec_of_list (rev (coeffs f))
pCons a f \<noteq> 0

goal (1 subgoal):
 1. vec_of_poly (pCons a f) = vec_of_list (rev (coeffs (pCons a f)))
[PROOF STEP]
by (cases "f = 0", auto simp: vec_of_list_append vec_of_poly_pCons)
[PROOF STATE]
proof (state)
this:
vec_of_poly (pCons a f) = vec_of_list (rev (coeffs (pCons a f)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma openin_prod_Times_iff:
     "openin (prod_topology X Y) (S \<times> T) \<longleftrightarrow> S = {} \<or> T = {} \<or> openin X S \<and> openin Y T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)
[PROOF STEP]
proof (cases "S = {} \<or> T = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (S = {} \<or> T = {})

goal (2 subgoals):
 1. S = {} \<or> T = {} \<Longrightarrow> openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)
 2. \<not> (S = {} \<or> T = {}) \<Longrightarrow> openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (S = {} \<or> T = {})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (S = {} \<or> T = {})

goal (1 subgoal):
 1. openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)
[PROOF STEP]
apply (simp add: openin_prod_topology_alt openin_subopen [of X S] openin_subopen [of Y T] times_subset_iff, safe)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x xa xb xc xd. \<lbrakk>x \<in> S; x \<notin> {}; xa \<in> T; xa \<notin> {}; xb \<in> T; xb \<notin> {}; xc \<in> S; xc \<notin> {}; \<forall>x y. x \<in> S \<and> y \<in> T \<longrightarrow> (\<exists>U. openin X U \<and> (\<exists>V. openin Y V \<and> x \<in> U \<and> y \<in> V \<and> (U = {} \<or> V = {} \<or> U \<subseteq> S \<and> V \<subseteq> T))); xd \<in> S\<rbrakk> \<Longrightarrow> \<exists>T. openin X T \<and> xd \<in> T \<and> T \<subseteq> S
 2. \<And>x xa xb xc xd. \<lbrakk>x \<in> S; x \<notin> {}; xa \<in> T; xa \<notin> {}; xb \<in> T; xb \<notin> {}; xc \<in> S; xc \<notin> {}; \<forall>x y. x \<in> S \<and> y \<in> T \<longrightarrow> (\<exists>U. openin X U \<and> (\<exists>V. openin Y V \<and> x \<in> U \<and> y \<in> V \<and> (U = {} \<or> V = {} \<or> U \<subseteq> S \<and> V \<subseteq> T))); xd \<in> T\<rbrakk> \<Longrightarrow> \<exists>Ta. openin Y Ta \<and> xd \<in> Ta \<and> Ta \<subseteq> T
 3. \<And>x xa xb xc xd y. \<lbrakk>x \<in> S; x \<notin> {}; xa \<in> T; xa \<notin> {}; xb \<in> T; xb \<notin> {}; xc \<in> S; xc \<notin> {}; \<forall>x\<in>S. \<exists>T. openin X T \<and> x \<in> T \<and> T \<subseteq> S; \<forall>x\<in>T. \<exists>Ta. openin Y Ta \<and> x \<in> Ta \<and> Ta \<subseteq> T; xd \<in> S; y \<in> T\<rbrakk> \<Longrightarrow> \<exists>U. openin X U \<and> (\<exists>V. openin Y V \<and> xd \<in> U \<and> y \<in> V \<and> (U = {} \<or> V = {} \<or> U \<subseteq> S \<and> V \<subseteq> T))
[PROOF STEP]
apply (meson|force)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)

goal (1 subgoal):
 1. S = {} \<or> T = {} \<Longrightarrow> openin (prod_topology X Y) (S \<times> T) = (S = {} \<or> T = {} \<or> openin X S \<and> openin Y T)
[PROOF STEP]
qed force


[STATEMENT]
lemma aff_dim_translation_eq_subtract:
  "aff_dim ((\<lambda>x. x - a) ` S) = aff_dim S" for a :: "'n::euclidean_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim ((\<lambda>x. x - a) ` S) = aff_dim S
[PROOF STEP]
using aff_dim_translation_eq [of "- a"]
[PROOF STATE]
proof (prove)
using this:
aff_dim ((+) (- a) ` ?S) = aff_dim ?S

goal (1 subgoal):
 1. aff_dim ((\<lambda>x. x - a) ` S) = aff_dim S
[PROOF STEP]
by (simp cong: image_cong_simp)


[STATEMENT]
lemma sup_spans[code]:
  \<comment> \<open>Code equation for the join (lub) of two subspaces (union of the generating lists)\<close>
  "SPAN A \<squnion> SPAN B = SPAN (A @ B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SPAN A \<squnion> SPAN B = SPAN (A @ B)
[PROOF STEP]
unfolding SPAN_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (let n = length canonical_basis in ccspan (basis_enum_of_vec ` Set.filter (\<lambda>v. dim_vec v = n) (set A))) \<squnion> (let n = length canonical_basis in ccspan (basis_enum_of_vec ` Set.filter (\<lambda>v. dim_vec v = n) (set B))) = (let n = length canonical_basis in ccspan (basis_enum_of_vec ` Set.filter (\<lambda>v. dim_vec v = n) (set (A @ B))))
[PROOF STEP]
by (auto simp: ccspan_union image_Un filter_Un Let_def)


[STATEMENT]
lemma prod_qbs_MxI:
  assumes "\<And>i. i \<in> I \<Longrightarrow> (\<lambda>r. \<alpha> r i) \<in> qbs_Mx (M i)"
      and "\<And>i. i \<notin> I \<Longrightarrow> (\<lambda>r. \<alpha> r i) = (\<lambda>r. undefined)"
    shows "\<alpha> \<in> prod_qbs_Mx I M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> \<in> prod_qbs_Mx I M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> (\<lambda>r. \<alpha> r ?i) \<in> qbs_Mx (M ?i)
?i \<notin> I \<Longrightarrow> (\<lambda>r. \<alpha> r ?i) = (\<lambda>r. undefined)

goal (1 subgoal):
 1. \<alpha> \<in> prod_qbs_Mx I M
[PROOF STEP]
by(auto simp: prod_qbs_Mx_def)


[STATEMENT]
lemma unicoherent_injective_linear_image:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "linear f" "inj f"
  shows "(unicoherent(f ` S) \<longleftrightarrow> unicoherent S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unicoherent (f ` S) = unicoherent S
[PROOF STEP]
using assms homeomorphic_unicoherent_eq linear_homeomorphic_image
[PROOF STATE]
proof (prove)
using this:
linear f
inj f
?S homeomorphic ?T \<Longrightarrow> unicoherent ?S = unicoherent ?T
\<lbrakk>linear ?f; inj ?f\<rbrakk> \<Longrightarrow> ?S homeomorphic ?f ` ?S

goal (1 subgoal):
 1. unicoherent (f ` S) = unicoherent S
[PROOF STEP]
by blast


[STATEMENT]
lemma rtranclp_equivp: "R\<^sup>*\<^sup>* = R" if "equivp R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R\<^sup>*\<^sup>* = R
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
equivp R

goal (1 subgoal):
 1. R\<^sup>*\<^sup>* = R
[PROOF STEP]
by(simp add: rtranclp_transp_reflp equivp_reflp_symp_transp)


[STATEMENT]
lemma winding_number_zero_at_infinity:
  assumes \<gamma>: "path \<gamma>" and loop: "pathfinish \<gamma> = pathstart \<gamma>"
    shows "\<exists>B. \<forall>z. B \<le> norm z \<longrightarrow> winding_number \<gamma> z = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B. \<forall>z. B \<le> cmod z \<longrightarrow> winding_number \<gamma> z = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>B. \<forall>z. B \<le> cmod z \<longrightarrow> winding_number \<gamma> z = 0
[PROOF STEP]
obtain B::real where "0 < B" and B: "path_image \<gamma> \<subseteq> ball 0 B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; path_image \<gamma> \<subseteq> ball 0 B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using bounded_subset_ballD [OF bounded_path_image [OF \<gamma>]]
[PROOF STATE]
proof (prove)
using this:
\<exists>r>0. path_image \<gamma> \<subseteq> ball ?x r

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; path_image \<gamma> \<subseteq> ball 0 B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < B
path_image \<gamma> \<subseteq> ball 0 B

goal (1 subgoal):
 1. \<exists>B. \<forall>z. B \<le> cmod z \<longrightarrow> winding_number \<gamma> z = 0
[PROOF STEP]
have "winding_number \<gamma> z = 0" if "B + 1 \<le> cmod z" for z
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. winding_number \<gamma> z = 0
[PROOF STEP]
proof (rule winding_number_zero_outside [OF \<gamma> convex_cball loop])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<notin> cball ?x1 ?e1
 2. path_image \<gamma> \<subseteq> cball ?x1 ?e1
[PROOF STEP]
show "z \<notin> cball 0 B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<notin> cball 0 B
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
B + 1 \<le> cmod z

goal (1 subgoal):
 1. z \<notin> cball 0 B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z \<notin> cball 0 B

goal (1 subgoal):
 1. path_image \<gamma> \<subseteq> cball 0 B
[PROOF STEP]
show "path_image \<gamma> \<subseteq> cball 0 B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image \<gamma> \<subseteq> cball 0 B
[PROOF STEP]
using B order.trans
[PROOF STATE]
proof (prove)
using this:
path_image \<gamma> \<subseteq> ball 0 B
\<lbrakk>?a \<le> ?b; ?b \<le> ?c\<rbrakk> \<Longrightarrow> ?a \<le> ?c

goal (1 subgoal):
 1. path_image \<gamma> \<subseteq> cball 0 B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
path_image \<gamma> \<subseteq> cball 0 B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
B + 1 \<le> cmod ?z \<Longrightarrow> winding_number \<gamma> ?z = 0

goal (1 subgoal):
 1. \<exists>B. \<forall>z. B \<le> cmod z \<longrightarrow> winding_number \<gamma> z = 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B + 1 \<le> cmod ?z \<Longrightarrow> winding_number \<gamma> ?z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
B + 1 \<le> cmod ?z \<Longrightarrow> winding_number \<gamma> ?z = 0

goal (1 subgoal):
 1. \<exists>B. \<forall>z. B \<le> cmod z \<longrightarrow> winding_number \<gamma> z = 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<exists>B. \<forall>z. B \<le> cmod z \<longrightarrow> winding_number \<gamma> z = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_split_def: "list_split xs = (\<Union>n < length xs. {(take n xs, drop n xs)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_split xs = (\<Union>n<length xs. {(take n xs, drop n xs)})
[PROOF STEP]
using less_Suc_eq_0_disj
[PROOF STATE]
proof (prove)
using this:
(?m < Suc ?n) = (?m = 0 \<or> (\<exists>j. ?m = Suc j \<and> j < ?n))

goal (1 subgoal):
 1. list_split xs = (\<Union>n<length xs. {(take n xs, drop n xs)})
[PROOF STEP]
by (induction xs rule: list_split.induct) auto+


[STATEMENT]
lemma diamondp_implies_confluentp:
    assumes "diamondp r"
    shows "confluentp r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confluentp r
[PROOF STEP]
proof (rule confluentpI')
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y1 y2. \<lbrakk>r\<^sup>*\<^sup>* x y1; r x y2\<rbrakk> \<Longrightarrow> \<exists>z. r\<^sup>*\<^sup>* y1 z \<and> r\<^sup>*\<^sup>* y2 z
[PROOF STEP]
fix x y1 y2
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y1 y2. \<lbrakk>r\<^sup>*\<^sup>* x y1; r x y2\<rbrakk> \<Longrightarrow> \<exists>z. r\<^sup>*\<^sup>* y1 z \<and> r\<^sup>*\<^sup>* y2 z
[PROOF STEP]
assume "r\<^sup>*\<^sup>* x y1" "r x y2"
[PROOF STATE]
proof (state)
this:
r\<^sup>*\<^sup>* x y1
r x y2

goal (1 subgoal):
 1. \<And>x y1 y2. \<lbrakk>r\<^sup>*\<^sup>* x y1; r x y2\<rbrakk> \<Longrightarrow> \<exists>z. r\<^sup>*\<^sup>* y1 z \<and> r\<^sup>*\<^sup>* y2 z
[PROOF STEP]
hence "\<exists> z. r y1 z \<and> r\<^sup>*\<^sup>* y2 z"
[PROOF STATE]
proof (prove)
using this:
r\<^sup>*\<^sup>* x y1
r x y2

goal (1 subgoal):
 1. \<exists>z. r y1 z \<and> r\<^sup>*\<^sup>* y2 z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r\<^sup>*\<^sup>* x y1
r x y2
diamondp r

goal (1 subgoal):
 1. \<exists>z. r y1 z \<and> r\<^sup>*\<^sup>* y2 z
[PROOF STEP]
by (induct rule: rtranclp_induct, force+)
[PROOF STATE]
proof (state)
this:
\<exists>z. r y1 z \<and> r\<^sup>*\<^sup>* y2 z

goal (1 subgoal):
 1. \<And>x y1 y2. \<lbrakk>r\<^sup>*\<^sup>* x y1; r x y2\<rbrakk> \<Longrightarrow> \<exists>z. r\<^sup>*\<^sup>* y1 z \<and> r\<^sup>*\<^sup>* y2 z
[PROOF STEP]
thus "\<exists> z. r\<^sup>*\<^sup>* y1 z \<and> r\<^sup>*\<^sup>* y2 z"
[PROOF STATE]
proof (prove)
using this:
\<exists>z. r y1 z \<and> r\<^sup>*\<^sup>* y2 z

goal (1 subgoal):
 1. \<exists>z. r\<^sup>*\<^sup>* y1 z \<and> r\<^sup>*\<^sup>* y2 z
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>z. r\<^sup>*\<^sup>* y1 z \<and> r\<^sup>*\<^sup>* y2 z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma replicate_dotprod:
  assumes "length y = n"
  shows "replicate n x \<bullet> y = x * sum_list y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. replicate n x \<bullet> y = x * sum_list y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. replicate n x \<bullet> y = x * sum_list y
[PROOF STEP]
have "x * (\<Sum>i<length y.  y ! i) = (\<Sum>i<length y. x * y ! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * sum ((!) y) {..<length y} = (\<Sum>i<length y. x * y ! i)
[PROOF STEP]
using sum_distrib_left
[PROOF STATE]
proof (prove)
using this:
?r * sum ?f ?A = (\<Sum>n\<in>?A. ?r * ?f n)

goal (1 subgoal):
 1. x * sum ((!) y) {..<length y} = (\<Sum>i<length y. x * y ! i)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x * sum ((!) y) {..<length y} = (\<Sum>i<length y. x * y ! i)

goal (1 subgoal):
 1. replicate n x \<bullet> y = x * sum_list y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x * sum ((!) y) {..<length y} = (\<Sum>i<length y. x * y ! i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * sum ((!) y) {..<length y} = (\<Sum>i<length y. x * y ! i)

goal (1 subgoal):
 1. replicate n x \<bullet> y = x * sum_list y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x * sum ((!) y) {..<length y} = (\<Sum>i<length y. x * y ! i)
length y = n

goal (1 subgoal):
 1. replicate n x \<bullet> y = x * sum_list y
[PROOF STEP]
by (auto simp: dotprod_def sum_list_sum_nth atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
replicate n x \<bullet> y = x * sum_list y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma projection_plus:
  fixes A B :: "'a::chilbert_space set"
  assumes "\<And>x y. x:A \<Longrightarrow> y:B \<Longrightarrow> is_orthogonal x y"
  assumes \<open>closed_csubspace A\<close>
  assumes \<open>closed_csubspace B\<close>
  shows \<open>projection (A +\<^sub>M B) = (\<lambda>x. projection A x + projection B x)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. projection (A +\<^sub>M B) = (\<lambda>x. projection A x + projection B x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. projection (A +\<^sub>M B) = (\<lambda>x. projection A x + projection B x)
[PROOF STEP]
have \<open>is_projection_on (\<lambda>x. projection A x + projection B x) (A +\<^sub>M B)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_projection_on (\<lambda>x. projection A x + projection B x) (A +\<^sub>M B)
[PROOF STEP]
apply (rule is_projection_on_plus)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> B\<rbrakk> \<Longrightarrow> is_orthogonal x y
 2. closed_csubspace A
 3. closed_csubspace B
 4. is_projection_on (projection A) A
 5. is_projection_on (projection B) B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> A; ?y \<in> B\<rbrakk> \<Longrightarrow> is_orthogonal ?x ?y
closed_csubspace A
closed_csubspace B

goal (5 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> A; y \<in> B\<rbrakk> \<Longrightarrow> is_orthogonal x y
 2. closed_csubspace A
 3. closed_csubspace B
 4. is_projection_on (projection A) A
 5. is_projection_on (projection B) B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_projection_on (\<lambda>x. projection A x + projection B x) (A +\<^sub>M B)

goal (1 subgoal):
 1. projection (A +\<^sub>M B) = (\<lambda>x. projection A x + projection B x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_projection_on (\<lambda>x. projection A x + projection B x) (A +\<^sub>M B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_projection_on (\<lambda>x. projection A x + projection B x) (A +\<^sub>M B)

goal (1 subgoal):
 1. projection (A +\<^sub>M B) = (\<lambda>x. projection A x + projection B x)
[PROOF STEP]
by (meson assms(2) assms(3) closed_csubspace.subspace closed_subspace_closed_sum csubspace_is_convex projection_eqI')
[PROOF STATE]
proof (state)
this:
projection (A +\<^sub>M B) = (\<lambda>x. projection A x + projection B x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma walk_alternates:
  assumes "is_walk w"
  assumes "Suc i < length w" "i \<ge> 0"
  shows "w ! i \<in> X \<longleftrightarrow> w ! (i + 1) \<in> Y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w ! i \<in> X) = (w ! (i + 1) \<in> Y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (w ! i \<in> X) = (w ! (i + 1) \<in> Y)
[PROOF STEP]
have "{w ! i, w ! (i +1)} \<in> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {w ! i, w ! (i + 1)} \<in> E
[PROOF STEP]
using is_walk_index assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?i; Suc ?i < length ?w; is_walk ?w\<rbrakk> \<Longrightarrow> {?w ! ?i, ?w ! (?i + 1)} \<in> E
is_walk w
Suc i < length w
0 \<le> i

goal (1 subgoal):
 1. {w ! i, w ! (i + 1)} \<in> E
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{w ! i, w ! (i + 1)} \<in> E

goal (1 subgoal):
 1. (w ! i \<in> X) = (w ! (i + 1) \<in> Y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{w ! i, w ! (i + 1)} \<in> E
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{w ! i, w ! (i + 1)} \<in> E

goal (1 subgoal):
 1. (w ! i \<in> X) = (w ! (i + 1) \<in> Y)
[PROOF STEP]
using X_vert_adj_Y not_vert_adj Y_vert_adj_X vert_adj_sym
[PROOF STATE]
proof (prove)
using this:
{w ! i, w ! (i + 1)} \<in> E
\<lbrakk>?x \<in> X; vert_adj ?x ?y\<rbrakk> \<Longrightarrow> ?y \<in> Y
\<not> vert_adj ?v ?u \<Longrightarrow> {?v, ?u} \<notin> E
\<lbrakk>?y \<in> Y; vert_adj ?y ?x\<rbrakk> \<Longrightarrow> ?x \<in> X
vert_adj ?v1.0 ?v2.0 = vert_adj ?v2.0 ?v1.0

goal (1 subgoal):
 1. (w ! i \<in> X) = (w ! (i + 1) \<in> Y)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(w ! i \<in> X) = (w ! (i + 1) \<in> Y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_interior_convex_shrink:
  fixes S :: "'a::euclidean_space set"
  assumes "convex S"
    and "c \<in> rel_interior S"
    and "x \<in> S"
    and "0 < e"
    and "e \<le> 1"
  shows "x - e *\<^sub>R (x - c) \<in> rel_interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
obtain d where "d > 0" and d: "ball c d \<inter> affine hull S \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; ball c d \<inter> affine hull S \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
c \<in> rel_interior S

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; ball c d \<inter> affine hull S \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding  mem_rel_interior_ball
[PROOF STATE]
proof (prove)
using this:
c \<in> S \<and> (\<exists>e>0. ball c e \<inter> affine hull S \<subseteq> S)

goal (1 subgoal):
 1. (\<And>d. \<lbrakk>0 < d; ball c d \<inter> affine hull S \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < d
ball c d \<inter> affine hull S \<subseteq> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
0 < d
ball c d \<inter> affine hull S \<subseteq> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
assume as: "dist (x - e *\<^sub>R (x - c)) y < e * d" "y \<in> affine hull S"
[PROOF STATE]
proof (state)
this:
dist (x - e *\<^sub>R (x - c)) y < e * d
y \<in> affine hull S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have *: "y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x
[PROOF STEP]
using \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x
[PROOF STEP]
by (auto simp: scaleR_left_diff_distrib scaleR_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have "x \<in> affine hull S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> affine hull S
[PROOF STEP]
using assms hull_subset[of S]
[PROOF STATE]
proof (prove)
using this:
convex S
c \<in> rel_interior S
x \<in> S
0 < e
e \<le> 1
S \<subseteq> ?S hull S

goal (1 subgoal):
 1. x \<in> affine hull S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> affine hull S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> affine hull S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have "1 / e + - ((1 - e) / e) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / e + - ((1 - e) / e) = 1
[PROOF STEP]
using \<open>e > 0\<close> left_diff_distrib[of "1" "(1-e)" "1/e"]
[PROOF STATE]
proof (prove)
using this:
0 < e
(1 - (1 - e)) * (1 / e) = 1 * (1 / e) - (1 - e) * (1 / e)

goal (1 subgoal):
 1. 1 / e + - ((1 - e) / e) = 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / e + - ((1 - e) / e) = 1

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> affine hull S
1 / e + - ((1 - e) / e) = 1
[PROOF STEP]
have **: "(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S"
[PROOF STATE]
proof (prove)
using this:
x \<in> affine hull S
1 / e + - ((1 - e) / e) = 1

goal (1 subgoal):
 1. (1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S
[PROOF STEP]
using as affine_affine_hull[of S] mem_affine[of "affine hull S" y x "(1 / e)" "-((1 - e) / e)"]
[PROOF STATE]
proof (prove)
using this:
x \<in> affine hull S
1 / e + - ((1 - e) / e) = 1
dist (x - e *\<^sub>R (x - c)) y < e * d
y \<in> affine hull S
affine (affine hull S)
\<lbrakk>affine (affine hull S); y \<in> affine hull S; x \<in> affine hull S; 1 / e + - ((1 - e) / e) = 1\<rbrakk> \<Longrightarrow> (1 / e) *\<^sub>R y + - ((1 - e) / e) *\<^sub>R x \<in> affine hull S

goal (1 subgoal):
 1. (1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have "c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)
[PROOF STEP]
using \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)
[PROOF STEP]
by (auto simp: euclidean_eq_iff[where 'a='a] field_simps inner_simps)
[PROOF STATE]
proof (state)
this:
c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)
[PROOF STEP]
have "dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = \<bar>1/e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)"
[PROOF STATE]
proof (prove)
using this:
c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)

goal (1 subgoal):
 1. dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = \<bar>1 / e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)
[PROOF STEP]
unfolding dist_norm norm_scaleR[symmetric]
[PROOF STATE]
proof (prove)
using this:
c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = (1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)

goal (1 subgoal):
 1. norm (c - ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x)) = norm ((1 / e) *\<^sub>R (e *\<^sub>R c - y + (1 - e) *\<^sub>R x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = \<bar>1 / e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) = \<bar>1 / e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x)

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have "\<dots> = \<bar>1/e\<bar> * norm (x - e *\<^sub>R (x - c) - y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>1 / e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x) = \<bar>1 / e\<bar> * norm (x - e *\<^sub>R (x - c) - y)
[PROOF STEP]
by (auto intro!:arg_cong[where f=norm] simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
\<bar>1 / e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x) = \<bar>1 / e\<bar> * norm (x - e *\<^sub>R (x - c) - y)

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>1 / e\<bar> * norm (e *\<^sub>R c - y + (1 - e) *\<^sub>R x) = \<bar>1 / e\<bar> * norm (x - e *\<^sub>R (x - c) - y)

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have "\<dots> < d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>1 / e\<bar> * norm (x - e *\<^sub>R (x - c) - y) < d
[PROOF STEP]
using as[unfolded dist_norm] and \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
norm (x - e *\<^sub>R (x - c) - y) < e * d
y \<in> affine hull S
0 < e

goal (1 subgoal):
 1. \<bar>1 / e\<bar> * norm (x - e *\<^sub>R (x - c) - y) < d
[PROOF STEP]
by (auto simp:pos_divide_less_eq[OF \<open>e > 0\<close>] mult.commute)
[PROOF STATE]
proof (state)
this:
\<bar>1 / e\<bar> * norm (x - e *\<^sub>R (x - c) - y) < d

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) < d
[PROOF STEP]
have "(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S"
[PROOF STATE]
proof (prove)
using this:
dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) < d

goal (1 subgoal):
 1. (1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S
[PROOF STEP]
using "**"  d
[PROOF STATE]
proof (prove)
using this:
dist c ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) < d
(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> affine hull S
ball c d \<inter> affine hull S \<subseteq> S

goal (1 subgoal):
 1. (1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S
[PROOF STEP]
have "y \<in> S"
[PROOF STATE]
proof (prove)
using this:
(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S

goal (1 subgoal):
 1. y \<in> S
[PROOF STEP]
using * convexD [OF \<open>convex S\<close>] assms(3-5)
[PROOF STATE]
proof (prove)
using this:
(1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x \<in> S
y = (1 - (1 - e)) *\<^sub>R ((1 / e) *\<^sub>R y - ((1 - e) / e) *\<^sub>R x) + (1 - e) *\<^sub>R x
\<lbrakk>?x \<in> S; ?y \<in> S; 0 \<le> ?u; 0 \<le> ?v; ?u + ?v = 1\<rbrakk> \<Longrightarrow> ?u *\<^sub>R ?x + ?v *\<^sub>R ?y \<in> S
x \<in> S
0 < e
e \<le> 1

goal (1 subgoal):
 1. y \<in> S
[PROOF STEP]
by (metis diff_add_cancel diff_ge_0_iff_ge le_add_same_cancel1 less_eq_real_def)
[PROOF STATE]
proof (state)
this:
y \<in> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>dist (x - e *\<^sub>R (x - c)) ?y2 < e * d; ?y2 \<in> affine hull S\<rbrakk> \<Longrightarrow> ?y2 \<in> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>dist (x - e *\<^sub>R (x - c)) ?y2 < e * d; ?y2 \<in> affine hull S\<rbrakk> \<Longrightarrow> ?y2 \<in> S
[PROOF STEP]
have "ball (x - e *\<^sub>R (x - c)) (e*d) \<inter> affine hull S \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dist (x - e *\<^sub>R (x - c)) ?y2 < e * d; ?y2 \<in> affine hull S\<rbrakk> \<Longrightarrow> ?y2 \<in> S

goal (1 subgoal):
 1. ball (x - e *\<^sub>R (x - c)) (e * d) \<inter> affine hull S \<subseteq> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ball (x - e *\<^sub>R (x - c)) (e * d) \<inter> affine hull S \<subseteq> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ball (x - e *\<^sub>R (x - c)) (e * d) \<inter> affine hull S \<subseteq> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have "e * d > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < e * d
[PROOF STEP]
using \<open>e > 0\<close> \<open>d > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e
0 < d

goal (1 subgoal):
 1. 0 < e * d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < e * d

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < e * d

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
have c: "c \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<in> S
[PROOF STEP]
using assms rel_interior_subset
[PROOF STATE]
proof (prove)
using this:
convex S
c \<in> rel_interior S
x \<in> S
0 < e
e \<le> 1
rel_interior ?S \<subseteq> ?S

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

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
c \<in> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
from c
[PROOF STATE]
proof (chain)
picking this:
c \<in> S
[PROOF STEP]
have "x - e *\<^sub>R (x - c) \<in> S"
[PROOF STATE]
proof (prove)
using this:
c \<in> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> S
[PROOF STEP]
using convexD_alt[of S x c e] assms
[PROOF STATE]
proof (prove)
using this:
c \<in> S
\<lbrakk>convex S; x \<in> S; c \<in> S; 0 \<le> e; e \<le> 1\<rbrakk> \<Longrightarrow> (1 - e) *\<^sub>R x + e *\<^sub>R c \<in> S
convex S
c \<in> rel_interior S
x \<in> S
0 < e
e \<le> 1

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> S
[PROOF STEP]
by (metis  diff_add_eq diff_diff_eq2 less_eq_real_def scaleR_diff_left scaleR_one scale_right_diff_distrib)
[PROOF STATE]
proof (state)
this:
x - e *\<^sub>R (x - c) \<in> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ball (x - e *\<^sub>R (x - c)) (e * d) \<inter> affine hull S \<subseteq> S
0 < e * d
c \<in> S
x - e *\<^sub>R (x - c) \<in> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ball (x - e *\<^sub>R (x - c)) (e * d) \<inter> affine hull S \<subseteq> S
0 < e * d
c \<in> S
x - e *\<^sub>R (x - c) \<in> S

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
using mem_rel_interior_ball[of "x - e *\<^sub>R (x - c)" S] \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
ball (x - e *\<^sub>R (x - c)) (e * d) \<inter> affine hull S \<subseteq> S
0 < e * d
c \<in> S
x - e *\<^sub>R (x - c) \<in> S
(x - e *\<^sub>R (x - c) \<in> rel_interior S) = (x - e *\<^sub>R (x - c) \<in> S \<and> (\<exists>ea>0. ball (x - e *\<^sub>R (x - c)) ea \<inter> affine hull S \<subseteq> S))
0 < e

goal (1 subgoal):
 1. x - e *\<^sub>R (x - c) \<in> rel_interior S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x - e *\<^sub>R (x - c) \<in> rel_interior S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_roots_code[code]:
  "count_roots (p::real poly) =
    (if p = 0 then 0
     else let ps = sturm p
           in sign_changes_neg_inf ps - sign_changes_inf ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
proof (cases "p = 0", simp add: count_roots_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
define d where "d = gcd p (pderiv p)"
[PROOF STATE]
proof (state)
this:
d = gcd p (pderiv p)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
from \<open>p \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
have [simp]: "p div d \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. p div d \<noteq> 0
[PROOF STEP]
using poly_div_gcd_squarefree(1)[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
coprime (p div gcd p (pderiv p)) (pderiv (p div gcd p (pderiv p)))

goal (1 subgoal):
 1. p div d \<noteq> 0
[PROOF STEP]
by (auto simp add: d_def)
[PROOF STATE]
proof (state)
this:
p div d \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
from sturm_seq_sturm_squarefree'[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (chain)
picking this:
sturm_seq (sturm_squarefree' p) (p div gcd p (pderiv p))
[PROOF STEP]
interpret sturm_seq "sturm_squarefree' p" "p div d"
[PROOF STATE]
proof (prove)
using this:
sturm_seq (sturm_squarefree' p) (p div gcd p (pderiv p))

goal (1 subgoal):
 1. sturm_seq (sturm_squarefree' p) (p div d)
[PROOF STEP]
unfolding sturm_squarefree'_def Let_def d_def
[PROOF STATE]
proof (prove)
using this:
sturm_seq (map (\<lambda>p'. p' div gcd p (pderiv p)) (sturm p)) (p div gcd p (pderiv p))

goal (1 subgoal):
 1. sturm_seq (map (\<lambda>p'. p' div gcd p (pderiv p)) (sturm p)) (p div gcd p (pderiv p))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
note count_roots_correct
[PROOF STATE]
proof (state)
this:
count_roots ?p = card {x. poly ?p x = 0}

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_roots ?p = card {x. poly ?p x = 0}

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
have "{x. poly p x = 0} = {x. poly (p div d) x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly p x = 0} = {x. poly (p div d) x = 0}
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. poly p x = 0} = {x. poly (p div gcd p (pderiv p)) x = 0}
[PROOF STEP]
using poly_div_gcd_squarefree(2)[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
(poly (p div gcd p (pderiv p)) ?x = 0) = (poly p ?x = 0)

goal (1 subgoal):
 1. {x. poly p x = 0} = {x. poly (p div gcd p (pderiv p)) x = 0}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
{x. poly p x = 0} = {x. poly (p div d) x = 0}

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{x. poly p x = 0} = {x. poly (p div d) x = 0}

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
note count_roots[OF \<open>p div d \<noteq> 0\<close>, symmetric]
[PROOF STATE]
proof (state)
this:
card {x. poly (p div d) x = 0} = sign_changes_neg_inf (sturm_squarefree' p) - sign_changes_inf (sturm_squarefree' p)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {x. poly (p div d) x = 0} = sign_changes_neg_inf (sturm_squarefree' p) - sign_changes_inf (sturm_squarefree' p)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
note sturm_sturm_squarefree'_same_sign_changes(2)[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (state)
this:
sign_changes_inf (sturm_squarefree' p) = sign_changes_inf (sturm p)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sign_changes_inf (sturm_squarefree' p) = sign_changes_inf (sturm p)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
note sturm_sturm_squarefree'_same_sign_changes(3)[OF \<open>p \<noteq> 0\<close>]
[PROOF STATE]
proof (state)
this:
sign_changes_neg_inf (sturm_squarefree' p) = sign_changes_neg_inf (sturm p)

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_roots p = sign_changes_neg_inf (sturm p) - sign_changes_inf (sturm p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_roots p = sign_changes_neg_inf (sturm p) - sign_changes_inf (sturm p)

goal (1 subgoal):
 1. count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
count_roots p = sign_changes_neg_inf (sturm p) - sign_changes_inf (sturm p)
p \<noteq> 0

goal (1 subgoal):
 1. count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
using this:
count_roots p = sign_changes_neg_inf (sturm p) - sign_changes_inf (sturm p)
p \<noteq> 0

goal (1 subgoal):
 1. count_roots p = (if p = 0 then 0 else sign_changes_neg_inf (sturm p) - sign_changes_inf (sturm p))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count_roots p = (if p = 0 then 0 else let ps = sturm p in sign_changes_neg_inf ps - sign_changes_inf ps)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linear_surjective_isomorphism:
  assumes lf: "linear s1 s2 f"
    and sf: "surj f"
    and dims: "vs2.dim UNIV = vs1.dim UNIV"
  shows "\<exists>f'. linear s2 s1 f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f'. linear (*b) (*a) f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)
[PROOF STEP]
using linear_surjective_imp_injective[OF lf sf dims] sf
    linear_exists_right_inverse_on[OF lf vs1.subspace_UNIV]
    linear_exists_left_inverse_on[OF lf vs1.subspace_UNIV]
    dims lf linear_injective_isomorphism
[PROOF STATE]
proof (prove)
using this:
inj f
surj f
\<exists>g. range g \<subseteq> UNIV \<and> linear (*b) (*a) g \<and> (\<forall>v\<in>range f. f (g v) = v)
inj f \<Longrightarrow> \<exists>g. range g \<subseteq> UNIV \<and> linear (*b) (*a) g \<and> (\<forall>v\<in>UNIV. g (f v) = v)
vs2.dim UNIV = vs1.dim UNIV
linear (*a) (*b) f
\<lbrakk>linear (*a) (*b) ?f; inj ?f; vs2.dim UNIV = vs1.dim UNIV\<rbrakk> \<Longrightarrow> \<exists>f'. linear (*b) (*a) f' \<and> (\<forall>x. f' (?f x) = x) \<and> (\<forall>x. ?f (f' x) = x)

goal (1 subgoal):
 1. \<exists>f'. linear (*b) (*a) f' \<and> (\<forall>x. f' (f x) = x) \<and> (\<forall>x. f (f' x) = x)
[PROOF STEP]
by auto


[STATEMENT]
lemma vpairwise_mono:
  assumes "vpairwise P A" and "\<And>x y. P x y \<Longrightarrow> Q x y" and "B \<subseteq>\<^sub>\<circ> A"
  shows "vpairwise Q B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vpairwise Q B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
vpairwise P A
P ?x ?y \<Longrightarrow> Q ?x ?y
B \<subseteq>\<^sub>\<circ> A

goal (1 subgoal):
 1. vpairwise Q B
[PROOF STEP]
by (simp add: less_eq_V_def subset_eq vpairwiseD(2) vpairwiseI)


[STATEMENT]
lemma mat_append_col_col:
  assumes "dim_row A = dim_vec b"
  shows "col (mat_append_col A b) (dim_col A) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (mat_append_col A b) (dim_col A) = b
[PROOF STEP]
proof (standard)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
 2. dim_vec (col (mat_append_col A b) (dim_col A)) = dim_vec b
[PROOF STEP]
let ?nA = "(mat_of_cols (dim_row A) (cols A @ [b]))"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
 2. dim_vec (col (mat_append_col A b) (dim_col A)) = dim_vec b
[PROOF STEP]
show "dim_vec (col (mat_append_col A b) (dim_col A)) = dim_vec b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (col (mat_append_col A b) (dim_col A)) = dim_vec b
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
dim_vec (col (mat_append_col A b) (dim_col A)) = dim_vec b

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
assume "i < dim_vec b"
[PROOF STATE]
proof (state)
this:
i < dim_vec b

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
have "col (mat_append_col A b) (dim_col A) $ i = vec_index (vec (dim_row ?nA) (\<lambda> i. ?nA $$ (i, (dim_col A)))) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col (mat_append_col A b) (dim_col A) $ i = vec (dim_row (mat_of_cols (dim_row A) (cols A @ [b]))) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i
[PROOF STEP]
by (simp add: col_def)
[PROOF STATE]
proof (state)
this:
col (mat_append_col A b) (dim_col A) $ i = vec (dim_row (mat_of_cols (dim_row A) (cols A @ [b]))) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
col (mat_append_col A b) (dim_col A) $ i = vec (dim_row (mat_of_cols (dim_row A) (cols A @ [b]))) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
have "... = vec_index (vec (dim_row A) (\<lambda> i. ?nA $$ (i, (dim_col A)))) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (dim_row (mat_of_cols (dim_row A) (cols A @ [b]))) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i = vec (dim_row A) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec (dim_row (mat_of_cols (dim_row A) (cols A @ [b]))) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i = vec (dim_row A) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec (dim_row (mat_of_cols (dim_row A) (cols A @ [b]))) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i = vec (dim_row A) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
have "... = vec_index ((cols A @ [b]) ! dim_col A) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec (dim_row A) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i = (cols A @ [b]) ! dim_col A $ i
[PROOF STEP]
by (simp add: \<open>i < dim_vec b\<close> assms mat_of_cols_index)
[PROOF STATE]
proof (state)
this:
vec (dim_row A) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i = (cols A @ [b]) ! dim_col A $ i

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec (dim_row A) (\<lambda>i. mat_of_cols (dim_row A) (cols A @ [b]) $$ (i, dim_col A)) $ i = (cols A @ [b]) ! dim_col A $ i

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
have "... = vec_index b i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cols A @ [b]) ! dim_col A $ i = b $ i
[PROOF STEP]
by (metis cols_length nth_append_length)
[PROOF STATE]
proof (state)
this:
(cols A @ [b]) ! dim_col A $ i = b $ i

goal (1 subgoal):
 1. \<And>i. i < dim_vec b \<Longrightarrow> col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
show "col (mat_append_col A b) (dim_col A) $ i = b $ i"
[PROOF STATE]
proof (prove)
using this:
col (mat_append_col A b) (dim_col A) $ i = b $ i

goal (1 subgoal):
 1. col (mat_append_col A b) (dim_col A) $ i = b $ i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
col (mat_append_col A b) (dim_col A) $ i = b $ i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem rbt_map_entry_is_rbt [simp]: "is_rbt (rbt_map_entry k f t) = is_rbt t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_rbt (rbt_map_entry k f t) = is_rbt t
[PROOF STEP]
unfolding is_rbt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inv1 (rbt_map_entry k f t) \<and> inv2 (rbt_map_entry k f t) \<and> color_of (rbt_map_entry k f t) = B \<and> rbt_sorted (rbt_map_entry k f t)) = (inv1 t \<and> inv2 t \<and> color_of t = B \<and> rbt_sorted t)
[PROOF STEP]
by (simp add: rbt_map_entry_inv2 rbt_map_entry_color_of rbt_map_entry_rbt_sorted rbt_map_entry_inv1 )


[STATEMENT]
lemma (in group) trivial_subgroup_is_normal:
  shows "{\<one>} \<lhd> G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<one>} \<lhd> G
[PROOF STEP]
unfolding normal_def normal_axioms_def r_coset_def l_coset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup {\<one>} G \<and> Group.group G \<and> (\<forall>x\<in>carrier G. (\<Union>h\<in>{\<one>}. {h \<otimes> x}) = (\<Union>h\<in>{\<one>}. {x \<otimes> h}))
[PROOF STEP]
by (auto intro: normalI subgroupI simp: is_group)


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


[STATEMENT]
lemma "prime (2 ^ 521 - 1 :: nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime (2 ^ 521 - 1)
[PROOF STEP]
by (subst lucas_lehmer_correct') eval


[STATEMENT]
lemma rsum_append: "rsum (D1 @ D2) f = rsum D1 f + rsum D2 f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rsum (D1 @ D2) f = rsum D1 f + rsum D2 f
[PROOF STEP]
unfolding rsum_def map_append sum_list_append
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(u, x, v)\<leftarrow>D1. f x * (v - u)) + (\<Sum>(u, x, v)\<leftarrow>D2. f x * (v - u)) = (\<Sum>(u, x, v)\<leftarrow>D1. f x * (v - u)) + (\<Sum>(u, x, v)\<leftarrow>D2. f x * (v - u))
[PROOF STEP]
..


[STATEMENT]
lemma sqrt_int_floor_bound: "0 \<le> x \<Longrightarrow> (sqrt_int_floor x)^2 \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> (sqrt_int_floor x)\<^sup>2 \<le> x
[PROOF STEP]
unfolding sqrt_int_floor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> (root_int_floor 2 x)\<^sup>2 \<le> x
[PROOF STEP]
using root_int_floor_def root_int_floor_pos_lower
[PROOF STATE]
proof (prove)
using this:
root_int_floor ?p ?x = (if 0 \<le> ?x then root_int_floor_pos ?p ?x else - root_int_ceiling_pos ?p (- ?x))
\<lbrakk>?p \<noteq> 0; 0 \<le> ?x\<rbrakk> \<Longrightarrow> root_int_floor_pos ?p ?x ^ ?p \<le> ?x

goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> (root_int_floor 2 x)\<^sup>2 \<le> x
[PROOF STEP]
by auto


[STATEMENT]
lemma DERIV_real_sqrt_generic:
  assumes "x \<noteq> 0"
    and "x > 0 \<Longrightarrow> D = inverse (sqrt x) / 2"
    and "x < 0 \<Longrightarrow> D = - inverse (sqrt x) / 2"
  shows "DERIV sqrt x :> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt has_real_derivative D) (at x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0
0 < x \<Longrightarrow> D = inverse (sqrt x) / 2
x < 0 \<Longrightarrow> D = - inverse (sqrt x) / 2

goal (1 subgoal):
 1. (sqrt has_real_derivative D) (at x)
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0
0 < x \<Longrightarrow> D = inverse (root 2 x) / 2
x < 0 \<Longrightarrow> D = - inverse (root 2 x) / 2

goal (1 subgoal):
 1. (root 2 has_real_derivative D) (at x)
[PROOF STEP]
by (auto intro!: DERIV_real_root_generic)


[STATEMENT]
lemma Infinitesimal_monad_eq: "e \<in> Infinitesimal \<Longrightarrow> monad (x + e) = monad x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e \<in> Infinitesimal \<Longrightarrow> monad (x + e) = monad x
[PROOF STEP]
by (fast intro!: Infinitesimal_add_approx_self [THEN approx_sym] approx_monad_iff [THEN iffD1])


[STATEMENT]
lemma content_cbox_if_cart:
   "content(cbox a b) = (if cbox a b = {} then 0 else prod (\<lambda>i. b$i - a$i) UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (cbox a b) = (if cbox a b = {} then 0 else \<Prod>i\<in>UNIV. b $ i - a $ i)
[PROOF STEP]
by (simp add: content_cbox_cart)


[STATEMENT]
lemma (in domain) associated_polynomials_imp_same_roots:
  assumes "p \<in> carrier (poly_ring R)" and "q \<in> carrier (poly_ring R)" and "p \<sim>\<^bsub>poly_ring R\<^esub> q"
  shows "roots p = roots q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots p = roots q
[PROOF STEP]
using assms pdivides_imp_roots_incl zero_pdivides
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (poly_ring R)
q \<in> carrier (poly_ring R)
p \<sim>\<^bsub>poly_ring R\<^esub> q
\<lbrakk>?p \<in> carrier (poly_ring R); ?q \<in> carrier (poly_ring R); ?q \<noteq> []; ?p pdivides ?q\<rbrakk> \<Longrightarrow> roots ?p \<subseteq># roots ?q
[] pdivides ?p = (?p = [])

goal (1 subgoal):
 1. roots p = roots q
[PROOF STEP]
unfolding pdivides_def associated_def
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (poly_ring R)
q \<in> carrier (poly_ring R)
p divides\<^bsub>poly_ring R\<^esub> q \<and> q divides\<^bsub>poly_ring R\<^esub> p
\<lbrakk>?p \<in> carrier (poly_ring R); ?q \<in> carrier (poly_ring R); ?q \<noteq> []; ?p divides\<^bsub>poly_ring R\<^esub> ?q\<rbrakk> \<Longrightarrow> roots ?p \<subseteq># roots ?q
[] divides\<^bsub>poly_ring R\<^esub> ?p = (?p = [])

goal (1 subgoal):
 1. roots p = roots q
[PROOF STEP]
by (metis subset_mset.eq_iff)


[STATEMENT]
lemma add_strict_mono: "\<lbrakk>\<alpha> < \<beta>; \<gamma> < \<delta>; Ord \<alpha>; Ord \<beta>; Ord \<gamma>; Ord \<delta>\<rbrakk> \<Longrightarrow> \<alpha>+\<gamma> < \<beta>+\<delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<alpha> < \<beta>; \<gamma> < \<delta>; Ord \<alpha>; Ord \<beta>; Ord \<gamma>; Ord \<delta>\<rbrakk> \<Longrightarrow> \<alpha> + \<gamma> < \<beta> + \<delta>
[PROOF STEP]
by (metis order.strict_implies_order add_less_cancel_left add_right_mono le_less_trans)


[STATEMENT]
lemma continuous_imp_closed_map:
  fixes f :: "'a::t2_space \<Rightarrow> 'b::t2_space"
  assumes "closedin (top_of_set S) U"
          "continuous_on S f" "f ` S = T" "compact S"
    shows "closedin (top_of_set T) (f ` U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set T) (f ` U)
[PROOF STEP]
by (metis assms closedin_compact_eq compact_continuous_image continuous_on_subset subset_image_iff)


[STATEMENT]
lemma polydivide_properties:
  assumes "SORT_CONSTRAINT('a::field_char_0)"
    and np: "isnpolyh p n0"
    and ns: "isnpolyh s n1"
    and pnz: "p \<noteq> 0\<^sub>p"
  shows "\<exists>k r. polydivide s p = (k, r) \<and>
    (\<exists>nr. isnpolyh r nr) \<and> (degree r = 0 \<or> degree r < degree p) \<and>
    (\<exists>q n1. isnpolyh q n1 \<and> polypow k (head p) *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
have trv: "head p = head p" "degree p = degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. head p = head p &&& Reflected_Multivariate_Polynomial.degree p = Reflected_Multivariate_Polynomial.degree p
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
head p = head p
Reflected_Multivariate_Polynomial.degree p = Reflected_Multivariate_Polynomial.degree p

goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
from polydivide_def[where s="s" and p="p"]
[PROOF STATE]
proof (chain)
picking this:
polydivide s p = polydivide_aux (head p) (Reflected_Multivariate_Polynomial.degree p) p 0 s
[PROOF STEP]
have ex: "\<exists> k r. polydivide s p = (k,r)"
[PROOF STATE]
proof (prove)
using this:
polydivide s p = polydivide_aux (head p) (Reflected_Multivariate_Polynomial.degree p) p 0 s

goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>k r. polydivide s p = (k, r)

goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>k r. polydivide s p = (k, r)
[PROOF STEP]
obtain k r where kr: "polydivide s p = (k,r)"
[PROOF STATE]
proof (prove)
using this:
\<exists>k r. polydivide s p = (k, r)

goal (1 subgoal):
 1. (\<And>k r. polydivide s p = (k, r) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
polydivide s p = (k, r)

goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
from trans[OF polydivide_def[where s="s"and p="p", symmetric] kr]
    polydivide_aux_properties[OF np ns trv pnz, where k="0" and k'="k" and r="r"]
[PROOF STATE]
proof (chain)
picking this:
polydivide_aux (head p) (Reflected_Multivariate_Polynomial.degree p) p 0 s = (k, r)
polydivide_aux (head p) (Reflected_Multivariate_Polynomial.degree p) p 0 s = (k, r) \<longrightarrow> 0 \<le> k \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> Ex (isnpolyh r) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
have "(degree r = 0 \<or> degree r < degree p) \<and>
    (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)"
[PROOF STATE]
proof (prove)
using this:
polydivide_aux (head p) (Reflected_Multivariate_Polynomial.degree p) p 0 s = (k, r)
polydivide_aux (head p) (Reflected_Multivariate_Polynomial.degree p) p 0 s = (k, r) \<longrightarrow> 0 \<le> k \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> Ex (isnpolyh r) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)

goal (1 subgoal):
 1. (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)

goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
with kr
[PROOF STATE]
proof (chain)
picking this:
polydivide s p = (k, r)
(Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
polydivide s p = (k, r)
(Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)

goal (1 subgoal):
 1. \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
apply -
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polydivide s p = (k, r); (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)\<rbrakk> \<Longrightarrow> \<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
apply (rule exI[where x="k"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polydivide s p = (k, r); (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)\<rbrakk> \<Longrightarrow> \<exists>r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
apply (rule exI[where x="r"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>polydivide s p = (k, r); (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>nr. isnpolyh r nr) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k - 0 *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)\<rbrakk> \<Longrightarrow> polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
\<exists>k r. polydivide s p = (k, r) \<and> (\<exists>nr. isnpolyh r nr) \<and> (Reflected_Multivariate_Polynomial.degree r = 0 \<or> Reflected_Multivariate_Polynomial.degree r < Reflected_Multivariate_Polynomial.degree p) \<and> (\<exists>q n1. isnpolyh q n1 \<and> head p ^\<^sub>p k *\<^sub>p s = p *\<^sub>p q +\<^sub>p r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma valid_impl: "valid (\<phi> \<rightarrow> \<psi>) = (\<forall>I. (fml_sem I \<phi>) \<subseteq> (fml_sem I \<psi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid (\<phi> \<rightarrow> \<psi>) = (\<forall>I. fml_sem I \<phi> \<subseteq> fml_sem I \<psi>)
[PROOF STEP]
unfolding valid_def Implies_def Or_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>I \<omega>. \<omega> \<in> fml_sem I (! (! \<psi> && ! (! \<phi>)))) = (\<forall>I. fml_sem I \<phi> \<subseteq> fml_sem I \<psi>)
[PROOF STEP]
by auto


[STATEMENT]
theorem LPO_S_subset_LPO_NS: "LPO_S \<subseteq> LPO_NS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LPO_S \<subseteq> LPO_NS
[PROOF STEP]
using WPO_S_subset_WPO_NS
[PROOF STATE]
proof (prove)
using this:
WPO_S \<subseteq> WPO_NS

goal (1 subgoal):
 1. LPO_S \<subseteq> LPO_NS
[PROOF STEP]
unfolding lpo_eq_wpo
[PROOF STATE]
proof (prove)
using this:
WPO_S \<subseteq> WPO_NS

goal (1 subgoal):
 1. WPO_S \<subseteq> WPO_NS
[PROOF STEP]
.


[STATEMENT]
lemma prime_elem_int_abs_iff [simp]:
  fixes p :: int
  shows "prime_elem \<bar>p\<bar> \<longleftrightarrow> prime_elem p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_elem \<bar>p\<bar> = prime_elem p
[PROOF STEP]
using prime_elem_normalize_iff [of p]
[PROOF STATE]
proof (prove)
using this:
prime_elem (normalize p) = prime_elem p

goal (1 subgoal):
 1. prime_elem \<bar>p\<bar> = prime_elem p
[PROOF STEP]
by simp


[STATEMENT]
lemma sum_mod:
  assumes "finite A"
  assumes "\<And>a. a \<in> A \<Longrightarrow> f a mod b = (0::'b::unique_euclidean_semiring)"
  shows "(\<Sum>a\<in>A. f a) mod b = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A mod b = (0::'b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
?a \<in> A \<Longrightarrow> f ?a mod b = (0::'b)

goal (1 subgoal):
 1. sum f A mod b = (0::'b)
[PROOF STEP]
by induct (auto simp add: mod_add_eq [symmetric])


[STATEMENT]
lemma binomial_mono:
  assumes "m \<le> n"
  shows "m choose k \<le> n choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m choose k \<le> n choose k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m choose k \<le> n choose k
[PROOF STEP]
define l where "l = n - m"
[PROOF STATE]
proof (state)
this:
l = n - m

goal (1 subgoal):
 1. m choose k \<le> n choose k
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
m \<le> n
l = n - m
[PROOF STEP]
have n: "n = m + l"
[PROOF STATE]
proof (prove)
using this:
m \<le> n
l = n - m

goal (1 subgoal):
 1. n = m + l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n = m + l

goal (1 subgoal):
 1. m choose k \<le> n choose k
[PROOF STEP]
have "m choose k \<le> (m + l) choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m choose k \<le> m + l choose k
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m choose k \<le> m + 0 choose k
 2. \<And>l. m choose k \<le> m + l choose k \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. m choose k \<le> m + 0 choose k
 2. \<And>l. m choose k \<le> m + l choose k \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m choose k \<le> m + 0 choose k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + 0 choose k

goal (1 subgoal):
 1. \<And>l. m choose k \<le> m + l choose k \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>l. m choose k \<le> m + l choose k \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
case *: (Suc l)
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + l choose k

goal (1 subgoal):
 1. \<And>l. m choose k \<le> m + l choose k \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m choose k \<le> m + Suc l choose k
[PROOF STEP]
proof (cases k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k = 0 \<Longrightarrow> m choose k \<le> m + Suc l choose k
 2. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
k = 0

goal (2 subgoals):
 1. k = 0 \<Longrightarrow> m choose k \<le> m + Suc l choose k
 2. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
k = 0

goal (1 subgoal):
 1. m choose k \<le> m + Suc l choose k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + Suc l choose k

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
case k: (Suc k0)
[PROOF STATE]
proof (state)
this:
k = Suc k0

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
note *
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + l choose k

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + l choose k

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
have "m + l choose k \<le> m + l choose k + (m + l choose k0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m + l choose k \<le> m + l choose k + (m + l choose k0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m + l choose k \<le> m + l choose k + (m + l choose k0)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
m + l choose k \<le> m + l choose k + (m + l choose k0)

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
have "\<dots> = m + Suc l choose k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m + l choose k + (m + l choose k0) = m + Suc l choose k
[PROOF STEP]
by (simp add: k)
[PROOF STATE]
proof (state)
this:
m + l choose k + (m + l choose k0) = m + Suc l choose k

goal (1 subgoal):
 1. \<And>nat. k = Suc nat \<Longrightarrow> m choose k \<le> m + Suc l choose k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
m choose k \<le> m + Suc l choose k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m choose k \<le> m + Suc l choose k

goal (1 subgoal):
 1. m choose k \<le> m + Suc l choose k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + Suc l choose k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + Suc l choose k

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
m choose k \<le> m + l choose k

goal (1 subgoal):
 1. m choose k \<le> n choose k
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
m choose k \<le> m + l choose k

goal (1 subgoal):
 1. m choose k \<le> n choose k
[PROOF STEP]
by (simp only: n)
[PROOF STATE]
proof (state)
this:
m choose k \<le> n choose k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma list_head_butlast:
  assumes "hd xs = v"
  and "length xs > 1"
  shows "hd (butlast xs) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hd (butlast xs) = v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
hd xs = v
1 < length xs

goal (1 subgoal):
 1. hd (butlast xs) = v
[PROOF STEP]
by (metis hd_conv_nth length_butlast length_greater_0_conv less_trans nth_butlast zero_less_diff zero_less_one)


[STATEMENT]
lemma uminus_in_nonpos_Ints_iff: "-x \<in> \<int>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> x \<in> \<nat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- x \<in> \<int>\<^sub>\<le>\<^sub>0) = (x \<in> \<nat>)
[PROOF STEP]
using uminus_in_Nats_iff[of "-x"]
[PROOF STATE]
proof (prove)
using this:
(- (- x) \<in> \<nat>) = (- x \<in> \<int>\<^sub>\<le>\<^sub>0)

goal (1 subgoal):
 1. (- x \<in> \<int>\<^sub>\<le>\<^sub>0) = (x \<in> \<nat>)
[PROOF STEP]
by simp


[STATEMENT]
lemma eventually_natfloor:
  assumes "eventually P (at_top :: nat filter)"
  shows   "eventually (\<lambda>x. P (nat \<lfloor>x\<rfloor>)) (at_top :: real filter)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. P (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. P (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
eventually P sequentially
[PROOF STEP]
obtain N where N: "\<And>n. n \<ge> N \<Longrightarrow> P n"
[PROOF STATE]
proof (prove)
using this:
eventually P sequentially

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> P n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using eventually_at_top_linorder
[PROOF STATE]
proof (prove)
using this:
eventually P sequentially
eventually ?P at_top = (\<exists>N. \<forall>n\<ge>N. ?P n)

goal (1 subgoal):
 1. (\<And>N. (\<And>n. N \<le> n \<Longrightarrow> P n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> P ?n

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. P (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
have "\<forall>n\<ge>real N. P (nat \<lfloor>n\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<ge>real N. P (nat \<lfloor>n\<rfloor>)
[PROOF STEP]
by (intro allI impI N le_nat_floor) simp_all
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>real N. P (nat \<lfloor>n\<rfloor>)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. P (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>real N. P (nat \<lfloor>n\<rfloor>)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. P (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
using eventually_at_top_linorder
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>real N. P (nat \<lfloor>n\<rfloor>)
eventually ?P at_top = (\<exists>N. \<forall>n\<ge>N. ?P n)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. P (nat \<lfloor>x\<rfloor>)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. P (nat \<lfloor>x\<rfloor>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Youngs_inequality_0:
  fixes a::real
  assumes "0 \<le> \<alpha>" "0 \<le> \<beta>" "\<alpha>+\<beta> = 1" "a>0" "b>0"
  shows "a powr \<alpha> * b powr \<beta> \<le> \<alpha>*a + \<beta>*b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b
[PROOF STEP]
have "\<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)
[PROOF STEP]
using assms ln_concave
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<alpha>
0 \<le> \<beta>
\<alpha> + \<beta> = 1
0 < a
0 < b
concave_on {0<..} ln

goal (1 subgoal):
 1. \<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)
[PROOF STEP]
by (simp add: concave_on_iff)
[PROOF STATE]
proof (state)
this:
\<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)

goal (1 subgoal):
 1. a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)

goal (1 subgoal):
 1. a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b
[PROOF STEP]
have "0 < \<alpha> * a + \<beta> * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<alpha> * a + \<beta> * b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<alpha>
0 \<le> \<beta>
\<alpha> + \<beta> = 1
0 < a
0 < b

goal (1 subgoal):
 1. 0 < \<alpha> * a + \<beta> * b
[PROOF STEP]
by (smt (verit) mult_pos_pos split_mult_pos_le)
[PROOF STATE]
proof (state)
this:
0 < \<alpha> * a + \<beta> * b

goal (1 subgoal):
 1. a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)
0 < \<alpha> * a + \<beta> * b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)
0 < \<alpha> * a + \<beta> * b

goal (1 subgoal):
 1. a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<alpha> * ln a + \<beta> * ln b \<le> ln (\<alpha> * a + \<beta> * b)
0 < \<alpha> * a + \<beta> * b
0 \<le> \<alpha>
0 \<le> \<beta>
\<alpha> + \<beta> = 1
0 < a
0 < b

goal (1 subgoal):
 1. a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b
[PROOF STEP]
by (simp add: powr_def mult_exp_exp flip: ln_ge_iff)
[PROOF STATE]
proof (state)
this:
a powr \<alpha> * b powr \<beta> \<le> \<alpha> * a + \<beta> * b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma remove_max_max:
  assumes "l \<noteq> []" "(m, l') = remove_max l"
  shows "m = Max (set l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = Max (SelectionSort_Functional.set l)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []
(m, l') = remove_max l

goal (1 subgoal):
 1. m = Max (SelectionSort_Functional.set l)
[PROOF STEP]
unfolding remove_max_def
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []
(m, l') = foldl f (hd l, []) (tl l)

goal (1 subgoal):
 1. m = Max (SelectionSort_Functional.set l)
[PROOF STEP]
using remove_max_max_lemma[of "hd l" "[]" "tl l"]
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []
(m, l') = foldl f (hd l, []) (tl l)
fst (foldl f (hd l, []) (tl l)) = Max (SelectionSort_Functional.set (hd l # tl l))

goal (1 subgoal):
 1. m = Max (SelectionSort_Functional.set l)
[PROOF STEP]
using fst_conv[of m l']
[PROOF STATE]
proof (prove)
using this:
l \<noteq> []
(m, l') = foldl f (hd l, []) (tl l)
fst (foldl f (hd l, []) (tl l)) = Max (SelectionSort_Functional.set (hd l # tl l))
fst (m, l') = m

goal (1 subgoal):
 1. m = Max (SelectionSort_Functional.set l)
[PROOF STEP]
by simp


[STATEMENT]
lemma finite_lessThan_enatI:
  assumes "m \<noteq> \<infinity>"
  shows "finite {..<m :: enat}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {..<m}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {..<m}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> \<infinity>
[PROOF STEP]
obtain m' where m: "m = enat m'"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> \<infinity>

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

goal (1 subgoal):
 1. finite {..<m}
[PROOF STEP]
have "{..<enat m'} \<subseteq> enat ` {..<m'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {..<enat m'} \<subseteq> enat ` {..<m'}
[PROOF STEP]
by(rule subsetI)(case_tac x, auto)
[PROOF STATE]
proof (state)
this:
{..<enat m'} \<subseteq> enat ` {..<m'}

goal (1 subgoal):
 1. finite {..<m}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{..<enat m'} \<subseteq> enat ` {..<m'}

goal (1 subgoal):
 1. finite {..<m}
[PROOF STEP]
unfolding m
[PROOF STATE]
proof (prove)
using this:
{..<enat m'} \<subseteq> enat ` {..<m'}

goal (1 subgoal):
 1. finite {..<enat m'}
[PROOF STEP]
by(rule finite_subset) simp
[PROOF STATE]
proof (state)
this:
finite {..<m}

goal:
No subgoals!
[PROOF STEP]
qed


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


[STATEMENT]
lemma prime_imp_sigma: "prime (p::nat) \<Longrightarrow> sigma(p) = p+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> sigma p = p + 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. prime p \<Longrightarrow> sigma p = p + 1
[PROOF STEP]
assume "prime (p::nat)"
[PROOF STATE]
proof (state)
this:
prime p

goal (1 subgoal):
 1. prime p \<Longrightarrow> sigma p = p + 1
[PROOF STEP]
hence "p>1 \<and> divisors(p) = {1,p}"
[PROOF STATE]
proof (prove)
using this:
prime p

goal (1 subgoal):
 1. 1 < p \<and> divisors p = {1, p}
[PROOF STEP]
by (simp add: prime_divisors)
[PROOF STATE]
proof (state)
this:
1 < p \<and> divisors p = {1, p}

goal (1 subgoal):
 1. prime p \<Longrightarrow> sigma p = p + 1
[PROOF STEP]
hence "p>1 \<and> sigma(p) = \<Sum> {1,p}"
[PROOF STATE]
proof (prove)
using this:
1 < p \<and> divisors p = {1, p}

goal (1 subgoal):
 1. 1 < p \<and> sigma p = \<Sum> {1, p}
[PROOF STEP]
by (auto simp only: divisors_def)
[PROOF STATE]
proof (state)
this:
1 < p \<and> sigma p = \<Sum> {1, p}

goal (1 subgoal):
 1. prime p \<Longrightarrow> sigma p = p + 1
[PROOF STEP]
thus "sigma(p) = p+1"
[PROOF STATE]
proof (prove)
using this:
1 < p \<and> sigma p = \<Sum> {1, p}

goal (1 subgoal):
 1. sigma p = p + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sigma p = p + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma drop_zip_with: "drop n (zip_with f xs ys) = zip_with f (drop n xs) (drop n ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop n (zip_with f xs ys) = zip_with f (drop n xs) (drop n ys)
[PROOF STEP]
proof (induction f xs ys arbitrary: n rule: zip_with.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>f x xs y ys n. (\<And>n. drop n (zip_with f xs ys) = zip_with f (drop n xs) (drop n ys)) \<Longrightarrow> drop n (zip_with f (x # xs) (y # ys)) = zip_with f (drop n (x # xs)) (drop n (y # ys))
 2. \<And>f uv_ n. drop n (zip_with f [] uv_) = zip_with f (drop n []) (drop n uv_)
 3. \<And>f uu_ n. drop n (zip_with f uu_ []) = zip_with f (drop n uu_) (drop n [])
[PROOF STEP]
case (1 f x xs y ys n)
[PROOF STATE]
proof (state)
this:
drop ?n (zip_with f xs ys) = zip_with f (drop ?n xs) (drop ?n ys)

goal (3 subgoals):
 1. \<And>f x xs y ys n. (\<And>n. drop n (zip_with f xs ys) = zip_with f (drop n xs) (drop n ys)) \<Longrightarrow> drop n (zip_with f (x # xs) (y # ys)) = zip_with f (drop n (x # xs)) (drop n (y # ys))
 2. \<And>f uv_ n. drop n (zip_with f [] uv_) = zip_with f (drop n []) (drop n uv_)
 3. \<And>f uu_ n. drop n (zip_with f uu_ []) = zip_with f (drop n uu_) (drop n [])
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
drop ?n (zip_with f xs ys) = zip_with f (drop ?n xs) (drop ?n ys)

goal (1 subgoal):
 1. drop n (zip_with f (x # xs) (y # ys)) = zip_with f (drop n (x # xs)) (drop n (y # ys))
[PROOF STEP]
by (cases n) simp_all
[PROOF STATE]
proof (state)
this:
drop n (zip_with f (x # xs) (y # ys)) = zip_with f (drop n (x # xs)) (drop n (y # ys))

goal (2 subgoals):
 1. \<And>f uv_ n. drop n (zip_with f [] uv_) = zip_with f (drop n []) (drop n uv_)
 2. \<And>f uu_ n. drop n (zip_with f uu_ []) = zip_with f (drop n uu_) (drop n [])
[PROOF STEP]
qed simp_all


[STATEMENT]
theorem meet_join_absorb: "x \<sqinter> (x \<squnion> y) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> (x \<squnion> y) = x
[PROOF STEP]
proof (rule meetI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. x \<sqsubseteq> x
 2. x \<sqsubseteq> x \<squnion> y
 3. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> x \<squnion> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
show "x \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> x

goal (2 subgoals):
 1. x \<sqsubseteq> x \<squnion> y
 2. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> x \<squnion> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
show "x \<sqsubseteq> x \<squnion> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> x \<squnion> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> x \<squnion> y

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> x \<squnion> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> x \<squnion> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
assume "z \<sqsubseteq> x" and "z \<sqsubseteq> x \<squnion> y"
[PROOF STATE]
proof (state)
this:
z \<sqsubseteq> x
z \<sqsubseteq> x \<squnion> y

goal (1 subgoal):
 1. \<And>z. \<lbrakk>z \<sqsubseteq> x; z \<sqsubseteq> x \<squnion> y\<rbrakk> \<Longrightarrow> z \<sqsubseteq> x
[PROOF STEP]
show "z \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<sqsubseteq> x
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
this:
z \<sqsubseteq> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma incidence_mat_two_index: "i1 < \<v> \<Longrightarrow> i2 < \<v> \<Longrightarrow>
    mat_point_index N {i1, i2} = \<B> index {\<V>s ! i1, \<V>s ! i2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i1 < \<v>; i2 < \<v>\<rbrakk> \<Longrightarrow> mat_point_index N {i1, i2} = \<B> index {\<V>s ! i1, \<V>s ! i2}
[PROOF STEP]
using mat_point_index_two_alt[of  i1 N i2 ] mat_point_index_rep[of "{i1, i2}"] dim_row_is_v
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>i1 < dim_row N; i2 < dim_row N\<rbrakk> \<Longrightarrow> mat_point_index N {i1, i2} = card {j. j < dim_col N \<and> N $$ (i1, j) = 1 \<and> N $$ (i2, j) = 1}
{i1, i2} \<subseteq> {..<\<v>} \<Longrightarrow> mat_point_index N {i1, i2} = \<B> index (!) \<V>s ` {i1, i2}
dim_row N = \<v>

goal (1 subgoal):
 1. \<lbrakk>i1 < \<v>; i2 < \<v>\<rbrakk> \<Longrightarrow> mat_point_index N {i1, i2} = \<B> index {\<V>s ! i1, \<V>s ! i2}
[PROOF STEP]
by (metis (no_types, lifting) empty_subsetI image_empty image_insert insert_subset lessThan_iff)