[STATEMENT]
lemma (in Module) l_comb_mem_submoduleTr:"\<lbrakk>ideal R A; submodule R M N\<rbrakk> \<Longrightarrow>
 (s \<in> {j. j \<le> (n::nat)} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> carrier M \<and>
 (\<forall>j \<le> n.(s j) \<cdot>\<^sub>s (f j) \<in> N)) \<longrightarrow> l_comb R M n s f \<in> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R A; submodule R M N\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> carrier M \<and> (\<forall>j\<le>n. s j \<cdot>\<^sub>s f j \<in> N) \<longrightarrow> l_comb R M n s f \<in> N
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>ideal R A; submodule R M N\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> 0} \<rightarrow> A \<and> f \<in> {j. j \<le> 0} \<rightarrow> carrier M \<and> (\<forall>j\<le>0. s j \<cdot>\<^sub>s f j \<in> N) \<longrightarrow> l_comb R M 0 s f \<in> N
 2. \<And>n. \<lbrakk>ideal R A; submodule R M N; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> carrier M \<and> (\<forall>j\<le>n. s j \<cdot>\<^sub>s f j \<in> N) \<longrightarrow> l_comb R M n s f \<in> N\<rbrakk> \<Longrightarrow> s \<in> {j. j \<le> Suc n} \<rightarrow> A \<and> f \<in> {j. j \<le> Suc n} \<rightarrow> carrier M \<and> (\<forall>j\<le>Suc n. s j \<cdot>\<^sub>s f j \<in> N) \<longrightarrow> l_comb R M (Suc n) s f \<in> N
[PROOF STEP]
apply (simp add:l_comb_def, rule impI, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; submodule R M N; s \<in> {j. j \<le> n} \<rightarrow> A \<and> f \<in> {j. j \<le> n} \<rightarrow> carrier M \<and> (\<forall>j\<le>n. s j \<cdot>\<^sub>s f j \<in> N) \<longrightarrow> l_comb R M n s f \<in> N; s \<in> {j. j \<le> Suc n} \<rightarrow> A; f \<in> {j. j \<le> Suc n} \<rightarrow> carrier M; \<forall>j\<le>Suc n. s j \<cdot>\<^sub>s f j \<in> N\<rbrakk> \<Longrightarrow> l_comb R M (Suc n) s f \<in> N
[PROOF STEP]
apply (frule func_pre[of _ _ A], frule func_pre[of _ _ "carrier M"], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; submodule R M N; l_comb R M n s f \<in> N; s \<in> {j. j \<le> Suc n} \<rightarrow> A; f \<in> {j. j \<le> Suc n} \<rightarrow> carrier M; \<forall>j\<le>Suc n. s j \<cdot>\<^sub>s f j \<in> N; s \<in> {j. j \<le> n} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> carrier M\<rbrakk> \<Longrightarrow> l_comb R M (Suc n) s f \<in> N
[PROOF STEP]
apply (simp add:l_comb_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; submodule R M N; \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<in> N; s \<in> {j. j \<le> Suc n} \<rightarrow> A; f \<in> {j. j \<le> Suc n} \<rightarrow> carrier M; \<forall>j\<le>Suc n. s j \<cdot>\<^sub>s f j \<in> N; s \<in> {j. j \<le> n} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> carrier M\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<plusminus> s (Suc n) \<cdot>\<^sub>s f (Suc n) \<in> N
[PROOF STEP]
apply (frule_tac a = "Suc n" in forall_spec, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R A; submodule R M N; \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<in> N; s \<in> {j. j \<le> Suc n} \<rightarrow> A; f \<in> {j. j \<le> Suc n} \<rightarrow> carrier M; \<forall>j\<le>Suc n. s j \<cdot>\<^sub>s f j \<in> N; s \<in> {j. j \<le> n} \<rightarrow> A; f \<in> {j. j \<le> n} \<rightarrow> carrier M; s (Suc n) \<cdot>\<^sub>s f (Suc n) \<in> N\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<plusminus> s (Suc n) \<cdot>\<^sub>s f (Suc n) \<in> N
[PROOF STEP]
apply (rule submodule_pOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma LeadsETo_Un:
     "[| F \<in> A LeadsTo[CC] C; F \<in> B LeadsTo[CC] C |]
      ==> F \<in> (A Un B) LeadsTo[CC] C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<in> A LeadsTo[CC] C; F \<in> B LeadsTo[CC] C\<rbrakk> \<Longrightarrow> F \<in> (A \<union> B) LeadsTo[CC] C
[PROOF STEP]
using LeadsETo_Union [of "{A, B}" F CC C]
[PROOF STATE]
proof (prove)
using this:
(\<And>Aa. Aa \<in> {A, B} \<Longrightarrow> F \<in> Aa LeadsTo[CC] C) \<Longrightarrow> F \<in> \<Union> {A, B} LeadsTo[CC] C

goal (1 subgoal):
 1. \<lbrakk>F \<in> A LeadsTo[CC] C; F \<in> B LeadsTo[CC] C\<rbrakk> \<Longrightarrow> F \<in> (A \<union> B) LeadsTo[CC] C
[PROOF STEP]
by auto


[STATEMENT]
lemma symp_tllist_all2: "\<lbrakk> symp R; symp S \<rbrakk> \<Longrightarrow> symp (tllist_all2 R S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>symp R; symp S\<rbrakk> \<Longrightarrow> symp (tllist_all2 R S)
[PROOF STEP]
by (rule sympI)(auto 4 3 simp add: tllist_all2_conv_all_tnth elim: sympE dest: lfinite_llength_enat not_lfinite_llength)


[STATEMENT]
lemma content_gcd_content: "content (gcd f g) = gcd (content f) (content g)"
  (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
let ?c = "content"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
have "?l = normalize (gcd (?c f) (?c g)) *
    ?c (gcd (primitive_part f) (primitive_part g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. content (gcd f g) = normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g))
[PROOF STEP]
unfolding gcd_poly_decompose[of f g] content_smult
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g)) = normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
content (gcd f g) = normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g))

goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
content (gcd f g) = normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g))

goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
have "\<dots> = gcd (?c f) (?c g) *
    ?c (gcd (primitive_part f) (primitive_part g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g)) = gcd (content f) (content g) * content (gcd (primitive_part f) (primitive_part g))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g)) = gcd (content f) (content g) * content (gcd (primitive_part f) (primitive_part g))

goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize (gcd (content f) (content g)) * content (gcd (primitive_part f) (primitive_part g)) = gcd (content f) (content g) * content (gcd (primitive_part f) (primitive_part g))

goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
have "\<dots> = ?r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (content f) (content g) * content (gcd (primitive_part f) (primitive_part g)) = gcd (content f) (content g)
[PROOF STEP]
using content_gcd_primitive[of f g]
[PROOF STATE]
proof (prove)
using this:
f \<noteq> 0 \<Longrightarrow> content (gcd (primitive_part f) g) = (1::'a)
f \<noteq> 0 \<Longrightarrow> content (gcd (primitive_part f) (primitive_part g)) = (1::'a)

goal (1 subgoal):
 1. gcd (content f) (content g) * content (gcd (primitive_part f) (primitive_part g)) = gcd (content f) (content g)
[PROOF STEP]
by (metis (no_types, lifting) content_dvd_contentI content_eq_zero_iff
    content_primitive_part gcd_dvd2 gcd_eq_0_iff is_unit_content_iff mult_cancel_left1)
[PROOF STATE]
proof (state)
this:
gcd (content f) (content g) * content (gcd (primitive_part f) (primitive_part g)) = gcd (content f) (content g)

goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
content (gcd f g) = gcd (content f) (content g)

goal (1 subgoal):
 1. content (gcd f g) = gcd (content f) (content g)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
content (gcd f g) = gcd (content f) (content g)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma member_le_L2_set: "\<lbrakk>finite A; i \<in> A\<rbrakk> \<Longrightarrow> f i \<le> L2_set f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; i \<in> A\<rbrakk> \<Longrightarrow> f i \<le> L2_set f A
[PROOF STEP]
unfolding L2_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; i \<in> A\<rbrakk> \<Longrightarrow> f i \<le> sqrt (\<Sum>i\<in>A. (f i)\<^sup>2)
[PROOF STEP]
by (auto intro!: member_le_sum real_le_rsqrt)


[STATEMENT]
lemma cut_le_inext_nth_card_eq2: "
  \<lbrakk> finite I; card I \<le> Suc n \<rbrakk> \<Longrightarrow> card (I \<down>\<le> (I \<rightarrow> n)) = card I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; card I \<le> Suc n\<rbrakk> \<Longrightarrow> card (I \<down>\<le> (I \<rightarrow> n)) = card I
[PROOF STEP]
apply (case_tac "I = {}", simp add: cut_le_empty)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; card I \<le> Suc n; I \<noteq> {}\<rbrakk> \<Longrightarrow> card (I \<down>\<le> (I \<rightarrow> n)) = card I
[PROOF STEP]
apply (simp add: inext_nth_card_Max cut_le_Max_all)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma pairs_extensional': "(\<And> r s. P r s \<longleftrightarrow> (\<exists> t. Q t \<and> r = fa t \<and> s = fb t)) \<Longrightarrow>  {(r,s). P r s} = {(fa t, fb t) | t. Q t}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r s. P r s = (\<exists>t. Q t \<and> r = fa t \<and> s = fb t)) \<Longrightarrow> {(r, s). P r s} = {(fa t, fb t) |t. Q t}
[PROOF STEP]
by auto


[STATEMENT]
lemma add_mult_distrib: "mult i (add j k) = add (mult i j) (mult i k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult i (add j k) = add (mult i j) (mult i k)
[PROOF STEP]
by (induct k) (auto simp add: add_assoc)


[STATEMENT]
lemma isolate_insert:
  fixes x :: "'a::t1_space"
  shows "x isolate (insert a S) \<longleftrightarrow> x isolate S \<or> (x=a \<and> \<not> (x islimpt S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x isolate insert a S = (x isolate S \<or> x = a \<and> \<not> x islimpt S)
[PROOF STEP]
by (meson insert_iff islimpt_insert isolate_islimpt_iff)


[STATEMENT]
lemma (in is_iso_dghm) is_iso_dghm_op':
  assumes "\<AA>' = op_dg \<AA>" and "\<BB>' = op_dg \<BB>"
  shows "op_dghm \<FF> : \<AA>' \<mapsto>\<mapsto>\<^sub>D\<^sub>G\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> \<BB>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_dghm \<FF> : \<AA>' \<mapsto>\<mapsto>\<^sub>D\<^sub>G\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_dghm \<FF> : op_dg \<AA> \<mapsto>\<mapsto>\<^sub>D\<^sub>G\<^sub>.\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<alpha>\<^esub> op_dg \<BB>
[PROOF STEP]
by (rule is_iso_dghm_op)


[STATEMENT]
theorem bs_deleteMin_correct:
  assumes I: "bs_invar h"
  assumes NE: "h \<noteq> bs_empty"
  shows
  "bs_invar (bs_deleteMin h)"
  "bs_to_mset (bs_deleteMin h) = bs_to_mset h - {#bs_findMin h#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bs_invar (bs_deleteMin h) &&& bs_to_mset (bs_deleteMin h) = bs_to_mset h - {#bs_findMin h#}
[PROOF STEP]
using I NE
[PROOF STATE]
proof (prove)
using this:
bs_invar h
h \<noteq> bs_empty

goal (1 subgoal):
 1. bs_invar (bs_deleteMin h) &&& bs_to_mset (bs_deleteMin h) = bs_to_mset h - {#bs_findMin h#}
[PROOF STEP]
apply (case_tac [!] h)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>a. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inl a\<rbrakk> \<Longrightarrow> bs_invar (bs_deleteMin h)
 2. \<And>b. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inr b\<rbrakk> \<Longrightarrow> bs_invar (bs_deleteMin h)
 3. \<And>a. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inl a\<rbrakk> \<Longrightarrow> bs_to_mset (bs_deleteMin h) = bs_to_mset h - {#bs_findMin h#}
 4. \<And>b. \<lbrakk>bs_invar h; h \<noteq> bs_empty; h = Inr b\<rbrakk> \<Longrightarrow> bs_to_mset (bs_deleteMin h) = bs_to_mset h - {#bs_findMin h#}
[PROOF STEP]
apply (simp_all add: bs_empty_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b. \<lbrakk>elem_invar b; h = Inr b\<rbrakk> \<Longrightarrow> bs_invar (bs_deleteMin (Inr b))
 2. \<And>b. \<lbrakk>elem_invar b; h = Inr b\<rbrakk> \<Longrightarrow> bs_to_mset (bs_deleteMin (Inr b)) = elem_to_mset b - {#findMin' b#}
[PROOF STEP]
apply (case_tac [!] b)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b x1 x2 x3. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 x3\<rbrakk> \<Longrightarrow> bs_invar (bs_deleteMin (Inr b))
 2. \<And>b x1 x2 x3. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 x3\<rbrakk> \<Longrightarrow> bs_to_mset (bs_deleteMin (Inr b)) = elem_to_mset b - {#findMin' b#}
[PROOF STEP]
apply (rename_tac [!] list)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>b x1 x2 list. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 list\<rbrakk> \<Longrightarrow> bs_invar (bs_deleteMin (Inr b))
 2. \<And>b x1 x2 list. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 list\<rbrakk> \<Longrightarrow> bs_to_mset (bs_deleteMin (Inr b)) = elem_to_mset b - {#findMin' b#}
[PROOF STEP]
apply (case_tac [!] list)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>b x1 x2 list. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 list; list = []\<rbrakk> \<Longrightarrow> bs_invar (bs_deleteMin (Inr b))
 2. \<And>b x1 x2 list a lista. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 list; list = a # lista\<rbrakk> \<Longrightarrow> bs_invar (bs_deleteMin (Inr b))
 3. \<And>b x1 x2 list. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 list; list = []\<rbrakk> \<Longrightarrow> bs_to_mset (bs_deleteMin (Inr b)) = elem_to_mset b - {#findMin' b#}
 4. \<And>b x1 x2 list a lista. \<lbrakk>elem_invar b; h = Inr b; b = Element x1 x2 list; list = a # lista\<rbrakk> \<Longrightarrow> bs_to_mset (bs_deleteMin (Inr b)) = elem_to_mset b - {#findMin' b#}
[PROOF STEP]
apply (simp_all del: elem_invar.simps deleteMin'.simps add: deleteMin_correct')
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma prop_make_vert_equiv:
 shows "rat_poly.row_length (make_vert_equiv n) = 2^n"
   and "length (make_vert_equiv n) = 2^n"
   and "mat
         (rat_poly.row_length (make_vert_equiv n))
         (length (make_vert_equiv n))
                       (make_vert_equiv n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n &&& length (make_vert_equiv n) = 2 ^ n &&& mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n
 2. length (make_vert_equiv n) = 2 ^ n
 3. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
have 1:"make_vert_equiv n = (blockmat (make_vert_block n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. make_vert_equiv n = blockmat (make_vert_block n)
[PROOF STEP]
using blockmat_make_vert
[PROOF STATE]
proof (prove)
using this:
blockmat (make_vert_block ?n) = make_vert_equiv ?n

goal (1 subgoal):
 1. make_vert_equiv n = blockmat (make_vert_block n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
make_vert_equiv n = blockmat (make_vert_block n)

goal (3 subgoals):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n
 2. length (make_vert_equiv n) = 2 ^ n
 3. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
make_vert_equiv n = blockmat (make_vert_block n)

goal (3 subgoals):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n
 2. length (make_vert_equiv n) = 2 ^ n
 3. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
have 2:"domain_block (make_vert_block n) = int n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain_block (make_vert_block n) = int n
[PROOF STEP]
using domain_make_vert
[PROOF STATE]
proof (prove)
using this:
domain_block (make_vert_block ?n) = int ?n

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

goal (3 subgoals):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n
 2. length (make_vert_equiv n) = 2 ^ n
 3. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
domain_block (make_vert_block n) = int n

goal (3 subgoals):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n
 2. length (make_vert_equiv n) = 2 ^ n
 3. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
have 3:"codomain_block (make_vert_block n) = int n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. codomain_block (make_vert_block n) = int n
[PROOF STEP]
using codomain_make_vert
[PROOF STATE]
proof (prove)
using this:
codomain_block (make_vert_block ?n) = int ?n

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

goal (3 subgoals):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n
 2. length (make_vert_equiv n) = 2 ^ n
 3. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
make_vert_equiv n = blockmat (make_vert_block n)
domain_block (make_vert_block n) = int n
codomain_block (make_vert_block n) = int n
[PROOF STEP]
show "rat_poly.row_length (make_vert_equiv n) = 2^n"
             and "length (make_vert_equiv n) = 2^n"
             and "mat
                     (rat_poly.row_length (make_vert_equiv n))
                     (length (make_vert_equiv n))
                               (make_vert_equiv n)"
[PROOF STATE]
proof (prove)
using this:
make_vert_equiv n = blockmat (make_vert_block n)
domain_block (make_vert_block n) = int n
codomain_block (make_vert_block n) = int n

goal (1 subgoal):
 1. rat_poly.row_length (make_vert_equiv n) = 2 ^ n &&& length (make_vert_equiv n) = 2 ^ n &&& mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
apply (metis nat_int row_length_domain_block)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (make_vert_equiv n) = 2 ^ n
 2. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
using 1 2 3
[PROOF STATE]
proof (prove)
using this:
make_vert_equiv n = blockmat (make_vert_block n)
domain_block (make_vert_block n) = int n
codomain_block (make_vert_block n) = int n

goal (2 subgoals):
 1. length (make_vert_equiv n) = 2 ^ n
 2. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
apply (metis length_codomain_block nat_int)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
using 1 2 3
[PROOF STATE]
proof (prove)
using this:
make_vert_equiv n = blockmat (make_vert_block n)
domain_block (make_vert_block n) = int n
codomain_block (make_vert_block n) = int n

goal (1 subgoal):
 1. mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)
[PROOF STEP]
by (metis matrix_blockmat)
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (make_vert_equiv n) = 2 ^ n
length (make_vert_equiv n) = 2 ^ n
mat (rat_poly.row_length (make_vert_equiv n)) (length (make_vert_equiv n)) (make_vert_equiv n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trans4: "(l::nat) \<le> a1 + a2 + a3 \<Longrightarrow> a3 \<le> r \<Longrightarrow> l \<le> a1 + a2 + r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>l \<le> a1 + a2 + a3; a3 \<le> r\<rbrakk> \<Longrightarrow> l \<le> a1 + a2 + r
[PROOF STEP]
by simp


[STATEMENT]
lemma (in T0) T0_eqI:
  assumes points: "x \<in> carrier" "y \<in> carrier"
  and R1: "\<And>u. u \<in> nhds x \<Longrightarrow> y \<in> u"
  and R2: "\<And>v. v \<in> nhds y \<Longrightarrow> x \<in> v"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
using T0 points
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>carrier. \<forall>y\<in>carrier. x \<noteq> y \<longrightarrow> (\<exists>u\<in>nhds x. y \<notin> u) \<or> (\<exists>v\<in>nhds y. x \<notin> v)
x \<in> carrier
y \<in> carrier

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (auto intro: R1 R2)


[STATEMENT]
lemma is_unit_prod_mset_primes_iff:
  assumes "\<And>x. x \<in># A \<Longrightarrow> prime x"
  shows   "is_unit (prod_mset A) \<longleftrightarrow> A = {#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit (\<Prod>\<^sub># A) = (A = {#})
[PROOF STEP]
by (auto simp add: is_unit_prod_mset_iff)
    (meson all_not_in_conv assms not_prime_unit set_mset_eq_empty_iff)


[STATEMENT]
lemma permutation_compose: "permutation p \<Longrightarrow> permutation q \<Longrightarrow> permutation (p \<circ> q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>permutation p; permutation q\<rbrakk> \<Longrightarrow> permutation (p \<circ> q)
[PROOF STEP]
unfolding permutation_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>n. swapidseq n p; \<exists>n. swapidseq n q\<rbrakk> \<Longrightarrow> \<exists>n. swapidseq n (p \<circ> q)
[PROOF STEP]
using swapidseq_comp_add[of _ p _ q]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>swapidseq ?n p; swapidseq ?m q\<rbrakk> \<Longrightarrow> swapidseq (?n + ?m) (p \<circ> q)

goal (1 subgoal):
 1. \<lbrakk>\<exists>n. swapidseq n p; \<exists>n. swapidseq n q\<rbrakk> \<Longrightarrow> \<exists>n. swapidseq n (p \<circ> q)
[PROOF STEP]
by metis


[STATEMENT]
lemma n_mult_monom:
  assumes "a \<in> carrier R"
  shows "n_mult (monom P a (Suc n)) = monom P ([Suc n]\<cdot>a) (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n_mult (monom P a (Suc n)) = monom P ([Suc n] \<cdot> a) (Suc n)
[PROOF STEP]
apply(rule ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. n_mult (monom P a (Suc n)) x = monom P ([Suc n] \<cdot> a) (Suc n) x
[PROOF STEP]
unfolding n_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. [x] \<cdot> monom P a (Suc n) x = monom P ([Suc n] \<cdot> a) (Suc n) x
[PROOF STEP]
using assms cfs_monom
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
?a \<in> carrier R \<Longrightarrow> monom P ?a ?m ?n = (if ?m = ?n then ?a else \<zero>)

goal (1 subgoal):
 1. \<And>x. [x] \<cdot> monom P a (Suc n) x = monom P ([Suc n] \<cdot> a) (Suc n) x
[PROOF STEP]
by auto


[STATEMENT]
lemma bintrunc_numeral:
  "(take_bit :: nat \<Rightarrow> int \<Rightarrow> int) (numeral k) x = of_bool (odd x) + 2 * (take_bit :: nat \<Rightarrow> int \<Rightarrow> int) (pred_numeral k) (x div 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take_bit (numeral k) x = of_bool (odd x) + 2 * take_bit (pred_numeral k) (x div 2)
[PROOF STEP]
by (simp add: numeral_eq_Suc take_bit_Suc mod_2_eq_odd)


[STATEMENT]
lemma open_image_ereal: "open(UNIV-{ \<infinity> , (-\<infinity> :: ereal)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (UNIV - {\<infinity>, - \<infinity>})
[PROOF STEP]
by (metis range_ereal open_ereal open_UNIV)


[STATEMENT]
lemma oDeriv_id: "oDeriv id = id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. oDeriv id = id
[PROOF STEP]
apply (rule ext, rule_tac a=x in oLimit_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x. oDeriv id 0 = id 0
 2. \<And>x xa. oDeriv id xa = id xa \<Longrightarrow> oDeriv id (oSuc xa) = id (oSuc xa)
 3. \<And>x f. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n. oDeriv id (f n) = id (f n)\<rbrakk> \<Longrightarrow> oDeriv id (oLimit f) = id (oLimit f)
[PROOF STEP]
apply (simp add: oFix_eq_self)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x xa. oDeriv id xa = id xa \<Longrightarrow> oDeriv id (oSuc xa) = id (oSuc xa)
 2. \<And>x f. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n. oDeriv id (f n) = id (f n)\<rbrakk> \<Longrightarrow> oDeriv id (oLimit f) = id (oLimit f)
[PROOF STEP]
apply (simp add: oFix_eq_self)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x f. \<lbrakk>OrdinalInduct.strict_mono f; \<forall>n. oDeriv id (f n) = id (f n)\<rbrakk> \<Longrightarrow> oDeriv id (oLimit f) = id (oLimit f)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma closed_segment_commute: "closed_segment a b = closed_segment b a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed_segment a b = closed_segment b a
[PROOF STEP]
by (meson convex_contains_segment convex_closed_segment dual_order.antisym ends_in_segment)


[STATEMENT]
lemma closed_limpts:  "closed {x::'a::metric_space. x islimpt S}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. x islimpt S}
[PROOF STEP]
using closed_limpt limpt_of_limpts
[PROOF STATE]
proof (prove)
using this:
closed ?S = (\<forall>x. x islimpt ?S \<longrightarrow> x \<in> ?S)
?x islimpt {y. y islimpt ?S} \<Longrightarrow> ?x islimpt ?S

goal (1 subgoal):
 1. closed {x. x islimpt S}
[PROOF STEP]
by blast


[STATEMENT]
lemma rtranclp_eq_rtranclp [iff]:
  "(\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* = P\<^sup>*\<^sup>*"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* = P\<^sup>*\<^sup>*
[PROOF STEP]
proof (intro ext iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x xa \<Longrightarrow> P\<^sup>*\<^sup>* x xa
 2. \<And>x xa. P\<^sup>*\<^sup>* x xa \<Longrightarrow> (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x xa
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x xa \<Longrightarrow> P\<^sup>*\<^sup>* x xa
 2. \<And>x xa. P\<^sup>*\<^sup>* x xa \<Longrightarrow> (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x xa
[PROOF STEP]
have "(\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y \<longrightarrow> P\<^sup>=\<^sup>=\<^sup>*\<^sup>* x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y \<longrightarrow> P\<^sup>=\<^sup>=\<^sup>*\<^sup>* x y
[PROOF STEP]
by (rule mono_rtranclp) simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y \<longrightarrow> P\<^sup>=\<^sup>=\<^sup>*\<^sup>* x y

goal (2 subgoals):
 1. \<And>x xa. (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x xa \<Longrightarrow> P\<^sup>*\<^sup>* x xa
 2. \<And>x xa. P\<^sup>*\<^sup>* x xa \<Longrightarrow> (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x xa
[PROOF STEP]
thus "(\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y \<Longrightarrow> P\<^sup>*\<^sup>* x y"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y \<longrightarrow> P\<^sup>=\<^sup>=\<^sup>*\<^sup>* x y

goal (1 subgoal):
 1. (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y \<Longrightarrow> P\<^sup>*\<^sup>* x y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y \<Longrightarrow> P\<^sup>*\<^sup>* x y

goal (1 subgoal):
 1. \<And>x xa. P\<^sup>*\<^sup>* x xa \<Longrightarrow> (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x xa
[PROOF STEP]
show "P\<^sup>*\<^sup>* x y \<Longrightarrow> (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P\<^sup>*\<^sup>* x y \<Longrightarrow> (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y
[PROOF STEP]
by (metis (no_types, lifting) mono_rtranclp)
[PROOF STATE]
proof (state)
this:
P\<^sup>*\<^sup>* x y \<Longrightarrow> (\<lambda>x y. P x y \<or> x = y)\<^sup>*\<^sup>* x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in euclidean_space) euclidean_representation_sum:
  "(\<Sum>i\<in>Basis. f i *\<^sub>R i) = b \<longleftrightarrow> (\<forall>i\<in>Basis. f i = inner b i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<Sum>i\<in>Basis. f i *\<^sub>R i) = b) = (\<forall>i\<in>Basis. f i = inner b i)
[PROOF STEP]
by (subst euclidean_eq_iff) simp


[STATEMENT]
lemma higher_differentiable_on_real_Suc':
  "open S \<Longrightarrow> higher_differentiable_on S f (Suc n) \<longleftrightarrow>
    (\<forall>v. continuous_on S (\<lambda>x. nth_derivative (Suc n) f x 1)) \<and>
    (\<forall>x\<in>S. \<forall>v. (\<lambda>x. nth_derivative n f x 1) differentiable (at x)) \<and> higher_differentiable_on S f n"
  for S::"real set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S \<Longrightarrow> higher_differentiable_on S f (Suc n) = ((\<forall>v. continuous_on S (\<lambda>x. nth_derivative (Suc n) f x 1)) \<and> (\<forall>x\<in>S. \<forall>v. (\<lambda>x. nth_derivative n f x 1) differentiable at x) \<and> higher_differentiable_on S f n)
[PROOF STEP]
apply (auto simp: nth_derivative_differentiable
      dest: higher_differentiable_on_SucD
      intro: higher_differentiable_on_real_SucI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open S; higher_differentiable_on S f (Suc n)\<rbrakk> \<Longrightarrow> continuous_on S (\<lambda>x. nth_derivative n (\<lambda>x. frechet_derivative f (at x) 1) x 1)
[PROOF STEP]
by (auto simp: higher_differentiable_on_real_Suc higher_differentiable_on.simps(1)
      higher_differentiable_on_imp_continuous_nth_derivative)


[STATEMENT]
lemma sets_pre_sigmaI: "stopping_time F T \<Longrightarrow> (\<And>t. {\<omega>\<in>A. T \<omega> \<le> t} \<in> sets (F t)) \<Longrightarrow> A \<in> sets (pre_sigma T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>stopping_time F T; \<And>t. {\<omega> \<in> A. T \<omega> \<le> t} \<in> sets (F t)\<rbrakk> \<Longrightarrow> A \<in> sets (pre_sigma T)
[PROOF STEP]
unfolding sets_pre_sigma
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>stopping_time F T; \<And>t. {\<omega> \<in> A. T \<omega> \<le> t} \<in> sets (F t)\<rbrakk> \<Longrightarrow> A \<in> {A. \<forall>t. {\<omega> \<in> A. T \<omega> \<le> t} \<in> sets (F t)}
[PROOF STEP]
by auto


[STATEMENT]
lemma of_int_in_nonpos_Ints_iff:
  "(of_int n :: 'a :: ring_char_0) \<in> \<int>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> n \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (of_int n \<in> \<int>\<^sub>\<le>\<^sub>0) = (n \<le> 0)
[PROOF STEP]
by (auto simp: nonpos_Ints_def)


[STATEMENT]
lemma desargues_config_not_col_6:
  assumes "desargues_config A B C A' B' C' M N P R"
  shows "\<not> col C C' A'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> col C C' A'
[PROOF STEP]
using assms desargues_config_not_col_1 desargues_config_rot_CW
[PROOF STATE]
proof (prove)
using this:
desargues_config A B C A' B' C' M N P R
desargues_config ?A ?B ?C ?A' ?B' ?C' ?M ?N ?P ?R \<Longrightarrow> \<not> col ?A ?A' ?B'
desargues_config ?A ?B ?C ?A' ?B' ?C' ?M ?N ?P ?R \<Longrightarrow> desargues_config ?C ?A ?B ?C' ?A' ?B' ?P ?M ?N ?R

goal (1 subgoal):
 1. \<not> col C C' A'
[PROOF STEP]
by blast


[STATEMENT]
lemma gt_rat_sign_change:
  assumes ur: "unique_root plr"
  defines "p \<equiv> poly_real_alg_1 plr" and "l \<equiv> rai_lb plr" and "r \<equiv> rai_ub plr"
  assumes p: "poly_cond2 p" and in_interval: "l \<le> y" "y \<le> r"
  shows "(sgn (ipoly p y) = sgn (ipoly p r)) = (of_rat y > the_unique_root plr)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sgn (ipoly p y) = sgn (ipoly p r)) = (real_of_1 plr < real_of_rat y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (sgn (ipoly p y) = sgn (ipoly p r)) = (real_of_1 plr < real_of_rat y)
[PROOF STEP]
have plr: "plr = (p,l,r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. plr = (p, l, r)
[PROOF STEP]
by (cases plr, auto simp: p_def l_def r_def)
[PROOF STATE]
proof (state)
this:
plr = (p, l, r)

goal (1 subgoal):
 1. (sgn (ipoly p y) = sgn (ipoly p r)) = (real_of_1 plr < real_of_rat y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sgn (ipoly p y) = sgn (ipoly p r)) = (real_of_1 plr < real_of_rat y)
[PROOF STEP]
proof (rule gt_rat_sign_change_square_free[OF ur plr _ in_interval])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. square_free p
 2. ipoly p y \<noteq> 0
 3. ipoly p r \<noteq> 0
[PROOF STEP]
note nz = poly_cond2_no_rat_root[OF p]
[PROOF STATE]
proof (state)
this:
poly (real_of_int_poly p) (real_of_rat ?x) \<noteq> 0

goal (3 subgoals):
 1. square_free p
 2. ipoly p y \<noteq> 0
 3. ipoly p r \<noteq> 0
[PROOF STEP]
from nz[of y]
[PROOF STATE]
proof (chain)
picking this:
poly (real_of_int_poly p) (real_of_rat y) \<noteq> 0
[PROOF STEP]
show "ipoly p y \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
poly (real_of_int_poly p) (real_of_rat y) \<noteq> 0

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

goal (2 subgoals):
 1. square_free p
 2. ipoly p r \<noteq> 0
[PROOF STEP]
from nz[of r]
[PROOF STATE]
proof (chain)
picking this:
poly (real_of_int_poly p) (real_of_rat r) \<noteq> 0
[PROOF STEP]
show "ipoly p r \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
poly (real_of_int_poly p) (real_of_rat r) \<noteq> 0

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

goal (1 subgoal):
 1. square_free p
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
poly_cond2 p
[PROOF STEP]
have "irreducible p"
[PROOF STATE]
proof (prove)
using this:
poly_cond2 p

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

goal (1 subgoal):
 1. square_free p
[PROOF STEP]
thus "square_free p"
[PROOF STATE]
proof (prove)
using this:
irreducible p

goal (1 subgoal):
 1. square_free p
[PROOF STEP]
by (rule irreducible_imp_square_free)
[PROOF STATE]
proof (state)
this:
square_free p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(sgn (ipoly p y) = sgn (ipoly p r)) = (real_of_1 plr < real_of_rat y)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma step_size_ok_4: "\<lbrakk>
  invar (States dir big small);
  step (States dir big small) = States dir' big' small';
  remaining_steps (States dir big small) + 1 \<le> 4 * size big
\<rbrakk> \<Longrightarrow> remaining_steps (States dir' big' small') + 1 \<le> 4 * size big'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); step (States dir big small) = States dir' big' small'; remaining_steps (States dir big small) + 1 \<le> 4 * size big\<rbrakk> \<Longrightarrow> remaining_steps (States dir' big' small') + 1 \<le> 4 * size big'
[PROOF STEP]
using remaining_steps_decline step_size_big
[PROOF STATE]
proof (prove)
using this:
invar ?states \<Longrightarrow> remaining_steps (step ?states) \<le> remaining_steps ?states
\<lbrakk>invar (States ?dir ?big ?small); step (States ?dir ?big ?small) = States ?dir' ?big' ?small'\<rbrakk> \<Longrightarrow> size ?big' = size ?big

goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); step (States dir big small) = States dir' big' small'; remaining_steps (States dir big small) + 1 \<le> 4 * size big\<rbrakk> \<Longrightarrow> remaining_steps (States dir' big' small') + 1 \<le> 4 * size big'
[PROOF STEP]
by (metis (no_types, lifting) add_mono_thms_linordered_semiring(3) order.trans)


[STATEMENT]
lemma eq_append_conv_conj: "(zs = xs @ ys) = (xs = take (length xs) zs \<and> ys = drop (length xs) zs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (zs = xs @ ys) = (xs = take (length xs) zs \<and> ys = drop (length xs) zs)
[PROOF STEP]
by (metis append_eq_conv_conj)


[STATEMENT]
lemma iT_Div_card_le: "0 < k \<Longrightarrow> card (I \<oslash> k) \<le> card I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> card (I \<oslash> k) \<le> card I
[PROOF STEP]
apply (case_tac "finite I")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>0 < k; finite I\<rbrakk> \<Longrightarrow> card (I \<oslash> k) \<le> card I
 2. \<lbrakk>0 < k; infinite I\<rbrakk> \<Longrightarrow> card (I \<oslash> k) \<le> card I
[PROOF STEP]
apply (simp add: iT_Div_def card_image_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; infinite I\<rbrakk> \<Longrightarrow> card (I \<oslash> k) \<le> card I
[PROOF STEP]
apply (simp add: iT_Div_finite_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Corps) Vr_ring:"valuation K v \<Longrightarrow> Ring (Vr K v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valuation K v \<Longrightarrow> Ring (Vr K v)
[PROOF STEP]
apply (cut_tac field_is_ring, frule Ring.ring_is_ag[of "K"],
       simp add:Vr_def, rule Ring.Sr_ring, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; Ring K; aGroup K\<rbrakk> \<Longrightarrow> sr K {x \<in> carrier K. 0 \<le> v x}
[PROOF STEP]
apply (simp add:sr_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; Ring K; aGroup K\<rbrakk> \<Longrightarrow> 1\<^sub>r \<in> carrier K \<and> 0 \<le> v 1\<^sub>r \<and> (\<forall>x. x \<in> carrier K \<and> 0 \<le> v x \<longrightarrow> (\<forall>y. y \<in> carrier K \<and> 0 \<le> v y \<longrightarrow> x \<plusminus> -\<^sub>a y \<in> carrier K \<and> 0 \<le> v (x \<plusminus> -\<^sub>a y) \<and> x \<cdot>\<^sub>r y \<in> carrier K \<and> 0 \<le> v (x \<cdot>\<^sub>r y)))
[PROOF STEP]
apply (intro conjI subsetI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>valuation K v; Ring K; aGroup K\<rbrakk> \<Longrightarrow> 1\<^sub>r \<in> carrier K
 2. \<lbrakk>valuation K v; Ring K; aGroup K\<rbrakk> \<Longrightarrow> 0 \<le> v 1\<^sub>r
 3. \<lbrakk>valuation K v; Ring K; aGroup K\<rbrakk> \<Longrightarrow> \<forall>x. x \<in> carrier K \<and> 0 \<le> v x \<longrightarrow> (\<forall>y. y \<in> carrier K \<and> 0 \<le> v y \<longrightarrow> x \<plusminus> -\<^sub>a y \<in> carrier K \<and> 0 \<le> v (x \<plusminus> -\<^sub>a y) \<and> x \<cdot>\<^sub>r y \<in> carrier K \<and> 0 \<le> v (x \<cdot>\<^sub>r y))
[PROOF STEP]
apply (simp_all add: value_of_one Ring.ring_one[of "K"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>valuation K v; Ring K; aGroup K\<rbrakk> \<Longrightarrow> \<forall>x. x \<in> carrier K \<and> 0 \<le> v x \<longrightarrow> (\<forall>y. y \<in> carrier K \<and> 0 \<le> v y \<longrightarrow> x \<plusminus> -\<^sub>a y \<in> carrier K \<and> 0 \<le> v (x \<plusminus> -\<^sub>a y) \<and> x \<cdot>\<^sub>r y \<in> carrier K \<and> 0 \<le> v (x \<cdot>\<^sub>r y))
[PROOF STEP]
apply ((rule allI, rule impI)+,
       (erule conjE)+, rule conjI, rule aGroup.ag_pOp_closed, assumption+,
       rule aGroup.ag_mOp_closed, assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>valuation K v; Ring K; aGroup K; x \<in> carrier K; 0 \<le> v x; y \<in> carrier K; 0 \<le> v y\<rbrakk> \<Longrightarrow> 0 \<le> v (x \<plusminus> -\<^sub>a y) \<and> x \<cdot>\<^sub>r y \<in> carrier K \<and> 0 \<le> v (x \<cdot>\<^sub>r y)
[PROOF STEP]
apply (frule_tac x = x and y = "-\<^sub>a y" in amin_le_plus[of v], assumption+,
       rule aGroup.ag_mOp_closed, assumption+,
       simp add:val_minus_eq[of v])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>valuation K v; Ring K; aGroup K; x \<in> carrier K; 0 \<le> v x; y \<in> carrier K; 0 \<le> v y; amin (v x) (v y) \<le> v (x \<plusminus> -\<^sub>a y)\<rbrakk> \<Longrightarrow> 0 \<le> v (x \<plusminus> -\<^sub>a y) \<and> x \<cdot>\<^sub>r y \<in> carrier K \<and> 0 \<le> v (x \<cdot>\<^sub>r y)
[PROOF STEP]
apply (
       frule_tac z = 0 and x = "v x" and y = "v y" in amin_ge1, assumption+,
       frule_tac i = 0 and j = "amin (v x) (v y)" and k = "v (x \<plusminus> -\<^sub>a y)" in
       ale_trans, assumption+, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>valuation K v; Ring K; aGroup K; x \<in> carrier K; 0 \<le> v x; y \<in> carrier K; 0 \<le> v y; amin (v x) (v y) \<le> v (x \<plusminus> -\<^sub>a y); 0 \<le> amin (v x) (v y); 0 \<le> v (x \<plusminus> -\<^sub>a y)\<rbrakk> \<Longrightarrow> x \<cdot>\<^sub>r y \<in> carrier K \<and> 0 \<le> v (x \<cdot>\<^sub>r y)
[PROOF STEP]
by (simp add: Ring.ring_tOp_closed aadd_two_pos val_t2p)


[STATEMENT]
lemma Bseq_def: "Bseq X \<longleftrightarrow> (\<exists>K>0. \<forall>n. norm (X n) \<le> K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bseq X = (\<exists>K>0. \<forall>n. norm (X n) \<le> K)
[PROOF STEP]
unfolding Bfun_def eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>K>0. \<exists>N. \<forall>n\<ge>N. norm (X n) \<le> K) = (\<exists>K>0. \<forall>n. norm (X n) \<le> K)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>K N. \<lbrakk>0 < K; \<forall>n\<ge>N. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> \<exists>K>0. \<forall>n. norm (X n) \<le> K
 2. \<And>K. \<lbrakk>0 < K; \<forall>n. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> \<exists>K>0. \<exists>N. \<forall>n\<ge>N. norm (X n) \<le> K
[PROOF STEP]
fix N K
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>K N. \<lbrakk>0 < K; \<forall>n\<ge>N. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> \<exists>K>0. \<forall>n. norm (X n) \<le> K
 2. \<And>K. \<lbrakk>0 < K; \<forall>n. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> \<exists>K>0. \<exists>N. \<forall>n\<ge>N. norm (X n) \<le> K
[PROOF STEP]
assume "0 < K" "\<forall>n\<ge>N. norm (X n) \<le> K"
[PROOF STATE]
proof (state)
this:
0 < K
\<forall>n\<ge>N. norm (X n) \<le> K

goal (2 subgoals):
 1. \<And>K N. \<lbrakk>0 < K; \<forall>n\<ge>N. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> \<exists>K>0. \<forall>n. norm (X n) \<le> K
 2. \<And>K. \<lbrakk>0 < K; \<forall>n. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> \<exists>K>0. \<exists>N. \<forall>n\<ge>N. norm (X n) \<le> K
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < K
\<forall>n\<ge>N. norm (X n) \<le> K
[PROOF STEP]
show "\<exists>K>0. \<forall>n. norm (X n) \<le> K"
[PROOF STATE]
proof (prove)
using this:
0 < K
\<forall>n\<ge>N. norm (X n) \<le> K

goal (1 subgoal):
 1. \<exists>K>0. \<forall>n. norm (X n) \<le> K
[PROOF STEP]
by (intro exI[of _ "max (Max (norm ` X ` {..N})) K"] max.strict_coboundedI2)
       (auto intro!: imageI not_less[where 'a=nat, THEN iffD1] Max_ge simp: le_max_iff_disj)
[PROOF STATE]
proof (state)
this:
\<exists>K>0. \<forall>n. norm (X n) \<le> K

goal (1 subgoal):
 1. \<And>K. \<lbrakk>0 < K; \<forall>n. norm (X n) \<le> K\<rbrakk> \<Longrightarrow> \<exists>K>0. \<exists>N. \<forall>n\<ge>N. norm (X n) \<le> K
[PROOF STEP]
qed auto


[STATEMENT]
lemma ordinal_mod_less: "0 < y \<Longrightarrow> x mod y < (y::ordinal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y \<Longrightarrow> x mod y < y
[PROOF STEP]
apply (unfold mod_ordinal_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y \<Longrightarrow> x - y * (x div y) < y
[PROOF STEP]
apply (simp add: ordinal_times_div_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y \<Longrightarrow> x < y * (x div y) + y
[PROOF STEP]
apply (simp add: div_ordinal_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y \<Longrightarrow> x < y * oInv ((*) y) x + y
[PROOF STEP]
apply (subst ordinal_times_oSuc[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < y \<Longrightarrow> x < y * oSuc (oInv ((*) y) x)
[PROOF STEP]
apply (erule normal.oInv_bound2[OF normal_times])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma poly_no_roots:
  "(\<forall>x. poly p x \<noteq> 0) \<longleftrightarrow> ( p \<noteq> 0 \<and> count_roots p = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. poly p x \<noteq> 0) = (p \<noteq> 0 \<and> count_roots p = 0)
[PROOF STEP]
by (auto simp: count_roots_correct dest: poly_roots_finite)


[STATEMENT]
lemma can_merge_by_intersection_code[code] :
  "can_merge_by_intersection x1 x2 = (\<exists> \<alpha> \<in> fset x1 . \<alpha> |\<in>| x2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. can_merge_by_intersection x1 x2 = (\<exists>\<alpha>\<in>fset x1. \<alpha> |\<in>| x2)
[PROOF STEP]
unfolding can_merge_by_intersection.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>\<alpha>. \<alpha> |\<in>| x1 \<and> \<alpha> |\<in>| x2) = (\<exists>\<alpha>\<in>fset x1. \<alpha> |\<in>| x2)
[PROOF STEP]
by (meson notin_fset)


[STATEMENT]
lemma hyperdual_eq:
  fixes x :: "('a :: ring_1) hyperdual"
  shows "x = Base x *\<^sub>H ba + Eps1 x *\<^sub>H e1 + Eps2 x *\<^sub>H e2 + Eps12 x *\<^sub>H e12"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = Base x *\<^sub>H ba + Eps1 x *\<^sub>H e1 + Eps2 x *\<^sub>H e2 + Eps12 x *\<^sub>H e12
[PROOF STEP]
using Hyperdual_eq hyperdual.collapse
[PROOF STATE]
proof (prove)
using this:
Hyperdual ?a ?b ?c ?d = ?a *\<^sub>H ba + ?b *\<^sub>H e1 + ?c *\<^sub>H e2 + ?d *\<^sub>H e12
Hyperdual (Base ?hyperdual) (Eps1 ?hyperdual) (Eps2 ?hyperdual) (Eps12 ?hyperdual) = ?hyperdual

goal (1 subgoal):
 1. x = Base x *\<^sub>H ba + Eps1 x *\<^sub>H e1 + Eps2 x *\<^sub>H e2 + Eps12 x *\<^sub>H e12
[PROOF STEP]
by smt


[STATEMENT]
lemma sets_PiM_I:
  assumes "finite J" "J \<subseteq> I" "\<forall>i\<in>J. E i \<in> sets (M i)"
  shows "prod_emb I M J (\<Pi>\<^sub>E j\<in>J. E j) \<in> sets (\<Pi>\<^sub>M i\<in>I. M i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
 2. \<not> ?P \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
assume "J = {}"
[PROOF STATE]
proof (state)
this:
J = {}

goal (2 subgoals):
 1. ?P \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
 2. \<not> ?P \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
J = {}
[PROOF STEP]
have "prod_emb I M J (\<Pi>\<^sub>E j\<in>J. E j) = (\<Pi>\<^sub>E j\<in>I. space (M j))"
[PROOF STATE]
proof (prove)
using this:
J = {}

goal (1 subgoal):
 1. prod_emb I M J (Pi\<^sub>E J E) = (\<Pi>\<^sub>E j\<in>I. space (M j))
[PROOF STEP]
by (auto simp: prod_emb_def)
[PROOF STATE]
proof (state)
this:
prod_emb I M J (Pi\<^sub>E J E) = (\<Pi>\<^sub>E j\<in>I. space (M j))

goal (2 subgoals):
 1. ?P \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
 2. \<not> ?P \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prod_emb I M J (Pi\<^sub>E J E) = (\<Pi>\<^sub>E j\<in>I. space (M j))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod_emb I M J (Pi\<^sub>E J E) = (\<Pi>\<^sub>E j\<in>I. space (M j))

goal (1 subgoal):
 1. prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
by (auto simp add: sets_PiM intro!: sigma_sets_top)
[PROOF STATE]
proof (state)
this:
prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)

goal (1 subgoal):
 1. J \<noteq> {} \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. J \<noteq> {} \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
assume "J \<noteq> {}"
[PROOF STATE]
proof (state)
this:
J \<noteq> {}

goal (1 subgoal):
 1. J \<noteq> {} \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
finite J
J \<subseteq> I
\<forall>i\<in>J. E i \<in> sets (M i)
J \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite J
J \<subseteq> I
\<forall>i\<in>J. E i \<in> sets (M i)
J \<noteq> {}

goal (1 subgoal):
 1. prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)
[PROOF STEP]
by (force simp add: sets_PiM prod_algebra_def)
[PROOF STATE]
proof (state)
this:
prod_emb I M J (Pi\<^sub>E J E) \<in> sets (Pi\<^sub>M I M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homomtr: "\<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow>
                  (f\<dieresis>\<^bsub>F,G\<^esub>) \<in> gHom (F / (gker\<^bsub>F,G\<^esub> f)) (Img\<^bsub>F,G\<^esub> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> gHom (F / gker\<^bsub>F,G\<^esub> f) (Img\<^bsub>F,G\<^esub> f)
[PROOF STEP]
apply (simp add:gHom_def [of "F / (gker\<^bsub>F,G\<^esub> f)" _])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> extensional (carrier (F / gker\<^bsub>F,G\<^esub> f)) \<and> f\<dieresis>\<^bsub>F,G\<^esub> \<in> carrier (F / gker\<^bsub>F,G\<^esub> f) \<rightarrow> carrier (Img\<^bsub>F,G\<^esub> f) \<and> (\<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> extensional (carrier (F / gker\<^bsub>F,G\<^esub> f))
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> carrier (F / gker\<^bsub>F,G\<^esub> f) \<rightarrow> carrier (Img\<^bsub>F,G\<^esub> f) \<and> (\<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y)
[PROOF STEP]
apply (simp add:induced_ghom_def extensional_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<forall>x. x \<in> set_rcs F (gker\<^bsub>F,G\<^esub> f) \<longrightarrow> x \<notin> carrier (F / gker\<^bsub>F,G\<^esub> f) \<longrightarrow> f (SOME xa. xa \<in> x) = undefined
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> carrier (F / gker\<^bsub>F,G\<^esub> f) \<rightarrow> carrier (Img\<^bsub>F,G\<^esub> f) \<and> (\<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y)
[PROOF STEP]
apply (rule allI, (rule impI)+, simp add:Qg_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> carrier (F / gker\<^bsub>F,G\<^esub> f) \<rightarrow> carrier (Img\<^bsub>F,G\<^esub> f) \<and> (\<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> f\<dieresis>\<^bsub>F,G\<^esub> \<in> carrier (F / gker\<^bsub>F,G\<^esub> f) \<rightarrow> carrier (Img\<^bsub>F,G\<^esub> f)
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y
[PROOF STEP]
apply (rule Pi_I)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier (F / gker\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) x \<in> carrier (Img\<^bsub>F,G\<^esub> f)
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y
[PROOF STEP]
apply (simp add:Gimage_def Qg_def Gp_def, simp add:set_rcs_def, erule bexE)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x a. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) x \<in> f ` carrier F
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x a. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) \<in> f ` carrier F
 2. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y
[PROOF STEP]
apply (simp add:inducedHOMTr0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Group F; Group G; f \<in> gHom F G\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). \<forall>y\<in>carrier (F / gker\<^bsub>F,G\<^esub> f). (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y
[PROOF STEP]
apply (rule ballI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>Group F; Group G; f \<in> gHom F G; x \<in> carrier (F / gker\<^bsub>F,G\<^esub> f); y \<in> carrier (F / gker\<^bsub>F,G\<^esub> f)\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (x \<cdot>\<^bsub>F / gker\<^bsub>F,G\<^esub> f\<^esub> y) = (f\<dieresis>\<^bsub>F,G\<^esub>) x \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) y
[PROOF STEP]
apply (simp add:Qg_def set_rcs_def, (erule bexE)+, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (c_top F (gker\<^bsub>F,G\<^esub> f) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa)) = (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa)
[PROOF STEP]
apply (frule gker_normal[of "F" "G" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (c_top F (gker\<^bsub>F,G\<^esub> f) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa)) = (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa)
[PROOF STEP]
apply (simp add:Group.c_top_welldef[THEN sym, of "F" "gker\<^bsub>F,G\<^esub> f"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> (a \<cdot>\<^bsub>F\<^esub> aa)) = (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa)
[PROOF STEP]
apply (frule_tac a = a and b = aa in Group.mult_closed[of "F"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> (a \<cdot>\<^bsub>F\<^esub> aa)) = (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a) \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> (f\<dieresis>\<^bsub>F,G\<^esub>) (gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa)
[PROOF STEP]
apply (simp add:inducedHOMTr0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f (a \<cdot>\<^bsub>F\<^esub> aa) = f a \<cdot>\<^bsub>Img\<^bsub>F,G\<^esub> f\<^esub> f aa
[PROOF STEP]
apply (simp add:Gimage_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f (a \<cdot>\<^bsub>F\<^esub> aa) = f a \<cdot>\<^bsub>\<natural>\<^bsub>G\<^esub>f ` carrier F\<^esub> f aa
[PROOF STEP]
apply (subst Group.Gp_mult_induced[of "G" "f ` carrier F"], assumption+)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> G \<guillemotright> f ` carrier F
 2. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f a \<in> f ` carrier F
 3. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f aa \<in> f ` carrier F
 4. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f (a \<cdot>\<^bsub>F\<^esub> aa) = f a \<cdot>\<^bsub>G\<^esub> f aa
[PROOF STEP]
apply (simp add:sg_gimg)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f a \<in> f ` carrier F
 2. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f aa \<in> f ` carrier F
 3. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f (a \<cdot>\<^bsub>F\<^esub> aa) = f a \<cdot>\<^bsub>G\<^esub> f aa
[PROOF STEP]
apply (simp add:image_def, blast)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f aa \<in> f ` carrier F
 2. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f (a \<cdot>\<^bsub>F\<^esub> aa) = f a \<cdot>\<^bsub>G\<^esub> f aa
[PROOF STEP]
apply (simp add:image_def, blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y a aa. \<lbrakk>Group F; Group G; f \<in> gHom F G; a \<in> carrier F; x = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> a; aa \<in> carrier F; y = gker\<^bsub>F,G\<^esub> f \<bullet>\<^bsub>F\<^esub> aa; F \<triangleright> gker\<^bsub>F,G\<^esub> f; a \<cdot>\<^bsub>F\<^esub> aa \<in> carrier F\<rbrakk> \<Longrightarrow> f (a \<cdot>\<^bsub>F\<^esub> aa) = f a \<cdot>\<^bsub>G\<^esub> f aa
[PROOF STEP]
apply (simp add:gHom)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma param_fun_comp[param]: "((o), (o)) \<in> (Ra\<rightarrow>Rb) \<rightarrow> (Rc\<rightarrow>Ra) \<rightarrow> Rc\<rightarrow>Rb"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<circ>), (\<circ>)) \<in> (Ra \<rightarrow> Rb) \<rightarrow> (Rc \<rightarrow> Ra) \<rightarrow> Rc \<rightarrow> Rb
[PROOF STEP]
unfolding comp_def[abs_def]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f g x. f (g x), \<lambda>f g x. f (g x)) \<in> (Ra \<rightarrow> Rb) \<rightarrow> (Rc \<rightarrow> Ra) \<rightarrow> Rc \<rightarrow> Rb
[PROOF STEP]
by parametricity


[STATEMENT]
lemma contact_reflexive_idempotent_up_closed:
  "contact x \<longleftrightarrow> reflexive x \<and> idempotent x \<and> up_closed x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contact x = (reflexive x \<and> idempotent x \<and> up_closed x)
[PROOF STEP]
by (metis contact_def contact_idempotent contact_reflexive contact_up_closed sup_absorb2 sup_monoid.add_commute)


[STATEMENT]
lemma det_mult_columns:
shows "det (mult_column A a k) = k * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
have "mult_column A a k = transpose (mult_row (transpose A) a k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mult_column A a k = Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k)
[PROOF STEP]
unfolding transpose_def mult_row_def mult_column_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. if j = a then A $ i $ j * k else A $ i $ j) = (\<chi>i j. (\<chi>i j. if i = a then k * (\<chi>i j. A $ j $ i) $ a $ j else (\<chi>i j. A $ j $ i) $ i $ j) $ j $ i)
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
mult_column A a k = Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k)

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
hence "det (mult_column A a k) = det (transpose (mult_row (transpose A) a k))"
[PROOF STATE]
proof (prove)
using this:
mult_column A a k = Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k)

goal (1 subgoal):
 1. det (mult_column A a k) = det (Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (mult_column A a k) = det (Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k))

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mult_column A a k) = det (Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k))

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
have "... = det (mult_row (transpose A) a k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k)) = det (mult_row (Finite_Cartesian_Product.transpose A) a k)
[PROOF STEP]
unfolding det_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mult_row (Finite_Cartesian_Product.transpose A) a k) = det (mult_row (Finite_Cartesian_Product.transpose A) a k)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det (Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k)) = det (mult_row (Finite_Cartesian_Product.transpose A) a k)

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (Finite_Cartesian_Product.transpose (mult_row (Finite_Cartesian_Product.transpose A) a k)) = det (mult_row (Finite_Cartesian_Product.transpose A) a k)

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
have "... = k * det (transpose A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mult_row (Finite_Cartesian_Product.transpose A) a k) = k * det (Finite_Cartesian_Product.transpose A)
[PROOF STEP]
unfolding det_mult_row
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * det (Finite_Cartesian_Product.transpose A) = k * det (Finite_Cartesian_Product.transpose A)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det (mult_row (Finite_Cartesian_Product.transpose A) a k) = k * det (Finite_Cartesian_Product.transpose A)

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mult_row (Finite_Cartesian_Product.transpose A) a k) = k * det (Finite_Cartesian_Product.transpose A)

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
have "... = k * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * det (Finite_Cartesian_Product.transpose A) = k * det A
[PROOF STEP]
unfolding det_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * det A = k * det A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
k * det (Finite_Cartesian_Product.transpose A) = k * det A

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (mult_column A a k) = k * det A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (mult_column A a k) = k * det A

goal (1 subgoal):
 1. det (mult_column A a k) = k * det A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det (mult_column A a k) = k * det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_measurable_if_lebesgue_on:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "S \<in> sets lebesgue" "T \<in> sets lebesgue" "S \<subseteq> T"
  shows "(\<lambda>x. if x \<in> S then f x else 0) \<in> borel_measurable (lebesgue_on T) \<longleftrightarrow> f \<in> borel_measurable (lebesgue_on S)"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)) = (f \<in> borel_measurable (lebesgue_on S))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T) \<Longrightarrow> f \<in> borel_measurable (lebesgue_on S)
 2. f \<in> borel_measurable (lebesgue_on S) \<Longrightarrow> (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)

goal (2 subgoals):
 1. (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T) \<Longrightarrow> f \<in> borel_measurable (lebesgue_on S)
 2. f \<in> borel_measurable (lebesgue_on S) \<Longrightarrow> (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on S)
[PROOF STEP]
using measurable_restrict_mono [OF _ \<open>S \<subseteq> T\<close>]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
?f \<in> restrict_space ?M T \<rightarrow>\<^sub>M ?N \<Longrightarrow> ?f \<in> restrict_space ?M S \<rightarrow>\<^sub>M ?N

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on S)
[PROOF STEP]
by (subst measurable_lebesgue_cong [where g = "(\<lambda>x. if x \<in> S then f x else 0)"]) auto
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable (lebesgue_on S)

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on S) \<Longrightarrow> (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on S) \<Longrightarrow> (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable (lebesgue_on S)

goal (1 subgoal):
 1. f \<in> borel_measurable (lebesgue_on S) \<Longrightarrow> (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f \<in> borel_measurable (lebesgue_on S)
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable (lebesgue_on S)

goal (1 subgoal):
 1. (\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)
[PROOF STEP]
by (simp add: \<open>S \<in> sets lebesgue\<close> borel_measurable_if_I measurable_restrict_space1)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> S then f x else (0::'b)) \<in> borel_measurable (lebesgue_on T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma preserves_left_adjoint:
    assumes "C.is_left_adjoint f"
    shows "D.is_left_adjoint (F f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. D.is_left_adjoint (F f)
[PROOF STEP]
using assms preserves_adjoint_pair
[PROOF STATE]
proof (prove)
using this:
C.is_left_adjoint f
C.adjoint_pair ?f ?g \<Longrightarrow> D.adjoint_pair (F ?f) (F ?g)

goal (1 subgoal):
 1. D.is_left_adjoint (F f)
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_add_0_right [simp]:
  "A + 0 = (A::('a::monoid_add,'m,'n) matrix)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A + 0 = A
[PROOF STEP]
by (cases A, simp add: zero_matrix_def)


[STATEMENT]
lemma (in prob_space) add_indep_normal:
  assumes indep: "indep_var borel X borel Y"
  assumes pos_var[arith]: "0 < \<sigma>" "0 < \<tau>"
  assumes normalX[simp]: "distributed M lborel X (normal_density \<mu> \<sigma>)"
  assumes normalY[simp]: "distributed M lborel Y (normal_density \<nu> \<tau>)"
  shows "distributed M lborel (\<lambda>x. X x + Y x) (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have ind[simp]: "indep_var borel (\<lambda>x. - \<mu> + X x) borel (\<lambda>x. - \<nu> + Y x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_var borel (\<lambda>x. - \<mu> + X x) borel (\<lambda>x. - \<nu> + Y x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. indep_var borel (\<lambda>x. - \<mu> + X x) borel (\<lambda>x. - \<nu> + Y x)
[PROOF STEP]
have "indep_var borel ( (\<lambda>x. -\<mu> + x) o X) borel ((\<lambda>x. - \<nu> + x) o Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_var borel ((+) (- \<mu>) \<circ> X) borel ((+) (- \<nu>) \<circ> Y)
[PROOF STEP]
by (auto intro!: indep_var_compose assms)
[PROOF STATE]
proof (state)
this:
indep_var borel ((+) (- \<mu>) \<circ> X) borel ((+) (- \<nu>) \<circ> Y)

goal (1 subgoal):
 1. indep_var borel (\<lambda>x. - \<mu> + X x) borel (\<lambda>x. - \<nu> + Y x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
indep_var borel ((+) (- \<mu>) \<circ> X) borel ((+) (- \<nu>) \<circ> Y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
indep_var borel ((+) (- \<mu>) \<circ> X) borel ((+) (- \<nu>) \<circ> Y)

goal (1 subgoal):
 1. indep_var borel (\<lambda>x. - \<mu> + X x) borel (\<lambda>x. - \<nu> + Y x)
[PROOF STEP]
by (simp add: o_def)
[PROOF STATE]
proof (state)
this:
indep_var borel (\<lambda>x. - \<mu> + X x) borel (\<lambda>x. - \<nu> + Y x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
indep_var borel (\<lambda>x. - \<mu> + X x) borel (\<lambda>x. - \<nu> + Y x)

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "distributed M lborel (\<lambda>x. -\<mu> + 1 * X x) (normal_density (- \<mu> + 1 * \<mu>) (\<bar>1\<bar> * \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - \<mu> + 1 * X x) (\<lambda>x. ennreal (normal_density (- \<mu> + 1 * \<mu>) (\<bar>1\<bar> * \<sigma>) x))
[PROOF STEP]
by(rule normal_density_affine[OF normalX pos_var(1), of 1 "-\<mu>"]) simp
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. - \<mu> + 1 * X x) (\<lambda>x. ennreal (normal_density (- \<mu> + 1 * \<mu>) (\<bar>1\<bar> * \<sigma>) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel (\<lambda>x. - \<mu> + 1 * X x) (\<lambda>x. ennreal (normal_density (- \<mu> + 1 * \<mu>) (\<bar>1\<bar> * \<sigma>) x))
[PROOF STEP]
have 1[simp]: "distributed M lborel (\<lambda>x. - \<mu> +  X x) (normal_density 0 \<sigma>)"
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. - \<mu> + 1 * X x) (\<lambda>x. ennreal (normal_density (- \<mu> + 1 * \<mu>) (\<bar>1\<bar> * \<sigma>) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - \<mu> + X x) (\<lambda>x. ennreal (normal_density 0 \<sigma> x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. - \<mu> + X x) (\<lambda>x. ennreal (normal_density 0 \<sigma> x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "distributed M lborel (\<lambda>x. -\<nu> + 1 * Y x) (normal_density (- \<nu> + 1 * \<nu>) (\<bar>1\<bar> * \<tau>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - \<nu> + 1 * Y x) (\<lambda>x. ennreal (normal_density (- \<nu> + 1 * \<nu>) (\<bar>1\<bar> * \<tau>) x))
[PROOF STEP]
by(rule normal_density_affine[OF normalY pos_var(2), of 1 "-\<nu>"]) simp
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. - \<nu> + 1 * Y x) (\<lambda>x. ennreal (normal_density (- \<nu> + 1 * \<nu>) (\<bar>1\<bar> * \<tau>) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel (\<lambda>x. - \<nu> + 1 * Y x) (\<lambda>x. ennreal (normal_density (- \<nu> + 1 * \<nu>) (\<bar>1\<bar> * \<tau>) x))
[PROOF STEP]
have 2[simp]: "distributed M lborel (\<lambda>x. - \<nu> +  Y x) (normal_density 0 \<tau>)"
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. - \<nu> + 1 * Y x) (\<lambda>x. ennreal (normal_density (- \<nu> + 1 * \<nu>) (\<bar>1\<bar> * \<tau>) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - \<nu> + Y x) (\<lambda>x. ennreal (normal_density 0 \<tau> x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. - \<nu> + Y x) (\<lambda>x. ennreal (normal_density 0 \<tau> x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have *: "distributed M lborel (\<lambda>x. (- \<mu> + X x) + (- \<nu> + Y x)) (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - \<mu> + X x + (- \<nu> + Y x)) (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
using distributed_convolution[OF ind 1 2] conv_normal_density_zero_mean[OF pos_var]
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. - \<mu> + X x + (- \<nu> + Y x)) (\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y)) * ennreal (normal_density 0 \<tau> y) \<partial>lborel)
(\<lambda>x. \<integral>\<^sup>+ y. ennreal (normal_density 0 \<sigma> (x - y) * normal_density 0 \<tau> y) \<partial>lborel) = (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. - \<mu> + X x + (- \<nu> + Y x)) (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
by (simp add: ennreal_mult'[symmetric] normal_density_nonneg)
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. - \<mu> + X x + (- \<nu> + Y x)) (\<lambda>x. ennreal (normal_density 0 (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
have "distributed M lborel (\<lambda>x. \<mu> + \<nu> + 1 * (- \<mu> + X x + (- \<nu> + Y x)))
        (\<lambda>x. ennreal (normal_density (\<mu> + \<nu> + 1 * 0) (\<bar>1\<bar> * sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. \<mu> + \<nu> + 1 * (- \<mu> + X x + (- \<nu> + Y x))) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu> + 1 * 0) (\<bar>1\<bar> * sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
by (rule normal_density_affine[OF *, of 1 "\<mu> + \<nu>"]) (auto simp: add_pos_pos)
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. \<mu> + \<nu> + 1 * (- \<mu> + X x + (- \<nu> + Y x))) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu> + 1 * 0) (\<bar>1\<bar> * sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distributed M lborel (\<lambda>x. \<mu> + \<nu> + 1 * (- \<mu> + X x + (- \<nu> + Y x))) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu> + 1 * 0) (\<bar>1\<bar> * sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
distributed M lborel (\<lambda>x. \<mu> + \<nu> + 1 * (- \<mu> + X x + (- \<nu> + Y x))) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu> + 1 * 0) (\<bar>1\<bar> * sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal (1 subgoal):
 1. distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distributed M lborel (\<lambda>x. X x + Y x) (\<lambda>x. ennreal (normal_density (\<mu> + \<nu>) (sqrt (\<sigma>\<^sup>2 + \<tau>\<^sup>2)) x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem full_quicksort_correct_sorted:
  assumes
    trans: \<open>\<And>x y z. \<lbrakk>R (h x) (h y); R (h y) (h z)\<rbrakk> \<Longrightarrow> R (h x) (h z)\<close> and lin: \<open>\<And>x y. x \<noteq> y \<Longrightarrow> R (h x) (h y) \<or> R (h y) (h x)\<close>
  shows \<open>full_quicksort R h xs \<le> \<Down> Id (SPEC(\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda> x y. R (h x) (h y)) xs'))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. full_quicksort R h xs \<le> \<Down> Id (SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs'))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. full_quicksort R h xs \<le> \<Down> Id (SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs'))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. full_quicksort R h xs \<le> \<Down> Id (SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs'))
[PROOF STEP]
unfolding full_quicksort_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if xs = [] then RETURN xs else WB_Sort.quicksort R h (0, length xs - 1, xs)) \<le> \<Down> Id (SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs'))
[PROOF STEP]
apply (refine_vcg)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. xs = [] \<Longrightarrow> mset xs = mset xs
 2. xs = [] \<Longrightarrow> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs
 3. xs \<noteq> [] \<Longrightarrow> WB_Sort.quicksort R h (0, length xs - 1, xs) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = [] \<Longrightarrow> mset xs = mset xs
[PROOF STEP]
by simp \<comment> \<open>case xs=[]\<close>
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs
 2. xs \<noteq> [] \<Longrightarrow> WB_Sort.quicksort R h (0, length xs - 1, xs) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs = [] \<Longrightarrow> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs
[PROOF STEP]
by simp \<comment> \<open>case xs=[]\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> WB_Sort.quicksort R h (0, length xs - 1, xs) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
apply (rule quicksort_correct[THEN order_trans])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x y z. \<lbrakk>xs \<noteq> []; R (h x) (h y); R (h y) (h z)\<rbrakk> \<Longrightarrow> R (h x) (h z)
 2. \<And>x y. \<lbrakk>xs \<noteq> []; x \<noteq> y\<rbrakk> \<Longrightarrow> R (h x) (h y) \<or> R (h y) (h x)
 3. xs \<noteq> [] \<Longrightarrow> 0 \<le> length xs - 1
 4. xs \<noteq> [] \<Longrightarrow> length xs - 1 < length xs
 5. xs \<noteq> [] \<Longrightarrow> \<Down> Id (SPEC (quicksort_post R h 0 (length xs - 1) xs)) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; R (h x_) (h y_); R (h y_) (h z_)\<rbrakk> \<Longrightarrow> R (h x_) (h z_)
[PROOF STEP]
by (rule trans)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<And>x y. \<lbrakk>xs \<noteq> []; x \<noteq> y\<rbrakk> \<Longrightarrow> R (h x) (h y) \<or> R (h y) (h x)
 2. xs \<noteq> [] \<Longrightarrow> 0 \<le> length xs - 1
 3. xs \<noteq> [] \<Longrightarrow> length xs - 1 < length xs
 4. xs \<noteq> [] \<Longrightarrow> \<Down> Id (SPEC (quicksort_post R h 0 (length xs - 1) xs)) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; x_ \<noteq> y_\<rbrakk> \<Longrightarrow> R (h x_) (h y_) \<or> R (h y_) (h x_)
[PROOF STEP]
by (rule lin)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. xs \<noteq> [] \<Longrightarrow> 0 \<le> length xs - 1
 2. xs \<noteq> [] \<Longrightarrow> length xs - 1 < length xs
 3. xs \<noteq> [] \<Longrightarrow> \<Down> Id (SPEC (quicksort_post R h 0 (length xs - 1) xs)) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> 0 \<le> length xs - 1
[PROOF STEP]
by linarith
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. xs \<noteq> [] \<Longrightarrow> length xs - 1 < length xs
 2. xs \<noteq> [] \<Longrightarrow> \<Down> Id (SPEC (quicksort_post R h 0 (length xs - 1) xs)) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> length xs - 1 < length xs
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<noteq> [] \<Longrightarrow> \<Down> Id (SPEC (quicksort_post R h 0 (length xs - 1) xs)) \<le> SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs')
[PROOF STEP]
apply (simp add: Misc.subset_Collect_conv, intro allI impI conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>xs \<noteq> []; quicksort_post R h 0 (length xs - Suc 0) xs x\<rbrakk> \<Longrightarrow> mset x = mset xs
 2. \<And>x. \<lbrakk>xs \<noteq> []; quicksort_post R h 0 (length xs - Suc 0) xs x\<rbrakk> \<Longrightarrow> sorted_wrt (\<lambda>x y. R (h x) (h y)) x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; quicksort_post R h 0 (length xs - Suc 0) xs x_\<rbrakk> \<Longrightarrow> mset x_ = mset xs
[PROOF STEP]
by (auto simp add: quicksort_post_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>xs \<noteq> []; quicksort_post R h 0 (length xs - Suc 0) xs x\<rbrakk> \<Longrightarrow> sorted_wrt (\<lambda>x y. R (h x) (h y)) x
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; quicksort_post R h 0 (length xs - Suc 0) xs x_\<rbrakk> \<Longrightarrow> sorted_wrt (\<lambda>x y. R (h x) (h y)) x_
[PROOF STEP]
apply (rule sorted_sublist_map_entire)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs \<noteq> []; quicksort_post R h 0 (length xs - Suc 0) xs x_\<rbrakk> \<Longrightarrow> sorted_sublist_map R h x_ 0 (length x_ - 1)
[PROOF STEP]
by (auto simp add: quicksort_post_def dest: mset_eq_length)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
full_quicksort R h xs \<le> \<Down> Id (SPEC (\<lambda>xs'. mset xs' = mset xs \<and> sorted_wrt (\<lambda>x y. R (h x) (h y)) xs'))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma higher_differentiable_Taylor1:
  fixes f::"'a::real_normed_vector \<Rightarrow> 'b::banach"
  assumes hd: "higher_differentiable_on S f 2" "open S"
  assumes cs: "closed_segment X (X + H) \<subseteq> S"
  defines "i \<equiv> \<lambda>x. ((1 - x)) *\<^sub>R nth_derivative 2 f (X + x *\<^sub>R H) H"
  shows "(i has_integral f (X + H) - (f X + nth_derivative 1 f X H)) {0..1}"
    and "f (X + H) = f X + nth_derivative 1 f X H + integral {0..1} i"
    and "i integrable_on {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i has_integral f (X + H) - (f X + nth_derivative 1 f X H)) {0..1} &&& f (X + H) = f X + nth_derivative 1 f X H + integral {0..1} i &&& i integrable_on {0..1}
[PROOF STEP]
using higher_differentiable_Taylor[OF _ hd cs]
[PROOF STATE]
proof (prove)
using this:
0 < 2 \<Longrightarrow> ((\<lambda>x. ((1 - x) ^ (2 - 1) / fact (2 - 1)) *\<^sub>R nth_derivative 2 f (X + x *\<^sub>R H) H) has_integral f (X + H) - (\<Sum>i<2. (1 / fact i) *\<^sub>R nth_derivative i f X H)) {0..1}
0 < 2 \<Longrightarrow> f (X + H) = (\<Sum>i<2. (1 / fact i) *\<^sub>R nth_derivative i f X H) + integral {0..1} (\<lambda>x. ((1 - x) ^ (2 - 1) / fact (2 - 1)) *\<^sub>R nth_derivative 2 f (X + x *\<^sub>R H) H)
0 < 2 \<Longrightarrow> (\<lambda>x. ((1 - x) ^ (2 - 1) / fact (2 - 1)) *\<^sub>R nth_derivative 2 f (X + x *\<^sub>R H) H) integrable_on {0..1}

goal (1 subgoal):
 1. (i has_integral f (X + H) - (f X + nth_derivative 1 f X H)) {0..1} &&& f (X + H) = f X + nth_derivative 1 f X H + integral {0..1} i &&& i integrable_on {0..1}
[PROOF STEP]
by (auto simp: numeral_2_eq_2 i_def)


[STATEMENT]
lemma [code_post]:
 "(of_rat (- (1 / numeral k)) :: real) = - 1 / numeral k"
 "(of_rat (- (numeral k / numeral l)) :: real) = - numeral k / numeral l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_rat (- (1 / numeral k)) = - 1 / numeral k &&& real_of_rat (- (numeral k / numeral l)) = - numeral k / numeral l
[PROOF STEP]
by (simp_all add: of_rat_divide of_rat_minus)


[STATEMENT]
lemma word_induct: "P 0 \<Longrightarrow> (\<And>n. P n \<Longrightarrow> P (1 + n)) \<Longrightarrow> P m"
  for P :: "'a::len word \<Rightarrow> bool"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P 0; \<And>n. P n \<Longrightarrow> P (1 + n)\<rbrakk> \<Longrightarrow> P m
[PROOF STEP]
by (rule word_induct_less)


[STATEMENT]
lemma BfunE:
  assumes "Bfun f F"
  obtains B where "0 < B" and "eventually (\<lambda>x. norm (f x) \<le> B) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>\<^sub>F x in F. norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Bfun f F

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>\<^sub>F x in F. norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Bfun_def
[PROOF STATE]
proof (prove)
using this:
\<exists>K>0. \<forall>\<^sub>F x in F. norm (f x) \<le> K

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<forall>\<^sub>F x in F. norm (f x) \<le> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast


[STATEMENT]
lemma mset_empty_count[simp]: "(\<forall>p. count M p = 0) = (M={#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>p. count M p = 0) = (M = {#})
[PROOF STEP]
by (auto simp add: multiset_eq_iff)


[STATEMENT]
lemma one_minus_fps_X_const_neg_power:
  "inverse ((1 - fps_const c * fps_X) ^ n) =
       fps_compose (fps_binomial (-of_nat n)) (-fps_const c * fps_X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X
[PROOF STEP]
proof (cases "c = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X
 2. c \<noteq> (0::'a) \<Longrightarrow> inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
c \<noteq> (0::'a)

goal (2 subgoals):
 1. c = (0::'a) \<Longrightarrow> inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X
 2. c \<noteq> (0::'a) \<Longrightarrow> inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)

goal (1 subgoal):
 1. inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X
[PROOF STEP]
by (subst fps_binomial_minus_of_nat)
     (simp add: fps_compose_power [symmetric] fps_inverse_compose fps_compose_add_distrib
                fps_const_neg [symmetric] del: fps_const_neg)
[PROOF STATE]
proof (state)
this:
inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X

goal (1 subgoal):
 1. c = (0::'a) \<Longrightarrow> inverse ((1 - fps_const c * fps_X) ^ n) = fps_binomial (- of_nat n) oo - fps_const c * fps_X
[PROOF STEP]
qed simp