[STATEMENT]
lemma transpose_transpose:
  fixes xs :: "'a list list"
  assumes sorted: "sorted (rev (map length xs))"
  shows "transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
have len: "length ?L = length ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (transpose (transpose xs)) = length (takeWhile (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
unfolding length_transpose transpose_max_length
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter (\<lambda>x. x \<noteq> []) xs) = length (takeWhile (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
using filter_equals_takeWhile_sorted_rev[OF sorted, of 0]
[PROOF STATE]
proof (prove)
using this:
filter (\<lambda>x. 0 < length x) xs = takeWhile (\<lambda>x. 0 < length x) xs

goal (1 subgoal):
 1. length (filter (\<lambda>x. x \<noteq> []) xs) = length (takeWhile (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (transpose (transpose xs)) = length (takeWhile (\<lambda>x. x \<noteq> []) xs)

goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
length (transpose (transpose xs)) = length (takeWhile (\<lambda>x. x \<noteq> []) xs)

goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
assume "i < length ?R"
[PROOF STATE]
proof (state)
this:
i < length (takeWhile (\<lambda>x. x \<noteq> []) xs)

goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
with less_le_trans[OF _ length_takeWhile_le[of _ xs]]
[PROOF STATE]
proof (chain)
picking this:
?x < length (takeWhile ?P1 xs) \<Longrightarrow> ?x < length xs
i < length (takeWhile (\<lambda>x. x \<noteq> []) xs)
[PROOF STEP]
have "i < length xs"
[PROOF STATE]
proof (prove)
using this:
?x < length (takeWhile ?P1 xs) \<Longrightarrow> ?x < length xs
i < length (takeWhile (\<lambda>x. x \<noteq> []) xs)

goal (1 subgoal):
 1. i < length xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < length xs

goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 < length (takeWhile (\<lambda>x. x \<noteq> []) xs) \<Longrightarrow> ?i2 < length xs

goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
note * = this
[PROOF STATE]
proof (state)
this:
?i2 < length (takeWhile (\<lambda>x. x \<noteq> []) xs) \<Longrightarrow> ?i2 < length xs

goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs
[PROOF STEP]
by (rule nth_equalityI)
       (simp_all add: len nth_transpose transpose_column[OF sorted] * takeWhile_nth)
[PROOF STATE]
proof (state)
this:
transpose (transpose xs) = takeWhile (\<lambda>x. x \<noteq> []) xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_1_approx:
  "n > 0 \<Longrightarrow> \<bar>exp (1::real) - euler_approx n\<bar> \<le> 1 / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<bar>exp 1 - euler_approx n\<bar> \<le> 1 / fact n
[PROOF STEP]
using exp_approx''[of n 1]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < n; 0 \<le> 1; 1 \<le> 1\<rbrakk> \<Longrightarrow> \<bar>exp 1 - (\<Sum>k\<le>n. 1 ^ k / fact k)\<bar> \<le> 1 / fact n

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<bar>exp 1 - euler_approx n\<bar> \<le> 1 / fact n
[PROOF STEP]
by (simp add: euler_approx_def field_split_simps)


[STATEMENT]
lemma pow_generator_eq_iff_cong:
  "finite (carrier G) \<Longrightarrow> \<^bold>g [^] x = \<^bold>g [^] y \<longleftrightarrow> [x = y] (mod order G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier G) \<Longrightarrow> (\<^bold>g [^] x = \<^bold>g [^] y) = [x = y] (mod order G)
[PROOF STEP]
apply(subst (1 2) pow_generator_mod[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (carrier G) \<Longrightarrow> (\<^bold>g [^] (x mod order G) = \<^bold>g [^] (y mod order G)) = [x = y] (mod order G)
[PROOF STEP]
by(auto simp add: cong_def order_gt_0_iff_finite intro: inj_onD[OF inj_on_generator])


[STATEMENT]
lemma map_of_append:
  "map_of ((rev xs) @ ys) = (map_of ys) ((map fst xs) [\<mapsto>] (map snd xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_of (rev xs @ ys) = map_of ys(map fst xs [\<mapsto>] map snd xs)
[PROOF STEP]
apply (induct xs arbitrary: ys)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>ys. map_of (rev [] @ ys) = map_of ys(map fst [] [\<mapsto>] map snd [])
 2. \<And>a xs ys. (\<And>ys. map_of (rev xs @ ys) = map_of ys(map fst xs [\<mapsto>] map snd xs)) \<Longrightarrow> map_of (rev (a # xs) @ ys) = map_of ys(map fst (a # xs) [\<mapsto>] map snd (a # xs))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. map_of (rev xs @ ys) = map_of ys(map fst xs [\<mapsto>] map snd xs)) \<Longrightarrow> map_of (rev (a # xs) @ ys) = map_of ys(map fst (a # xs) [\<mapsto>] map snd (a # xs))
[PROOF STEP]
apply (rename_tac a xs ys)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys. (\<And>ys. map_of (rev xs @ ys) = map_of ys(map fst xs [\<mapsto>] map snd xs)) \<Longrightarrow> map_of (rev (a # xs) @ ys) = map_of ys(map fst (a # xs) [\<mapsto>] map snd (a # xs))
[PROOF STEP]
apply (drule_tac x="a # ys" in meta_spec)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xs ys. map_of (rev xs @ a # ys) = map_of (a # ys)(map fst xs [\<mapsto>] map snd xs) \<Longrightarrow> map_of (rev (a # xs) @ ys) = map_of ys(map fst (a # xs) [\<mapsto>] map snd (a # xs))
[PROOF STEP]
apply (simp only: rev.simps append_assoc append_Cons append_Nil
                    list.map map_of.simps map_upds_Cons list.sel)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma binomial_fact':
  assumes "k \<le> n"
  shows "n choose k = fact n div (fact k * fact (n - k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n choose k = fact n div (fact k * fact (n - k))
[PROOF STEP]
using binomial_fact_lemma [OF assms]
[PROOF STATE]
proof (prove)
using this:
fact k * fact (n - k) * (n choose k) = fact n

goal (1 subgoal):
 1. n choose k = fact n div (fact k * fact (n - k))
[PROOF STEP]
by (metis fact_nonzero mult_eq_0_iff nonzero_mult_div_cancel_left)


[STATEMENT]
lemma new_vert_only_no_arcs:
  assumes "G = \<lparr>verts = V \<union> {v}, arcs = A, tail = t, head = h\<rparr>"
      and "G' = \<lparr>verts = V, arcs = A, tail = t, head = h\<rparr>"
      and "wf_digraph G'"
      and "v \<notin> V"
      and "finite (arcs G)"
    shows "\<forall>u. (v,u) \<notin> arcs_ends G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. (v, u) \<notin> arcs_ends G
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>u. (v, u) \<notin> arcs_ends G
[PROOF STEP]
have "out_degree G' v = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. out_degree G' v = 0
[PROOF STEP]
using assms(2-4) wf_digraph.not_elem_out_0
[PROOF STATE]
proof (prove)
using this:
G' = \<lparr>verts = V, arcs = A, tail = t, head = h\<rparr>
wf_digraph G'
v \<notin> V
\<lbrakk>wf_digraph ?G; ?v \<notin> verts ?G\<rbrakk> \<Longrightarrow> out_degree ?G ?v = 0

goal (1 subgoal):
 1. out_degree G' v = 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
out_degree G' v = 0

goal (1 subgoal):
 1. \<forall>u. (v, u) \<notin> arcs_ends G
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
out_degree G' v = 0
[PROOF STEP]
have "out_degree G v = 0"
[PROOF STATE]
proof (prove)
using this:
out_degree G' v = 0

goal (1 subgoal):
 1. out_degree G v = 0
[PROOF STEP]
unfolding out_degree_def out_arcs_def
[PROOF STATE]
proof (prove)
using this:
card {e \<in> arcs G'. tail G' e = v} = 0

goal (1 subgoal):
 1. card {e \<in> arcs G. tail G e = v} = 0
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
card {e \<in> arcs G'. tail G' e = v} = 0
G = \<lparr>verts = V \<union> {v}, arcs = A, tail = t, head = h\<rparr>
G' = \<lparr>verts = V, arcs = A, tail = t, head = h\<rparr>

goal (1 subgoal):
 1. card {e \<in> arcs G. tail G e = v} = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
out_degree G v = 0

goal (1 subgoal):
 1. \<forall>u. (v, u) \<notin> arcs_ends G
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
out_degree G v = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
out_degree G v = 0

goal (1 subgoal):
 1. \<forall>u. (v, u) \<notin> arcs_ends G
[PROOF STEP]
using assms(5) out_degree_0_no_arcs
[PROOF STATE]
proof (prove)
using this:
out_degree G v = 0
finite (arcs G)
\<lbrakk>out_degree G ?v = 0; finite (arcs G)\<rbrakk> \<Longrightarrow> \<forall>y. (?v, y) \<notin> arcs_ends G

goal (1 subgoal):
 1. \<forall>u. (v, u) \<notin> arcs_ends G
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>u. (v, u) \<notin> arcs_ends G

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma setdist_unique:
  "\<lbrakk>a \<in> S; b \<in> T; \<And>x y. x \<in> S \<and> y \<in> T ==> dist a b \<le> dist x y\<rbrakk>
   \<Longrightarrow> setdist S T = dist a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> S; b \<in> T; \<And>x y. x \<in> S \<and> y \<in> T \<Longrightarrow> dist a b \<le> dist x y\<rbrakk> \<Longrightarrow> setdist S T = dist a b
[PROOF STEP]
by (force simp add: setdist_le_dist le_setdist_iff intro: antisym)


[STATEMENT]
lemma cosh_gt_1 [simp]:
  fixes x ::real
  assumes "x > 0"
  shows "cosh x > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < cosh x
[PROOF STEP]
using assms cosh_real_strict_mono
[PROOF STATE]
proof (prove)
using this:
0 < x
\<lbrakk>0 \<le> ?x; ?x < ?y\<rbrakk> \<Longrightarrow> cosh ?x < cosh ?y

goal (1 subgoal):
 1. 1 < cosh x
[PROOF STEP]
by force


[STATEMENT]
lemma int_of_real_mult:
  assumes "real_is_int a" "real_is_int b"
  shows "(int_of_real (a*b)) = (int_of_real a) * (int_of_real b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_of_real (a * b) = int_of_real a * int_of_real b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
real_is_int a
real_is_int b

goal (1 subgoal):
 1. int_of_real (a * b) = int_of_real a * int_of_real b
[PROOF STEP]
by (auto simp add: real_is_int_def of_int_mult[symmetric]
           simp del: of_int_mult)


[STATEMENT]
lemma real_poly_minus:
  assumes "set (coeffs p) \<subseteq> \<real>" "set (coeffs q) \<subseteq> \<real>"
  shows "set (coeffs (p - q)) \<subseteq> \<real>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (coeffs (p - q)) \<subseteq> \<real>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set (coeffs p) \<subseteq> \<real>
set (coeffs q) \<subseteq> \<real>

goal (1 subgoal):
 1. set (coeffs (p - q)) \<subseteq> \<real>
[PROOF STEP]
unfolding diff_conv_add_uminus
[PROOF STATE]
proof (prove)
using this:
set (coeffs p) \<subseteq> \<real>
set (coeffs q) \<subseteq> \<real>

goal (1 subgoal):
 1. set (coeffs (p + - q)) \<subseteq> \<real>
[PROOF STEP]
by (intro real_poly_uminus real_poly_add, auto)


[STATEMENT]
lemma tendsto_mult_filterlim_at_infinity:
  fixes c :: "'a::real_normed_field"
  assumes  "(f \<longlongrightarrow> c) F" "c \<noteq> 0"
  assumes "filterlim g at_infinity F"
  shows "filterlim (\<lambda>x. f x * g x) at_infinity F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
have "((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * 0) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F
[PROOF STEP]
by (intro tendsto_mult tendsto_inverse assms filterlim_compose[OF tendsto_inverse_0])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F

goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F
[PROOF STEP]
have "filterlim (\<lambda>x. inverse (f x) * inverse (g x)) (at (inverse c * 0)) F"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F

goal (1 subgoal):
 1. LIM x F. inverse (f x) * inverse (g x) :> at (inverse c * (0::'a))
[PROOF STEP]
unfolding filterlim_at
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F

goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. inverse (f x) * inverse (g x) \<in> UNIV \<and> inverse (f x) * inverse (g x) \<noteq> inverse c * (0::'a)) \<and> ((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F
(f \<longlongrightarrow> c) F
c \<noteq> (0::'a)
filterlim g at_infinity F

goal (1 subgoal):
 1. (\<forall>\<^sub>F x in F. inverse (f x) * inverse (g x) \<in> UNIV \<and> inverse (f x) * inverse (g x) \<noteq> inverse c * (0::'a)) \<and> ((\<lambda>x. inverse (f x) * inverse (g x)) \<longlongrightarrow> inverse c * (0::'a)) F
[PROOF STEP]
by (auto intro: filterlim_at_infinity_imp_eventually_ne tendsto_imp_eventually_ne eventually_conj)
[PROOF STATE]
proof (state)
this:
LIM x F. inverse (f x) * inverse (g x) :> at (inverse c * (0::'a))

goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LIM x F. inverse (f x) * inverse (g x) :> at (inverse c * (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
LIM x F. inverse (f x) * inverse (g x) :> at (inverse c * (0::'a))

goal (1 subgoal):
 1. LIM x F. f x * g x :> at_infinity
[PROOF STEP]
by (subst filterlim_inverse_at_iff[symmetric]) simp_all
[PROOF STATE]
proof (state)
this:
LIM x F. f x * g x :> at_infinity

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma invertible_matrix_imp_invertible_lf:
  fixes A::"'a::{field}^'n^'n"
  assumes invertible_A: "invertible A"
  shows "invertible_lf ((*s)) ((*s)) (\<lambda>x. A *v x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_lf (*s) (*s) ((*v) A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. invertible_lf (*s) (*s) ((*v) A)
[PROOF STEP]
obtain B where AB: "A**B=mat 1" and BA: "B**A=mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>A ** B = mat (1::'a); B ** A = mat (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using invertible_A
[PROOF STATE]
proof (prove)
using this:
invertible A

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>A ** B = mat (1::'a); B ** A = mat (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding invertible_def
[PROOF STATE]
proof (prove)
using this:
\<exists>A'. A ** A' = mat (1::'a) \<and> A' ** A = mat (1::'a)

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>A ** B = mat (1::'a); B ** A = mat (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A ** B = mat (1::'a)
B ** A = mat (1::'a)

goal (1 subgoal):
 1. invertible_lf (*s) (*s) ((*v) A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_lf (*s) (*s) ((*v) A)
[PROOF STEP]
proof (rule vec.invertible_lf_intro [of "(\<lambda>x. B *v x)"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (*v) B \<circ> (*v) A = id
 2. (*v) A \<circ> (*v) B = id
[PROOF STEP]
show id1: "(*v) B \<circ> (*v) A = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*v) B \<circ> (*v) A = id
[PROOF STEP]
by (metis (opaque_lifting, no_types) AB BA isomorphism_expand matrix_vector_mul_assoc matrix_vector_mul_lid)
[PROOF STATE]
proof (state)
this:
(*v) B \<circ> (*v) A = id

goal (1 subgoal):
 1. (*v) A \<circ> (*v) B = id
[PROOF STEP]
show "(*v) A \<circ> (*v) B = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*v) A \<circ> (*v) B = id
[PROOF STEP]
by (metis (opaque_lifting, no_types) AB BA isomorphism_expand matrix_vector_mul_assoc matrix_vector_mul_lid)
[PROOF STATE]
proof (state)
this:
(*v) A \<circ> (*v) B = id

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
invertible_lf (*s) (*s) ((*v) A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma power6:
  fixes z :: "'a :: monoid_mult"
  shows "z ^ 6 = z * z * z * z * z * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z ^ 6 = z * z * z * z * z * z
[PROOF STEP]
by (simp add: mult.assoc power3_eq_cube power_numeral_even)


[STATEMENT]
lemma nonneg_Reals_add_I [simp]: "\<lbrakk>a \<in> \<real>\<^sub>\<ge>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a + b \<in> \<real>\<^sub>\<ge>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> \<real>\<^sub>\<ge>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a + b \<in> \<real>\<^sub>\<ge>\<^sub>0
[PROOF STEP]
apply (simp add: nonneg_Reals_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>r. a = of_real r \<and> 0 \<le> r; \<exists>r. b = of_real r \<and> 0 \<le> r\<rbrakk> \<Longrightarrow> \<exists>r. a + b = of_real r \<and> 0 \<le> r
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r ra. \<lbrakk>0 \<le> r; a = of_real r; 0 \<le> ra; b = of_real ra\<rbrakk> \<Longrightarrow> \<exists>rb. of_real r + of_real ra = of_real rb \<and> 0 \<le> rb
[PROOF STEP]
apply (rename_tac r s)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r s. \<lbrakk>0 \<le> r; a = of_real r; 0 \<le> s; b = of_real s\<rbrakk> \<Longrightarrow> \<exists>ra. of_real r + of_real s = of_real ra \<and> 0 \<le> ra
[PROOF STEP]
apply (rule_tac x="r+s" in exI, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bounded_convex_hull:
  fixes s :: "'a::real_normed_vector set"
  assumes "bounded s"
  shows "bounded (convex hull s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (convex hull s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bounded (convex hull s)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
bounded s
[PROOF STEP]
obtain B where B: "\<forall>x\<in>s. norm x \<le> B"
[PROOF STATE]
proof (prove)
using this:
bounded s

goal (1 subgoal):
 1. (\<And>B. \<forall>x\<in>s. norm x \<le> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding bounded_iff
[PROOF STATE]
proof (prove)
using this:
\<exists>a. \<forall>x\<in>s. norm x \<le> a

goal (1 subgoal):
 1. (\<And>B. \<forall>x\<in>s. norm x \<le> B \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>s. norm x \<le> B

goal (1 subgoal):
 1. bounded (convex hull s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded (convex hull s)
[PROOF STEP]
by (simp add: bounded_subset[OF bounded_cball, of _ 0 B] B subsetI subset_hull)
[PROOF STATE]
proof (state)
this:
bounded (convex hull s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isDiagonal_eq_upt_k_max:
"isDiagonal A = isDiagonal_upt_k A (max (nrows A) (ncols A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDiagonal A = isDiagonal_upt_k A (max (nrows A) (ncols A))
[PROOF STEP]
unfolding isDiagonal_def isDiagonal_upt_k_def nrows_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a b. to_nat a \<noteq> to_nat b \<longrightarrow> A $ a $ b = (0::'a)) = (\<forall>a b. to_nat a \<noteq> to_nat b \<and> (to_nat a < max CARD('c) CARD('b) \<or> to_nat b < max CARD('c) CARD('b)) \<longrightarrow> A $ a $ b = (0::'a))
[PROOF STEP]
by (auto simp add: less_max_iff_disj to_nat_less_card)


[STATEMENT]
lemma prime_factorization_unique'':
  assumes "\<forall>p \<in># M. prime p" "\<forall>p \<in># N. prime p" "normalize (\<Prod>i \<in># M. i) = normalize (\<Prod>i \<in># N. i)"
  shows   "M = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. M = N
[PROOF STEP]
have "prime_factorization (normalize (\<Prod>i \<in># M. i)) =
        prime_factorization (normalize (\<Prod>i \<in># N. i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_factorization (normalize (\<Prod>i\<in>#M. i)) = prime_factorization (normalize (\<Prod>i\<in>#N. i))
[PROOF STEP]
by (simp only: assms)
[PROOF STATE]
proof (state)
this:
prime_factorization (normalize (\<Prod>i\<in>#M. i)) = prime_factorization (normalize (\<Prod>i\<in>#N. i))

goal (1 subgoal):
 1. M = N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization (normalize (\<Prod>i\<in>#M. i)) = prime_factorization (normalize (\<Prod>i\<in>#N. i))

goal (1 subgoal):
 1. M = N
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
normalize (\<Prod>i\<in>#M. i) = normalize (\<Prod>i\<in>#N. i)
[PROOF STEP]
have "prime_factorization (normalize (\<Prod>i \<in># M. i)) = M"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
normalize (\<Prod>i\<in>#M. i) = normalize (\<Prod>i\<in>#N. i)

goal (1 subgoal):
 1. prime_factorization (normalize (\<Prod>i\<in>#M. i)) = M
[PROOF STEP]
by (subst prime_factorization_normalize, subst prime_factorization_prod_mset_primes) simp_all
[PROOF STATE]
proof (state)
this:
prime_factorization (normalize (\<Prod>i\<in>#M. i)) = M

goal (1 subgoal):
 1. M = N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prime_factorization (normalize (\<Prod>i\<in>#M. i)) = M

goal (1 subgoal):
 1. M = N
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
normalize (\<Prod>i\<in>#M. i) = normalize (\<Prod>i\<in>#N. i)
[PROOF STEP]
have "prime_factorization (normalize (\<Prod>i \<in># N. i)) = N"
[PROOF STATE]
proof (prove)
using this:
\<forall>p\<in>#M. prime p
\<forall>p\<in>#N. prime p
normalize (\<Prod>i\<in>#M. i) = normalize (\<Prod>i\<in>#N. i)

goal (1 subgoal):
 1. prime_factorization (normalize (\<Prod>i\<in>#N. i)) = N
[PROOF STEP]
by (subst prime_factorization_normalize, subst prime_factorization_prod_mset_primes) simp_all
[PROOF STATE]
proof (state)
this:
prime_factorization (normalize (\<Prod>i\<in>#N. i)) = N

goal (1 subgoal):
 1. M = N
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
M = N
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
M = N

goal (1 subgoal):
 1. M = N
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
M = N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homotopy_eqv_contractible_sets:
  fixes S :: "'a::real_normed_vector set"
    and T :: "'b::real_normed_vector set"
  assumes "contractible S" "contractible T" "S = {} \<longleftrightarrow> T = {}"
    shows "S homotopy_eqv T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
proof (cases "S = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. S = {} \<Longrightarrow> S homotopy_eqv T
 2. S \<noteq> {} \<Longrightarrow> S homotopy_eqv T
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
S = {}

goal (2 subgoals):
 1. S = {} \<Longrightarrow> S homotopy_eqv T
 2. S \<noteq> {} \<Longrightarrow> S homotopy_eqv T
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
contractible S
contractible T
(S = {}) = (T = {})
S = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
contractible S
contractible T
(S = {}) = (T = {})
S = {}

goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
by (simp add: homeomorphic_imp_homotopy_eqv)
[PROOF STATE]
proof (state)
this:
S homotopy_eqv T

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> S homotopy_eqv T
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> S homotopy_eqv T
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
S \<noteq> {}

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> S homotopy_eqv T
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
contractible S
contractible T
(S = {}) = (T = {})
S \<noteq> {}
[PROOF STEP]
obtain a b where "a \<in> S" "b \<in> T"
[PROOF STATE]
proof (prove)
using this:
contractible S
contractible T
(S = {}) = (T = {})
S \<noteq> {}

goal (1 subgoal):
 1. (\<And>a b. \<lbrakk>a \<in> S; b \<in> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<in> S
b \<in> T

goal (1 subgoal):
 1. S \<noteq> {} \<Longrightarrow> S homotopy_eqv T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> S
b \<in> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a \<in> S
b \<in> T

goal (1 subgoal):
 1. S homotopy_eqv T
[PROOF STEP]
unfolding homotopy_equivalent_space_def
[PROOF STATE]
proof (prove)
using this:
a \<in> S
b \<in> T

goal (1 subgoal):
 1. \<exists>f g. continuous_map (top_of_set S) (top_of_set T) f \<and> continuous_map (top_of_set T) (top_of_set S) g \<and> homotopic_with_canon (\<lambda>x. True) S S (g \<circ> f) id \<and> homotopic_with_canon (\<lambda>x. True) T T (f \<circ> g) id
[PROOF STEP]
apply (rule_tac x="\<lambda>x. b" in exI, rule_tac x="\<lambda>x. a" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> S; b \<in> T; a \<in> S; b \<in> T\<rbrakk> \<Longrightarrow> continuous_map (top_of_set S) (top_of_set T) (\<lambda>x. b) \<and> continuous_map (top_of_set T) (top_of_set S) (\<lambda>x. a) \<and> homotopic_with_canon (\<lambda>x. True) S S ((\<lambda>x. a) \<circ> (\<lambda>x. b)) id \<and> homotopic_with_canon (\<lambda>x. True) T T ((\<lambda>x. b) \<circ> (\<lambda>x. a)) id
[PROOF STEP]
apply (intro assms conjI continuous_on_id' homotopic_into_contractible; force)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
S homotopy_eqv T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_edges: "finite {(loc1,s,loc2). s \<in>\<^sub>A summary loc1 loc2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
let ?sums = "(\<Union> ((\<lambda>(loc1,loc2). set_antichain (summary loc1 loc2)) ` UNIV))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
have "finite ?sums"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2))

goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2))
[PROOF STEP]
have "finite ((UNIV::'loc set) \<times> ?sums \<times> (UNIV::'loc set))"
[PROOF STATE]
proof (prove)
using this:
finite (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2))

goal (1 subgoal):
 1. finite (UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV)

goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV)

goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
have "{(loc1,s,loc2). s \<in>\<^sub>A summary loc1 loc2} \<subseteq> ((UNIV::'loc set) \<times> ?sums \<times> (UNIV::'loc set))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2} \<subseteq> UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV
[PROOF STEP]
by (force simp: member_antichain.rep_eq)
[PROOF STATE]
proof (state)
this:
{(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2} \<subseteq> UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV

goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV)
{(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2} \<subseteq> UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV)
{(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2} \<subseteq> UNIV \<times> (\<Union>(loc1, loc2). set_antichain (summary loc1 loc2)) \<times> UNIV

goal (1 subgoal):
 1. finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}
[PROOF STEP]
by (rule rev_finite_subset)
[PROOF STATE]
proof (state)
this:
finite {(loc1, s, loc2). s \<in>\<^sub>A summary loc1 loc2}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powrat_minus:
   "x pow\<^sub>\<rat> (-r) = inverse (x pow\<^sub>\<rat> r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> - r = inverse (x pow\<^sub>\<rat> r)
[PROOF STEP]
proof (cases r)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> - r = inverse (x pow\<^sub>\<rat> r)
[PROOF STEP]
case (Fract a b)
[PROOF STATE]
proof (state)
this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>r = Fract a b; 0 < b; coprime a b\<rbrakk> \<Longrightarrow> x pow\<^sub>\<rat> - r = inverse (x pow\<^sub>\<rat> r)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r = Fract a b
0 < b
coprime a b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
r = Fract a b
0 < b
coprime a b

goal (1 subgoal):
 1. x pow\<^sub>\<rat> - r = inverse (x pow\<^sub>\<rat> r)
[PROOF STEP]
by (auto simp add: powrat_def divide_inverse real_root_inverse
                       quotient_of_Fract zero_less_Fract_iff)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> - r = inverse (x pow\<^sub>\<rat> r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_pow_1_nat:
  "[a ^ x = 1] (mod b)" if "[a = 1] (mod b)" for a b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ x = 1] (mod b)
[PROOF STEP]
using cong_pow [of a 1 b x] that
[PROOF STATE]
proof (prove)
using this:
[a = 1] (mod b) \<Longrightarrow> [a ^ x = 1 ^ x] (mod b)
[a = 1] (mod b)

goal (1 subgoal):
 1. [a ^ x = 1] (mod b)
[PROOF STEP]
by simp


[STATEMENT]
lemma filtermap_at_left_shift: "filtermap (\<lambda>x. x - d) (at_left a) = at_left (a - d)"
  for a d :: "real"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filtermap (\<lambda>x. x - d) (at_left a) = at_left (a - d)
[PROOF STEP]
by (simp add: filter_eq_iff eventually_filtermap eventually_at_filter filtermap_nhds_shift[symmetric])


[STATEMENT]
lemma outer_prod_dim[simp]:
  fixes v w :: "'a::conjugatable_field vec"
  assumes v: "v \<in> carrier_vec n" and w: "w \<in> carrier_vec m"
  shows "outer_prod v w \<in> carrier_mat n m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. outer_prod v w \<in> carrier_mat n m
[PROOF STEP]
unfolding outer_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y) \<in> carrier_mat n m
[PROOF STEP]
using assms mat_of_cols_carrier mat_of_rows_carrier
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
w \<in> carrier_vec m
mat_of_cols ?n ?vs \<in> carrier_mat ?n (length ?vs)
dim_row (mat_of_cols ?n ?vs) = ?n
dim_col (mat_of_cols ?n ?vs) = length ?vs
mat_of_rows ?n ?vs \<in> carrier_mat (length ?vs) ?n
dim_row (mat_of_rows ?n ?vs) = length ?vs
dim_col (mat_of_rows ?n ?vs) = ?n

goal (1 subgoal):
 1. mat (dim_vec v) 1 (\<lambda>(i, j). v $ i) * mat 1 (dim_vec w) (\<lambda>(i, y). conjugate w $ y) \<in> carrier_mat n m
[PROOF STEP]
by auto


[STATEMENT]
theorem expressive_completeness:
    assumes "finite (supp S)"
    and "\<And>P Q. P \<in> S \<Longrightarrow> P \<sim>\<cdot> Q \<Longrightarrow> Q \<in> S"
    shows "P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) \<longleftrightarrow> P \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
let ?B = "characteristic_formula ` S"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
have "?B \<subseteq> characteristic_formula ` UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. characteristic_formula ` S \<subseteq> range characteristic_formula
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
characteristic_formula ` S \<subseteq> range characteristic_formula

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
characteristic_formula ` S \<subseteq> range characteristic_formula
[PROOF STEP]
have "|?B| \<le>o |UNIV :: 'state set|"
[PROOF STATE]
proof (prove)
using this:
characteristic_formula ` S \<subseteq> range characteristic_formula

goal (1 subgoal):
 1. |characteristic_formula ` S| \<le>o |UNIV|
[PROOF STEP]
by (rule surj_imp_ordLeq)
[PROOF STATE]
proof (state)
this:
|characteristic_formula ` S| \<le>o |UNIV|

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
|characteristic_formula ` S| \<le>o |UNIV|

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
have "|UNIV :: 'state set| <o |UNIV :: 'idx set|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |UNIV| <o |UNIV|
[PROOF STEP]
by (metis card_idx_state)
[PROOF STATE]
proof (state)
this:
|UNIV| <o |UNIV|

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
|UNIV| <o |UNIV|

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
have "|UNIV :: 'idx set| \<le>o natLeq +c |UNIV :: 'idx set|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |UNIV| \<le>o natLeq +c |UNIV|
[PROOF STEP]
by (metis Cnotzero_UNIV ordLeq_csum2)
[PROOF STATE]
proof (state)
this:
|UNIV| \<le>o natLeq +c |UNIV|

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
|characteristic_formula ` S| <o natLeq +c |UNIV|
[PROOF STEP]
have card_B: "|?B| <o natLeq +c |UNIV :: 'idx set|"
[PROOF STATE]
proof (prove)
using this:
|characteristic_formula ` S| <o natLeq +c |UNIV|

goal (1 subgoal):
 1. |characteristic_formula ` S| <o natLeq +c |UNIV|
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
|characteristic_formula ` S| <o natLeq +c |UNIV|

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
have "eqvt image" and "eqvt characteristic_formula"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eqvt (`) &&& eqvt characteristic_formula
[PROOF STEP]
by (simp add: eqvtI)+
[PROOF STATE]
proof (state)
this:
eqvt (`)
eqvt characteristic_formula

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eqvt (`)
eqvt characteristic_formula
[PROOF STEP]
have "supp ?B \<subseteq> supp S"
[PROOF STATE]
proof (prove)
using this:
eqvt (`)
eqvt characteristic_formula

goal (1 subgoal):
 1. supp (characteristic_formula ` S) \<subseteq> supp S
[PROOF STEP]
using supp_fun_eqvt supp_fun_app supp_fun_app_eqvt
[PROOF STATE]
proof (prove)
using this:
eqvt (`)
eqvt characteristic_formula
eqvt ?f \<Longrightarrow> supp ?f = {}
supp (?f ?x) \<subseteq> supp ?f \<union> supp ?x
eqvt ?f \<Longrightarrow> supp (?f ?x) \<subseteq> supp ?x

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

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
with card_B
[PROOF STATE]
proof (chain)
picking this:
|characteristic_formula ` S| <o natLeq +c |UNIV|
supp (characteristic_formula ` S) \<subseteq> supp S
[PROOF STEP]
have "supp (Abs_bset ?B :: _ set['idx]) \<subseteq> supp S"
[PROOF STATE]
proof (prove)
using this:
|characteristic_formula ` S| <o natLeq +c |UNIV|
supp (characteristic_formula ` S) \<subseteq> supp S

goal (1 subgoal):
 1. supp (Abs_bset (characteristic_formula ` S)) \<subseteq> supp S
[PROOF STEP]
using supp_Abs_bset
[PROOF STATE]
proof (prove)
using this:
|characteristic_formula ` S| <o natLeq +c |UNIV|
supp (characteristic_formula ` S) \<subseteq> supp S
|?A| <o natLeq +c |UNIV| \<Longrightarrow> supp (Abs_bset ?A) = supp ?A

goal (1 subgoal):
 1. supp (Abs_bset (characteristic_formula ` S)) \<subseteq> supp S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
supp (Abs_bset (characteristic_formula ` S)) \<subseteq> supp S

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
with \<open>finite (supp S)\<close>
[PROOF STATE]
proof (chain)
picking this:
finite (supp S)
supp (Abs_bset (characteristic_formula ` S)) \<subseteq> supp S
[PROOF STEP]
have "finite (supp (Abs_bset ?B :: _ set['idx]))"
[PROOF STATE]
proof (prove)
using this:
finite (supp S)
supp (Abs_bset (characteristic_formula ` S)) \<subseteq> supp S

goal (1 subgoal):
 1. finite (supp (Abs_bset (characteristic_formula ` S)))
[PROOF STEP]
using finite_supp rev_finite_subset
[PROOF STATE]
proof (prove)
using this:
finite (supp S)
supp (Abs_bset (characteristic_formula ` S)) \<subseteq> supp S
finite (supp ?x)
\<lbrakk>finite ?B; ?A \<subseteq> ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite (supp (Abs_bset (characteristic_formula ` S)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite (supp (Abs_bset (characteristic_formula ` S)))

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
with card_B
[PROOF STATE]
proof (chain)
picking this:
|characteristic_formula ` S| <o natLeq +c |UNIV|
finite (supp (Abs_bset (characteristic_formula ` S)))
[PROOF STEP]
have "P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) \<longleftrightarrow> (\<exists>x\<in>?B. P \<Turnstile> x)"
[PROOF STATE]
proof (prove)
using this:
|characteristic_formula ` S| <o natLeq +c |UNIV|
finite (supp (Abs_bset (characteristic_formula ` S)))

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (\<exists>x\<in>characteristic_formula ` S. P \<Turnstile> x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (\<exists>x\<in>characteristic_formula ` S. P \<Turnstile> x)

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
with \<open>\<And>P Q. P \<in> S \<Longrightarrow> P \<sim>\<cdot> Q \<Longrightarrow> Q \<in> S\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?P \<in> S; ?P \<sim>\<cdot> ?Q\<rbrakk> \<Longrightarrow> ?Q \<in> S
P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (\<exists>x\<in>characteristic_formula ` S. P \<Turnstile> x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P \<in> S; ?P \<sim>\<cdot> ?Q\<rbrakk> \<Longrightarrow> ?Q \<in> S
P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (\<exists>x\<in>characteristic_formula ` S. P \<Turnstile> x)

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
using characteristic_formula_is_characteristic characteristic_formula_is_characteristic' logically_equivalent_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P \<in> S; ?P \<sim>\<cdot> ?Q\<rbrakk> \<Longrightarrow> ?Q \<in> S
P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (\<exists>x\<in>characteristic_formula ` S. P \<Turnstile> x)
?Q \<Turnstile> characteristic_formula ?P = ?P \<sim>\<cdot> ?Q
?Q \<Turnstile> characteristic_formula ?P = (?P =\<cdot> ?Q)
?P =\<cdot> ?Q \<equiv> \<forall>x. ?P \<Turnstile> x = ?Q \<Turnstile> x

goal (1 subgoal):
 1. P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
P \<Turnstile> Disj (Abs_bset (characteristic_formula ` S)) = (P \<in> S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma square_nneg_complex:
  fixes x :: complex
  assumes "x \<in> \<real>" shows "x^2 \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x\<^sup>2
[PROOF STEP]
apply (cases x)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2. x = Complex x1 x2 \<Longrightarrow> 0 \<le> x\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> \<real>

goal (1 subgoal):
 1. \<And>x1 x2. x = Complex x1 x2 \<Longrightarrow> 0 \<le> x\<^sup>2
[PROOF STEP]
unfolding Reals_def less_eq_complex_def
[PROOF STATE]
proof (prove)
using this:
x \<in> range complex_of_real

goal (1 subgoal):
 1. \<And>x1 x2. x = Complex x1 x2 \<Longrightarrow> Re 0 \<le> Re (x\<^sup>2) \<and> Im 0 = Im (x\<^sup>2)
[PROOF STEP]
by auto


[STATEMENT]
lemma bf_imp_alt: "bf_imp a b = bf_or (bf_not a) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bf_imp a b = bf_or (bf_not a) b
[PROOF STEP]
unfolding bf_or_def bf_not_def bf_imp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bf_ite a b bf_True = bf_ite (bf_ite a bf_False bf_True) bf_True b
[PROOF STEP]
unfolding bf_ite_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>l. if a l then b l else True) = (\<lambda>l. if if a l then False else True then True else b l)
[PROOF STEP]
unfolding fun_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. (if a x then b x else True) = (if if a x then False else True then True else b x)
[PROOF STEP]
by simp


[STATEMENT]
lemma flowsto_union:
  assumes 1: "flowsto X0 T CX Y" and 2: "flowsto Z S CZ W"
  shows "flowsto (X0 \<union> Z) (T \<union> S) (CX \<union> CZ) (Y \<union> W)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. flowsto (X0 \<union> Z) (T \<union> S) (CX \<union> CZ) (Y \<union> W)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
flowsto X0 T CX Y
flowsto Z S CZ W

goal (1 subgoal):
 1. flowsto (X0 \<union> Z) (T \<union> S) (CX \<union> CZ) (Y \<union> W)
[PROOF STEP]
unfolding flowsto_def
[PROOF STATE]
proof (prove)
using this:
\<forall>(x0, d0)\<in>X0. \<exists>h\<in>T. h \<in> existence_ivl0 x0 \<and> (flow0 x0 h, Dflow x0 h o\<^sub>L d0) \<in> Y \<and> (\<forall>h'\<in>{0<--<h}. (flow0 x0 h', Dflow x0 h' o\<^sub>L d0) \<in> CX)
\<forall>(x0, d0)\<in>Z. \<exists>h\<in>S. h \<in> existence_ivl0 x0 \<and> (flow0 x0 h, Dflow x0 h o\<^sub>L d0) \<in> W \<and> (\<forall>h'\<in>{0<--<h}. (flow0 x0 h', Dflow x0 h' o\<^sub>L d0) \<in> CZ)

goal (1 subgoal):
 1. \<forall>(x0, d0)\<in>X0 \<union> Z. \<exists>h\<in>T \<union> S. h \<in> existence_ivl0 x0 \<and> (flow0 x0 h, Dflow x0 h o\<^sub>L d0) \<in> Y \<union> W \<and> (\<forall>h'\<in>{0<--<h}. (flow0 x0 h', Dflow x0 h' o\<^sub>L d0) \<in> CX \<union> CZ)
[PROOF STEP]
by force


[STATEMENT]
lemma closed_Collect_eq_isCont:
  fixes f g :: "'a :: t2_space \<Rightarrow> 'b::t2_space"
  assumes f: "\<And>x. isCont f x" and g: "\<And>x. isCont g x"
  shows "closed {x. f x = g x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. f x = g x}
[PROOF STEP]
by (intro closed_Collect_eq continuous_at_imp_continuous_on ballI assms)


[STATEMENT]
lemma mult_right_eq:
  assumes "dim_vec x = dim_vec c"
    and "[y \<^sub>v* A]=c"
  shows "(A\<^sup>T *\<^sub>v y) \<bullet> x = c \<bullet> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A\<^sup>T *\<^sub>v y) \<bullet> x = c \<bullet> x
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. (A\<^sup>T *\<^sub>v y) $ i * x $ i) = (\<Sum>i = 0..<dim_vec x. c $ i * x $ i)
[PROOF STEP]
using atLeastLessThan_iff[of _ 0 "dim_vec x"] vec_times_mat_eq_def[of y A c]
    sum.cong[of _ _ "\<lambda>i. (A\<^sup>T *\<^sub>v y) $ i * x $ i" "\<lambda>i. c $ i * x $ i"]
[PROOF STATE]
proof (prove)
using this:
(?i \<in> {0..<dim_vec x}) = (0 \<le> ?i \<and> ?i < dim_vec x)
[y\<^sub>v*A]=c = ((\<forall>i<dim_vec c. (A\<^sup>T *\<^sub>v y) $ i = c $ i) \<and> dim_col A\<^sup>T = dim_vec y \<and> dim_row A\<^sup>T = dim_vec c)
\<lbrakk>?A = ?B; \<And>xa. xa \<in> ?B \<Longrightarrow> (A\<^sup>T *\<^sub>v y) $ xa * x $ xa = c $ xa * x $ xa\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>?A. (A\<^sup>T *\<^sub>v y) $ i * x $ i) = (\<Sum>i\<in>?B. c $ i * x $ i)

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec x. (A\<^sup>T *\<^sub>v y) $ i * x $ i) = (\<Sum>i = 0..<dim_vec x. c $ i * x $ i)
[PROOF STEP]
by (metis (mono_tags, lifting) assms(1) assms(2))


[STATEMENT]
lemma root_abs_power: "n > 0 \<Longrightarrow> abs (root n (y ^n)) = abs y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<bar>root n (y ^ n)\<bar> = \<bar>y\<bar>
[PROOF STEP]
using root_sgn_power [of n]
[PROOF STATE]
proof (prove)
using this:
0 < n \<Longrightarrow> root n (sgn ?y * \<bar>?y\<bar> ^ n) = ?y

goal (1 subgoal):
 1. 0 < n \<Longrightarrow> \<bar>root n (y ^ n)\<bar> = \<bar>y\<bar>
[PROOF STEP]
by (metis abs_ge_zero power_abs real_root_abs real_root_power_cancel)


[STATEMENT]
lemma diag_block_mat_commute:
  assumes "length Al = length Bl"
  and "\<forall>i < length Al. Al!i * (Bl!i) = Bl!i * (Al!i)"
  and "\<forall>i<length Al. dim_col (Al ! i) = dim_row (Bl ! i)"
  and "\<forall>i<length Al. dim_col (Bl ! i) = dim_row (Al ! i)"
shows "diag_block_mat Al * (diag_block_mat Bl) =
  diag_block_mat Bl * (diag_block_mat Al)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
have "diag_block_mat Al * diag_block_mat Bl =
    diag_block_mat (map2 (*) Al Bl)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat (map2 (*) Al Bl)
[PROOF STEP]
using diag_block_mat_mult[of Al Bl] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length Al = length Bl; \<forall>i<length Al. dim_col (Al ! i) = dim_row (Bl ! i)\<rbrakk> \<Longrightarrow> diag_block_mat Al * diag_block_mat Bl = diag_block_mat (map2 (*) Al Bl)
length Al = length Bl
\<forall>i<length Al. Al ! i * Bl ! i = Bl ! i * Al ! i
\<forall>i<length Al. dim_col (Al ! i) = dim_row (Bl ! i)
\<forall>i<length Al. dim_col (Bl ! i) = dim_row (Al ! i)

goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat (map2 (*) Al Bl)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat Al * diag_block_mat Bl = diag_block_mat (map2 (*) Al Bl)

goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
diag_block_mat Al * diag_block_mat Bl = diag_block_mat (map2 (*) Al Bl)

goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
have "... = diag_block_mat (map2 (*) Bl Al)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map2 (*) Al Bl) = diag_block_mat (map2 (*) Bl Al)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. diag_block_mat (map2 (*) Al Bl) = diag_block_mat (map2 (*) Bl Al)
[PROOF STEP]
have "map2 (*) Al Bl = map2 (*) Bl Al"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map2 (*) Al Bl = map2 (*) Bl Al
[PROOF STEP]
by (rule map2_commute, auto simp add: assms)
[PROOF STATE]
proof (state)
this:
map2 (*) Al Bl = map2 (*) Bl Al

goal (1 subgoal):
 1. diag_block_mat (map2 (*) Al Bl) = diag_block_mat (map2 (*) Bl Al)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
map2 (*) Al Bl = map2 (*) Bl Al

goal (1 subgoal):
 1. diag_block_mat (map2 (*) Al Bl) = diag_block_mat (map2 (*) Bl Al)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat (map2 (*) Al Bl) = diag_block_mat (map2 (*) Bl Al)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
diag_block_mat (map2 (*) Al Bl) = diag_block_mat (map2 (*) Bl Al)

goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
diag_block_mat (map2 (*) Al Bl) = diag_block_mat (map2 (*) Bl Al)

goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
have "... = diag_block_mat Bl * (diag_block_mat Al)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diag_block_mat (map2 (*) Bl Al) = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
using diag_block_mat_mult[of Bl Al] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>length Bl = length Al; \<forall>i<length Bl. dim_col (Bl ! i) = dim_row (Al ! i)\<rbrakk> \<Longrightarrow> diag_block_mat Bl * diag_block_mat Al = diag_block_mat (map2 (*) Bl Al)
length Al = length Bl
\<forall>i<length Al. Al ! i * Bl ! i = Bl ! i * Al ! i
\<forall>i<length Al. dim_col (Al ! i) = dim_row (Bl ! i)
\<forall>i<length Al. dim_col (Bl ! i) = dim_row (Al ! i)

goal (1 subgoal):
 1. diag_block_mat (map2 (*) Bl Al) = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
diag_block_mat (map2 (*) Bl Al) = diag_block_mat Bl * diag_block_mat Al

goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al

goal (1 subgoal):
 1. diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
diag_block_mat Al * diag_block_mat Bl = diag_block_mat Bl * diag_block_mat Al

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bezout_lemma_nat:
  fixes d::nat
  shows "\<lbrakk>d dvd a; d dvd b; a * x = b * y + d \<or> b * x = a * y + d\<rbrakk>
    \<Longrightarrow> \<exists>x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d dvd a; d dvd b; a * x = b * y + d \<or> b * x = a * y + d\<rbrakk> \<Longrightarrow> \<exists>x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>d dvd a; d dvd b; a * x = b * y + d\<rbrakk> \<Longrightarrow> \<exists>x y. a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d
 2. \<lbrakk>d dvd a; d dvd b; b * x = a * y + d\<rbrakk> \<Longrightarrow> \<exists>x y. a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d
[PROOF STEP]
apply (metis add_mult_distrib2 left_add_mult_distrib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d dvd a; d dvd b; b * x = a * y + d\<rbrakk> \<Longrightarrow> \<exists>x y. a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d
[PROOF STEP]
apply (rule_tac x=x in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d dvd a; d dvd b; b * x = a * y + d\<rbrakk> \<Longrightarrow> \<exists>y. a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d
[PROOF STEP]
by (metis add_mult_distrib2 mult.commute add.assoc)


[STATEMENT]
lemma alt_group_carrier: "p \<in> carrier (alt_group n) \<longleftrightarrow> p permutes {1..n} \<and> evenperm p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in> carrier (alt_group n)) = (p permutes {1..n} \<and> evenperm p)
[PROOF STEP]
unfolding alt_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in> carrier (sym_group n\<lparr>carrier := {p. p permutes {1..n} \<and> evenperm p}\<rparr>)) = (p permutes {1..n} \<and> evenperm p)
[PROOF STEP]
by auto


[STATEMENT]
lemma postorder_reflect: "postorder (reflect t) = rev (preorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. postorder (reflect t) = rev (preorder t)
[PROOF STEP]
apply (induct t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. postorder (reflect Lf) = rev (preorder Lf)
 2. \<And>x1 t1 t2. \<lbrakk>postorder (reflect t1) = rev (preorder t1); postorder (reflect t2) = rev (preorder t2)\<rbrakk> \<Longrightarrow> postorder (reflect (Br x1 t1 t2)) = rev (preorder (Br x1 t1 t2))
[PROOF STEP]
apply (metis Nil_is_rev_conv postorder.simps(1) preorder.simps(1)
              reflect.simps(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 t1 t2. \<lbrakk>postorder (reflect t1) = rev (preorder t1); postorder (reflect t2) = rev (preorder t2)\<rbrakk> \<Longrightarrow> postorder (reflect (Br x1 t1 t2)) = rev (preorder (Br x1 t1 t2))
[PROOF STEP]
by (metis preorder_reflect reflect_reflect_ident rev_swap)


[STATEMENT]
lemma finite_Stars_Append:
  assumes "finite Vs1" "finite Vs2"
  shows "finite (Stars_Append Vs1 Vs2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite Vs1
finite Vs2

goal (1 subgoal):
 1. finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>finite Vs1; finite Vs2\<rbrakk> \<Longrightarrow> finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
define UVs1 where "UVs1 \<equiv> Stars -` Vs1"
[PROOF STATE]
proof (state)
this:
UVs1 \<equiv> Stars -` Vs1

goal (1 subgoal):
 1. \<lbrakk>finite Vs1; finite Vs2\<rbrakk> \<Longrightarrow> finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
define UVs2 where "UVs2 \<equiv> Stars -` Vs2"
[PROOF STATE]
proof (state)
this:
UVs2 \<equiv> Stars -` Vs2

goal (1 subgoal):
 1. \<lbrakk>finite Vs1; finite Vs2\<rbrakk> \<Longrightarrow> finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite Vs1
finite Vs2
[PROOF STEP]
have "finite UVs1" "finite UVs2"
[PROOF STATE]
proof (prove)
using this:
finite Vs1
finite Vs2

goal (1 subgoal):
 1. finite UVs1 &&& finite UVs2
[PROOF STEP]
unfolding UVs1_def UVs2_def
[PROOF STATE]
proof (prove)
using this:
finite Vs1
finite Vs2

goal (1 subgoal):
 1. finite (Stars -` Vs1) &&& finite (Stars -` Vs2)
[PROOF STEP]
by(simp_all add: finite_vimageI inj_on_def)
[PROOF STATE]
proof (state)
this:
finite UVs1
finite UVs2

goal (1 subgoal):
 1. \<lbrakk>finite Vs1; finite Vs2\<rbrakk> \<Longrightarrow> finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite UVs1
finite UVs2
[PROOF STEP]
have "finite ((\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2))"
[PROOF STATE]
proof (prove)
using this:
finite UVs1
finite UVs2

goal (1 subgoal):
 1. finite ((\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2))

goal (1 subgoal):
 1. \<lbrakk>finite Vs1; finite Vs2\<rbrakk> \<Longrightarrow> finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite ((\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2))

goal (1 subgoal):
 1. \<lbrakk>finite Vs1; finite Vs2\<rbrakk> \<Longrightarrow> finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
have "Stars_Append Vs1 Vs2 = (\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Stars_Append Vs1 Vs2 = (\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2)
[PROOF STEP]
unfolding Stars_Append_def UVs1_def UVs2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {Stars (vs1 @ vs2) |vs1 vs2. Stars vs1 \<in> Vs1 \<and> Stars vs2 \<in> Vs2} = (\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (Stars -` Vs1 \<times> Stars -` Vs2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Stars_Append Vs1 Vs2 = (\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2)

goal (1 subgoal):
 1. \<lbrakk>finite Vs1; finite Vs2\<rbrakk> \<Longrightarrow> finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite ((\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2))
Stars_Append Vs1 Vs2 = (\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2)
[PROOF STEP]
show "finite (Stars_Append Vs1 Vs2)"
[PROOF STATE]
proof (prove)
using this:
finite ((\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2))
Stars_Append Vs1 Vs2 = (\<lambda>(vs1, vs2). Stars (vs1 @ vs2)) ` (UVs1 \<times> UVs2)

goal (1 subgoal):
 1. finite (Stars_Append Vs1 Vs2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (Stars_Append Vs1 Vs2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rhs_altdef: "rhs = 2 ^ T * (\<Prod>i=1..n. 2 ^ i - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
have "rhs = (\<Prod>i<n. 2 ^ i * (2 ^ (n - i) - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rhs = (\<Prod>i<n. 2 ^ i * (2 ^ (n - i) - 1))
[PROOF STEP]
by (simp add: rhs_def algebra_simps flip: power_add)
[PROOF STATE]
proof (state)
this:
rhs = (\<Prod>i<n. 2 ^ i * (2 ^ (n - i) - 1))

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rhs = (\<Prod>i<n. 2 ^ i * (2 ^ (n - i) - 1))

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
have "\<dots> = 2 ^ (\<Sum>i<n. i) * (\<Prod>i<n. 2 ^ (n - i) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i<n. 2 ^ i * (2 ^ (n - i) - 1)) = 2 ^ \<Sum> {..<n} * (\<Prod>i<n. 2 ^ (n - i) - 1)
[PROOF STEP]
by (simp add: prod.distrib power_sum)
[PROOF STATE]
proof (state)
this:
(\<Prod>i<n. 2 ^ i * (2 ^ (n - i) - 1)) = 2 ^ \<Sum> {..<n} * (\<Prod>i<n. 2 ^ (n - i) - 1)

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i<n. 2 ^ i * (2 ^ (n - i) - 1)) = 2 ^ \<Sum> {..<n} * (\<Prod>i<n. 2 ^ (n - i) - 1)

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
have "(\<Sum>i<n. i) = T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {..<n} = T
[PROOF STEP]
unfolding T_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {..<n} = n * (n - 1) div 2
[PROOF STEP]
using Sum_Ico_nat[of 0 n]
[PROOF STATE]
proof (prove)
using this:
\<Sum> {0..<n} = (n * (n - 1) - 0 * (0 - 1)) div 2

goal (1 subgoal):
 1. \<Sum> {..<n} = n * (n - 1) div 2
[PROOF STEP]
by (simp add: atLeast0LessThan)
[PROOF STATE]
proof (state)
this:
\<Sum> {..<n} = T

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sum> {..<n} = T

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
have "(\<Prod>i<n. 2 ^ (n - i) - 1) = (\<Prod>i=1..n. 2 ^ i - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i<n. (2::'a) ^ (n - i) - (1::'a)) = (\<Prod>i = 1..n. (2::'a) ^ i - (1::'a))
[PROOF STEP]
by (rule prod.reindex_bij_witness[of _ "\<lambda>i. n - i" "\<lambda>i. n - i"]) auto
[PROOF STATE]
proof (state)
this:
(\<Prod>i<n. (2::?'a1) ^ (n - i) - (1::?'a1)) = (\<Prod>i = 1..n. (2::?'a1) ^ i - (1::?'a1))

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)

goal (1 subgoal):
 1. rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rhs = 2 ^ T * (\<Prod>i = 1..n. 2 ^ i - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_diff [tendsto_intros]:
  fixes a b :: "'a::topological_group_add"
  shows "(f \<longlongrightarrow> a) F \<Longrightarrow> (g \<longlongrightarrow> b) F \<Longrightarrow> ((\<lambda>x. f x - g x) \<longlongrightarrow> a - b) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) \<longlongrightarrow> a - b) F
[PROOF STEP]
using tendsto_add [of f a F "\<lambda>x. - g x" "- b"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(f \<longlongrightarrow> a) F; ((\<lambda>x. - g x) \<longlongrightarrow> - b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + - g x) \<longlongrightarrow> a + - b) F

goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> a) F; (g \<longlongrightarrow> b) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) \<longlongrightarrow> a - b) F
[PROOF STEP]
by (simp add: tendsto_minus)


[STATEMENT]
lemma Hilbert_fun_cone_nonempty:
  assumes "h \<in> P[X]" and "h \<noteq> 0" and "U \<subseteq> X" and "homogeneous (h::_ \<Rightarrow>\<^sub>0 'a::field)" and "U \<noteq> {}"
  shows "Hilbert_fun (cone (h, U)) z =
          (if poly_deg h \<le> z then ((z - poly_deg h) + (card U - 1)) choose (card U - 1) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
proof (cases "poly_deg h \<le> z")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
poly_deg h \<le> z

goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
from assms(3) fin_X
[PROOF STATE]
proof (chain)
picking this:
U \<subseteq> X
finite X
[PROOF STEP]
have "finite U"
[PROOF STATE]
proof (prove)
using this:
U \<subseteq> X
finite X

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

goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
from assms(1-4)
[PROOF STATE]
proof (chain)
picking this:
h \<in> P[X]
h \<noteq> 0
U \<subseteq> X
homogeneous h
[PROOF STEP]
have "Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}"
[PROOF STATE]
proof (prove)
using this:
h \<in> P[X]
h \<noteq> 0
U \<subseteq> X
homogeneous h

goal (1 subgoal):
 1. Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}
[PROOF STEP]
by (rule Hilbert_fun_cone_aux)
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}

goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}

goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
poly_deg h \<le> z
[PROOF STEP]
have "{t \<in> .[U]. deg_pm t + poly_deg h = z} = deg_sect U (z - poly_deg h)"
[PROOF STATE]
proof (prove)
using this:
poly_deg h \<le> z

goal (1 subgoal):
 1. {t \<in> .[U]. deg_pm t + poly_deg h = z} = deg_sect U (z - poly_deg h)
[PROOF STEP]
by (auto simp: deg_sect_def)
[PROOF STATE]
proof (state)
this:
{t \<in> .[U]. deg_pm t + poly_deg h = z} = deg_sect U (z - poly_deg h)

goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{t \<in> .[U]. deg_pm t + poly_deg h = z} = deg_sect U (z - poly_deg h)

goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
from \<open>finite U\<close> assms(5)
[PROOF STATE]
proof (chain)
picking this:
finite U
U \<noteq> {}
[PROOF STEP]
have "card \<dots> = (z - poly_deg h) + (card U - 1) choose (card U - 1)"
[PROOF STATE]
proof (prove)
using this:
finite U
U \<noteq> {}

goal (1 subgoal):
 1. card (deg_sect U (z - poly_deg h)) = z - poly_deg h + (card U - 1) choose (card U - 1)
[PROOF STEP]
by (rule card_deg_sect)
[PROOF STATE]
proof (state)
this:
card (deg_sect U (z - poly_deg h)) = z - poly_deg h + (card U - 1) choose (card U - 1)

goal (2 subgoals):
 1. poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
 2. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Hilbert_fun (cone (h, U)) z = z - poly_deg h + (card U - 1) choose (card U - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Hilbert_fun (cone (h, U)) z = z - poly_deg h + (card U - 1) choose (card U - 1)

goal (1 subgoal):
 1. Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
by (simp add: True)
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> poly_deg h \<le> z

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
from assms(1-4)
[PROOF STATE]
proof (chain)
picking this:
h \<in> P[X]
h \<noteq> 0
U \<subseteq> X
homogeneous h
[PROOF STEP]
have "Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}"
[PROOF STATE]
proof (prove)
using this:
h \<in> P[X]
h \<noteq> 0
U \<subseteq> X
homogeneous h

goal (1 subgoal):
 1. Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}
[PROOF STEP]
by (rule Hilbert_fun_cone_aux)
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, U)) z = card {t \<in> .[U]. deg_pm t + poly_deg h = z}

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
from False
[PROOF STATE]
proof (chain)
picking this:
\<not> poly_deg h \<le> z
[PROOF STEP]
have "{t \<in> .[U]. deg_pm t + poly_deg h = z} = {}"
[PROOF STATE]
proof (prove)
using this:
\<not> poly_deg h \<le> z

goal (1 subgoal):
 1. {t \<in> .[U]. deg_pm t + poly_deg h = z} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{t \<in> .[U]. deg_pm t + poly_deg h = z} = {}

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
hence "card {t \<in> .[U]. deg_pm t + poly_deg h = z} = card ({}::('x \<Rightarrow>\<^sub>0 nat) set)"
[PROOF STATE]
proof (prove)
using this:
{t \<in> .[U]. deg_pm t + poly_deg h = z} = {}

goal (1 subgoal):
 1. card {t \<in> .[U]. deg_pm t + poly_deg h = z} = card {}
[PROOF STEP]
by (rule arg_cong)
[PROOF STATE]
proof (state)
this:
card {t \<in> .[U]. deg_pm t + poly_deg h = z} = card {}

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {t \<in> .[U]. deg_pm t + poly_deg h = z} = card {}

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
have "\<dots> = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {} = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {} = 0

goal (1 subgoal):
 1. \<not> poly_deg h \<le> z \<Longrightarrow> Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Hilbert_fun (cone (h, U)) z = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Hilbert_fun (cone (h, U)) z = 0

goal (1 subgoal):
 1. Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)
[PROOF STEP]
by (simp add: False)
[PROOF STATE]
proof (state)
this:
Hilbert_fun (cone (h, U)) z = (if poly_deg h \<le> z then z - poly_deg h + (card U - 1) choose (card U - 1) else 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem RA5: "(P \<or> Q)\<^sup>- = (P\<^sup>- \<or> Q\<^sup>-)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<or> Q)\<^sup>- = (P\<^sup>- \<or> Q\<^sup>-)
[PROOF STEP]
by (rel_auto)


[STATEMENT]
lemma "a1 \<ge> 0 \<and> a2 \<ge> 0 \<and> (a1 * a1 + a2 * a2 = b1 * b1 + b2 * b2 + 2) \<and> (a1 * b1 + a2 * b2 = 0) \<longrightarrow>
    a1 * a2 - b1 * b2 \<ge> (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> a1 \<and> 0 \<le> a2 \<and> a1 * a1 + a2 * a2 = b1 * b1 + b2 * b2 + 2 \<and> a1 * b1 + a2 * b2 = 0 \<longrightarrow> 0 \<le> a1 * a2 - b1 * b2
[PROOF STEP]
by sos


[STATEMENT]
lemma coprime_poly_0:
  "poly p x \<noteq> 0 \<or> poly q x \<noteq> 0" if "coprime p q"
  for x :: "'a :: field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
assume " \<not> (poly p x \<noteq> 0 \<or> poly q x \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
\<not> (poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a))

goal (1 subgoal):
 1. \<not> (poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a))
[PROOF STEP]
have "[:-x, 1:] dvd p" "[:-x, 1:] dvd q"
[PROOF STATE]
proof (prove)
using this:
\<not> (poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a))

goal (1 subgoal):
 1. [:- x, 1::'a:] dvd p &&& [:- x, 1::'a:] dvd q
[PROOF STEP]
by (simp_all add: poly_eq_0_iff_dvd)
[PROOF STATE]
proof (state)
this:
[:- x, 1::'a:] dvd p
[:- x, 1::'a:] dvd q

goal (1 subgoal):
 1. \<not> (poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
coprime p q
[:- x, 1::'a:] dvd p
[:- x, 1::'a:] dvd q
[PROOF STEP]
have "is_unit [:-x, 1:]"
[PROOF STATE]
proof (prove)
using this:
coprime p q
[:- x, 1::'a:] dvd p
[:- x, 1::'a:] dvd q

goal (1 subgoal):
 1. is_unit [:- x, 1::'a:]
[PROOF STEP]
by (rule coprime_common_divisor)
[PROOF STATE]
proof (state)
this:
is_unit [:- x, 1::'a:]

goal (1 subgoal):
 1. \<not> (poly p x \<noteq> (0::'a) \<or> poly q x \<noteq> (0::'a)) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_unit [:- x, 1::'a:]
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
is_unit [:- x, 1::'a:]

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_prod_list_le: "degree (prod_list ps) \<le> sum_list (map degree ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod_list ps) \<le> sum_list (map degree ps)
[PROOF STEP]
proof (induct ps)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree (prod_list []) \<le> sum_list (map degree [])
 2. \<And>a ps. degree (prod_list ps) \<le> sum_list (map degree ps) \<Longrightarrow> degree (prod_list (a # ps)) \<le> sum_list (map degree (a # ps))
[PROOF STEP]
case (Cons p ps)
[PROOF STATE]
proof (state)
this:
degree (prod_list ps) \<le> sum_list (map degree ps)

goal (2 subgoals):
 1. degree (prod_list []) \<le> sum_list (map degree [])
 2. \<And>a ps. degree (prod_list ps) \<le> sum_list (map degree ps) \<Longrightarrow> degree (prod_list (a # ps)) \<le> sum_list (map degree (a # ps))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (prod_list (p # ps)) \<le> sum_list (map degree (p # ps))
[PROOF STEP]
unfolding prod_list.Cons
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p * prod_list ps) \<le> sum_list (map degree (p # ps))
[PROOF STEP]
by (rule order.trans[OF degree_mult_le], insert Cons, auto)
[PROOF STATE]
proof (state)
this:
degree (prod_list (p # ps)) \<le> sum_list (map degree (p # ps))

goal (1 subgoal):
 1. degree (prod_list []) \<le> sum_list (map degree [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma generate_topology_on_Inter:
  "\<lbrakk>finite \<F>; \<And>K. K \<in> \<F> \<Longrightarrow> generate_topology_on \<S> K; \<F> \<noteq> {}\<rbrakk> \<Longrightarrow> generate_topology_on \<S> (\<Inter>\<F>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite \<F>; \<And>K. K \<in> \<F> \<Longrightarrow> generate_topology_on \<S> K; \<F> \<noteq> {}\<rbrakk> \<Longrightarrow> generate_topology_on \<S> (\<Inter> \<F>)
[PROOF STEP]
by (induction \<F> rule: finite_induct; force intro: generate_topology_on.intros)


[STATEMENT]
lemma lemma_2_7_22: "(a l\<rightarrow> b) * (c l\<rightarrow> d) \<le> (a \<sqinter> c) l\<rightarrow> (b \<sqinter> d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a l\<rightarrow> b) * (c l\<rightarrow> d) \<le> a \<sqinter> c l\<rightarrow> b \<sqinter> d
[PROOF STEP]
apply (rule_tac y = "(a \<sqinter> c l\<rightarrow> b) * (a \<sqinter> c l\<rightarrow> d)" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (a l\<rightarrow> b) * (c l\<rightarrow> d) \<le> (a \<sqinter> c l\<rightarrow> b) * (a \<sqinter> c l\<rightarrow> d)
 2. (a \<sqinter> c l\<rightarrow> b) * (a \<sqinter> c l\<rightarrow> d) \<le> a \<sqinter> c l\<rightarrow> b \<sqinter> d
[PROOF STEP]
apply (rule mult_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a l\<rightarrow> b \<le> a \<sqinter> c l\<rightarrow> b
 2. c l\<rightarrow> d \<le> a \<sqinter> c l\<rightarrow> d
 3. (a \<sqinter> c l\<rightarrow> b) * (a \<sqinter> c l\<rightarrow> d) \<le> a \<sqinter> c l\<rightarrow> b \<sqinter> d
[PROOF STEP]
apply (simp_all add: lemma_2_5_13_a)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<sqinter> c l\<rightarrow> b) * (a \<sqinter> c l\<rightarrow> d) \<le> a \<sqinter> c l\<rightarrow> b \<sqinter> d
[PROOF STEP]
apply (rule_tac y = "(a \<sqinter> c l\<rightarrow> b) \<sqinter> (a \<sqinter> c l\<rightarrow> d)" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (a \<sqinter> c l\<rightarrow> b) * (a \<sqinter> c l\<rightarrow> d) \<le> (a \<sqinter> c l\<rightarrow> b) \<sqinter> (a \<sqinter> c l\<rightarrow> d)
 2. (a \<sqinter> c l\<rightarrow> b) \<sqinter> (a \<sqinter> c l\<rightarrow> d) \<le> a \<sqinter> c l\<rightarrow> b \<sqinter> d
[PROOF STEP]
apply (rule lemma_2_5_11)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<sqinter> c l\<rightarrow> b) \<sqinter> (a \<sqinter> c l\<rightarrow> d) \<le> a \<sqinter> c l\<rightarrow> b \<sqinter> d
[PROOF STEP]
by (simp add: lemma_2_6_20_a)


[STATEMENT]
lemma Cauchy_Schwarz_ineq2:
  "sqrt (real_of (cnj (inner x y) * inner x y)) \<le> norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)) \<le> norm x * norm y
[PROOF STEP]
proof (rule power2_le_imp_le)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
have eq: "0 \<le> real_of (cnj (inner x y) * inner x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> real_of (cnj_class.cnj (inner x y) * inner x y)
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
0 \<le> real_of (cnj_class.cnj (inner x y) * inner x y)

goal (2 subgoals):
 1. (sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
have "real_of (cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
using Cauchy_Schwarz_ineq
[PROOF STATE]
proof (prove)
using this:
real_of (cnj_class.cnj (inner ?x ?y) * inner ?x ?y) \<le> real_of (inner ?x ?x) * real_of (inner ?y ?y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)

goal (2 subgoals):
 1. (sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
 2. 0 \<le> norm x * norm y
[PROOF STEP]
thus "(sqrt (real_of (cnj (inner x y) * inner x y)))\<^sup>2 \<le> (norm x * norm y)\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)

goal (1 subgoal):
 1. (sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)))\<^sup>2 \<le> (norm x * norm y)\<^sup>2
[PROOF STEP]
unfolding power_mult_distrib
[PROOF STATE]
proof (prove)
using this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)

goal (1 subgoal):
 1. (sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)))\<^sup>2 \<le> (norm x)\<^sup>2 * (norm y)\<^sup>2
[PROOF STEP]
unfolding power2_norm_eq_inner
[PROOF STATE]
proof (prove)
using this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)

goal (1 subgoal):
 1. (sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)))\<^sup>2 \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
unfolding real_sqrt_pow2[OF eq]
[PROOF STATE]
proof (prove)
using this:
real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)

goal (1 subgoal):
 1. real_of (cnj_class.cnj (inner x y) * inner x y) \<le> real_of (inner x x) * real_of (inner y y)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(sqrt (real_of (cnj_class.cnj (inner x y) * inner x y)))\<^sup>2 \<le> (norm x * norm y)\<^sup>2

goal (1 subgoal):
 1. 0 \<le> norm x * norm y
[PROOF STEP]
show "0 \<le> norm x * norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> norm x * norm y
[PROOF STEP]
unfolding norm_eq_sqrt_inner
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sqrt (real_of (inner x x)) * sqrt (real_of (inner y y))
[PROOF STEP]
by (intro mult_nonneg_nonneg real_sqrt_ge_zero inner_ge_zero)
[PROOF STATE]
proof (state)
this:
0 \<le> norm x * norm y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r2s_inter_hom_var: "R \<subseteq> Id \<Longrightarrow> S \<subseteq> Id \<Longrightarrow> r2s (R ; S) = r2s R \<inter> r2s S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R \<subseteq> Id; S \<subseteq> Id\<rbrakk> \<Longrightarrow> r2s (R ; S) = r2s R \<inter> r2s S
[PROOF STEP]
by (metis r2s_inter_hom subid_meet)