[STATEMENT]
lemma nth_transpose:
  fixes xs :: "'a list list"
  assumes "i < length (transpose xs)"
  shows "transpose xs ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose xs ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < length (transpose xs)

goal (1 subgoal):
 1. transpose xs ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xs)
[PROOF STEP]
proof (induct arbitrary: i rule: transpose.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i. i < length (transpose []) \<Longrightarrow> transpose [] ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) [])
 2. \<And>xss i. \<lbrakk>\<And>i. i < length (transpose xss) \<Longrightarrow> transpose xss ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xss); i < length (transpose ([] # xss))\<rbrakk> \<Longrightarrow> transpose ([] # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ([] # xss))
 3. \<And>x xs xss i. \<lbrakk>\<And>i. i < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))) \<Longrightarrow> transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))); i < length (transpose ((x # xs) # xss))\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
case (3 x xs xss)
[PROOF STATE]
proof (state)
this:
?i < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))) \<Longrightarrow> transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)) ! ?i = map (\<lambda>xs. xs ! ?i) (filter (\<lambda>ys. ?i < length ys) (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)))
i < length (transpose ((x # xs) # xss))

goal (3 subgoals):
 1. \<And>i. i < length (transpose []) \<Longrightarrow> transpose [] ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) [])
 2. \<And>xss i. \<lbrakk>\<And>i. i < length (transpose xss) \<Longrightarrow> transpose xss ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xss); i < length (transpose ([] # xss))\<rbrakk> \<Longrightarrow> transpose ([] # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ([] # xss))
 3. \<And>x xs xss i. \<lbrakk>\<And>i. i < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))) \<Longrightarrow> transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))); i < length (transpose ((x # xs) # xss))\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
define XS where "XS = (x # xs) # xss"
[PROOF STATE]
proof (state)
this:
XS = (x # xs) # xss

goal (3 subgoals):
 1. \<And>i. i < length (transpose []) \<Longrightarrow> transpose [] ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) [])
 2. \<And>xss i. \<lbrakk>\<And>i. i < length (transpose xss) \<Longrightarrow> transpose xss ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xss); i < length (transpose ([] # xss))\<rbrakk> \<Longrightarrow> transpose ([] # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ([] # xss))
 3. \<And>x xs xss i. \<lbrakk>\<And>i. i < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))) \<Longrightarrow> transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))); i < length (transpose ((x # xs) # xss))\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
hence [simp]: "XS \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
XS = (x # xs) # xss

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

goal (3 subgoals):
 1. \<And>i. i < length (transpose []) \<Longrightarrow> transpose [] ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) [])
 2. \<And>xss i. \<lbrakk>\<And>i. i < length (transpose xss) \<Longrightarrow> transpose xss ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xss); i < length (transpose ([] # xss))\<rbrakk> \<Longrightarrow> transpose ([] # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ([] # xss))
 3. \<And>x xs xss i. \<lbrakk>\<And>i. i < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))) \<Longrightarrow> transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))); i < length (transpose ((x # xs) # xss))\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
XS \<noteq> []

goal (1 subgoal):
 1. transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
proof (cases i)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>XS \<noteq> []; i = 0\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
 2. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
i = 0

goal (2 subgoals):
 1. \<lbrakk>XS \<noteq> []; i = 0\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
 2. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
i = 0

goal (1 subgoal):
 1. transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
by (simp add: transpose_aux_filter_head hd_conv_nth)
[PROOF STATE]
proof (state)
this:
transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
case (Suc j)
[PROOF STATE]
proof (state)
this:
i = Suc j

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
have *: "\<And>xss. xs # map tl xss = map tl ((x#xs)#xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xss. xs # map tl xss = map tl ((x # xs) # xss)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
xs # map tl ?xss = map tl ((x # xs) # ?xss)

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
have **: "\<And>xss. (x#xs) # filter (\<lambda>ys. ys \<noteq> []) xss = filter (\<lambda>ys. ys \<noteq> []) ((x#xs)#xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xss. (x # xs) # filter (\<lambda>ys. ys \<noteq> []) xss = filter (\<lambda>ys. ys \<noteq> []) ((x # xs) # xss)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x # xs) # filter (\<lambda>ys. ys \<noteq> []) ?xss = filter (\<lambda>ys. ys \<noteq> []) ((x # xs) # ?xss)

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(x # xs) # filter (\<lambda>ys. ys \<noteq> []) ?xss = filter (\<lambda>ys. ys \<noteq> []) ((x # xs) # ?xss)

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
fix xs :: \<open>'a list\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xsa__) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xsa__) # xss))
[PROOF STEP]
have "Suc j < length xs \<longleftrightarrow> xs \<noteq> [] \<and> j < length xs - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc j < length xs) = (xs \<noteq> [] \<and> j < length xs - Suc 0)
[PROOF STEP]
by (cases xs) simp_all
[PROOF STATE]
proof (state)
this:
(Suc j < length xs) = (xs \<noteq> [] \<and> j < length xs - Suc 0)

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xsa__) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xsa__) # xss))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
(Suc j < length ?xsb2) = (?xsb2 \<noteq> [] \<and> j < length ?xsb2 - Suc 0)

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
note *** = this
[PROOF STATE]
proof (state)
this:
(Suc j < length ?xsb2) = (?xsb2 \<noteq> [] \<and> j < length ?xsb2 - Suc 0)

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
have j_less: "j < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)))
[PROOF STEP]
using "3.prems"
[PROOF STATE]
proof (prove)
using this:
i < length (transpose ((x # xs) # xss))

goal (1 subgoal):
 1. j < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)))
[PROOF STEP]
by (simp add: transpose_aux_filter_tail length_transpose Suc)
[PROOF STATE]
proof (state)
this:
j < length (transpose (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss)))

goal (1 subgoal):
 1. \<And>nat. \<lbrakk>XS \<noteq> []; i = Suc nat\<rbrakk> \<Longrightarrow> transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))
[PROOF STEP]
unfolding transpose.simps \<open>i = Suc j\<close> nth_Cons_Suc "3.hyps"[OF j_less]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (\<lambda>xs. xs ! j) (filter (\<lambda>ys. j < length ys) (xs # concat (map (case_list [] (\<lambda>h t. [t])) xss))) = map (\<lambda>xs. xs ! Suc j) (filter (\<lambda>ys. Suc j < length ys) ((x # xs) # xss))
[PROOF STEP]
apply (auto simp: transpose_aux_filter_tail filter_map comp_def length_transpose * ** *** XS_def[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> set XS; x \<noteq> []; j < length x - Suc 0\<rbrakk> \<Longrightarrow> tl x ! j = x ! Suc j
[PROOF STEP]
by (simp add: nth_tl)
[PROOF STATE]
proof (state)
this:
transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
transpose ((x # xs) # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ((x # xs) # xss))

goal (2 subgoals):
 1. \<And>i. i < length (transpose []) \<Longrightarrow> transpose [] ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) [])
 2. \<And>xss i. \<lbrakk>\<And>i. i < length (transpose xss) \<Longrightarrow> transpose xss ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) xss); i < length (transpose ([] # xss))\<rbrakk> \<Longrightarrow> transpose ([] # xss) ! i = map (\<lambda>xs. xs ! i) (filter (\<lambda>ys. i < length ys) ([] # xss))
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma col_elems_ss01:
  assumes "j < dim_col M"
  shows "vec_set (col M j) \<subseteq> {0, 1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set\<^sub>v (col M j) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set\<^sub>v (col M j) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
have "vec_set (col M j) \<subseteq> elements_mat M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set\<^sub>v (col M j) \<subseteq> elements_mat M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
j < dim_col M

goal (1 subgoal):
 1. set\<^sub>v (col M j) \<subseteq> elements_mat M
[PROOF STEP]
by (simp add: col_elems_subset_mat assms)
[PROOF STATE]
proof (state)
this:
set\<^sub>v (col M j) \<subseteq> elements_mat M

goal (1 subgoal):
 1. set\<^sub>v (col M j) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set\<^sub>v (col M j) \<subseteq> elements_mat M

goal (1 subgoal):
 1. set\<^sub>v (col M j) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
using elems01
[PROOF STATE]
proof (prove)
using this:
set\<^sub>v (col M j) \<subseteq> elements_mat M
elements_mat M \<subseteq> {0::'b, 1::'b}

goal (1 subgoal):
 1. set\<^sub>v (col M j) \<subseteq> {0::'b, 1::'b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set\<^sub>v (col M j) \<subseteq> {0::'b, 1::'b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pre_zeta_aux_eq_pre_zeta:
  assumes "Re s > -2 * real n" and "a > 0"
  shows   "pre_zeta_aux n a s = pre_zeta a s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre_zeta_aux n a s = pre_zeta a s
[PROOF STEP]
unfolding pre_zeta_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pre_zeta_aux n a s = pre_zeta_aux (nat (1 - \<lceil>Re s / 2\<rceil>)) a s
[PROOF STEP]
proof (intro pre_zeta_aux_eq')
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 0 < a
 2. - 2 * real n < Re s
 3. - 2 * real (nat (1 - \<lceil>Re s / 2\<rceil>)) < Re s
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
- 2 * real n < Re s
0 < a
[PROOF STEP]
show "- 2 * real (nat (1 - \<lceil>Re s / 2\<rceil>)) < Re s"
[PROOF STATE]
proof (prove)
using this:
- 2 * real n < Re s
0 < a

goal (1 subgoal):
 1. - 2 * real (nat (1 - \<lceil>Re s / 2\<rceil>)) < Re s
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
- 2 * real (nat (1 - \<lceil>Re s / 2\<rceil>)) < Re s

goal (2 subgoals):
 1. 0 < a
 2. - 2 * real n < Re s
[PROOF STEP]
qed (insert assms, simp_all)


[STATEMENT]
lemma chain_boundary_diff:
   "chain_boundary p (a-b) = chain_boundary p a - chain_boundary p b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. chain_boundary p (a - b) = chain_boundary p a - chain_boundary p b
[PROOF STEP]
using chain_boundary_add [of p a "-b"]
[PROOF STATE]
proof (prove)
using this:
chain_boundary p (a + - b) = chain_boundary p a + chain_boundary p (- b)

goal (1 subgoal):
 1. chain_boundary p (a - b) = chain_boundary p a - chain_boundary p b
[PROOF STEP]
by (simp add: chain_boundary_minus)


[STATEMENT]
lemma smult_monom_mult: "smult a (monom b n * f) = monom (a * b) n * f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. smult a (monom b n * f) = monom (a * b) n * f
[PROOF STEP]
using smult_monom [of a _ n]
[PROOF STATE]
proof (prove)
using this:
smult a (monom ?b n) = monom (a * ?b) n

goal (1 subgoal):
 1. smult a (monom b n * f) = monom (a * b) n * f
[PROOF STEP]
by (metis mult_smult_left)


[STATEMENT]
lemma prod_rel_def[refine_rel_defs]:
  "(\<langle>R1,R2\<rangle>prod_rel) \<equiv> { ((a,b),(a',b')) . (a,a')\<in>R1 \<and> (b,b')\<in>R2 }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R1 \<times>\<^sub>r R2 \<equiv> {((a, b), a', b'). (a, a') \<in> R1 \<and> (b, b') \<in> R2}
[PROOF STEP]
by (simp add: prod_rel_def_internal relAPP_def)


[STATEMENT]
lemma or_wf_dfa:
  assumes "wf_dfa M n" and "wf_dfa N n"
  shows "wf_dfa (or_dfa M N) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_dfa (or_dfa M N) n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wf_dfa M n
wf_dfa N n

goal (1 subgoal):
 1. wf_dfa (or_dfa M N) n
[PROOF STEP]
by (simp add: or_dfa_def binop_wf_dfa)


[STATEMENT]
lemma quotient_of_denom_pos': "snd (quotient_of r) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < snd (quotient_of r)
[PROOF STEP]
using quotient_of_denom_pos [of r]
[PROOF STATE]
proof (prove)
using this:
quotient_of r = (?p, ?q) \<Longrightarrow> 0 < ?q

goal (1 subgoal):
 1. 0 < snd (quotient_of r)
[PROOF STEP]
by (simp add: prod_eq_iff)


[STATEMENT]
lemma ortho_span_span: assumes W: "W \<subseteq> carrier_vec n"
  and X: "X \<subseteq> carrier_vec n"
  and ortho: "\<And> w x. w \<in> W \<Longrightarrow> x \<in> X \<Longrightarrow> w \<bullet> x = 0"
  and w: "w \<in> span W" and x: "x \<in> span X"
shows "w \<bullet> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w \<bullet> x = (0::'a)
[PROOF STEP]
by (rule ortho_span[OF W _ ortho_span'[OF X W _ _] w x], insert W X ortho, auto)


[STATEMENT]
lemma summable_arctan_series:
  fixes n :: nat
  assumes "\<bar>x\<bar> \<le> 1"
  shows "summable (\<lambda> k. (-1)^k * (1 / real (k*2+1) * x ^ (k*2+1)))"
    (is "summable (?c x)")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>k. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))
[PROOF STEP]
by (rule summable_Leibniz(1),
      rule zeroseq_arctan_series[OF assms],
      rule monoseq_arctan_series[OF assms])


[STATEMENT]
lemma r_rtranclp_rtranclp: "\<lbrakk>r x y; r\<^sup>*\<^sup>* y z\<rbrakk> \<Longrightarrow> r\<^sup>*\<^sup>* x z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r x y; r\<^sup>*\<^sup>* y z\<rbrakk> \<Longrightarrow> r\<^sup>*\<^sup>* x z
[PROOF STEP]
by auto


[STATEMENT]
lemma card_insert_disjointI:
  "\<lbrakk> finite Y; X = insert x Y; x\<notin>Y \<rbrakk> \<Longrightarrow> card X = Suc (card Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite Y; X = insert x Y; x \<notin> Y\<rbrakk> \<Longrightarrow> card X = Suc (card Y)
[PROOF STEP]
by auto


[STATEMENT]
lemma zero_less_ceiling [simp]: "0 < \<lceil>x\<rceil> \<longleftrightarrow> 0 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < \<lceil>x\<rceil>) = ((0::'a) < x)
[PROOF STEP]
by (simp add: less_ceiling_iff)


[STATEMENT]
theorem Drinker's_Principle: "\<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
 2. \<not> ?P \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
assume "\<forall>x. drunk x"
[PROOF STATE]
proof (state)
this:
\<forall>x. drunk x

goal (2 subgoals):
 1. ?P \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
 2. \<not> ?P \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. drunk x
[PROOF STEP]
have "drunk a \<longrightarrow> (\<forall>x. drunk x)" for a
[PROOF STATE]
proof (prove)
using this:
\<forall>x. drunk x

goal (1 subgoal):
 1. drunk a \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
drunk ?a \<longrightarrow> (\<forall>x. drunk x)

goal (2 subgoals):
 1. ?P \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
 2. \<not> ?P \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
drunk ?a \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
drunk ?a \<longrightarrow> (\<forall>x. drunk x)

goal (1 subgoal):
 1. \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)

goal (1 subgoal):
 1. \<not> (\<forall>x. drunk x) \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>x. drunk x) \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
assume "\<not> (\<forall>x. drunk x)"
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>x. drunk x)

goal (1 subgoal):
 1. \<not> (\<forall>x. drunk x) \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<forall>x. drunk x)
[PROOF STEP]
have "\<exists>x. \<not> drunk x"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<forall>x. drunk x)

goal (1 subgoal):
 1. \<exists>x. \<not> drunk x
[PROOF STEP]
by (rule de_Morgan)
[PROOF STATE]
proof (state)
this:
\<exists>x. \<not> drunk x

goal (1 subgoal):
 1. \<not> (\<forall>x. drunk x) \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. \<not> drunk x
[PROOF STEP]
obtain a where "\<not> drunk a"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. \<not> drunk x

goal (1 subgoal):
 1. (\<And>a. \<not> drunk a \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<not> drunk a

goal (1 subgoal):
 1. \<not> (\<forall>x. drunk x) \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
have "drunk a \<longrightarrow> (\<forall>x. drunk x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drunk a \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. drunk a \<Longrightarrow> \<forall>x. drunk x
[PROOF STEP]
assume "drunk a"
[PROOF STATE]
proof (state)
this:
drunk a

goal (1 subgoal):
 1. drunk a \<Longrightarrow> \<forall>x. drunk x
[PROOF STEP]
with \<open>\<not> drunk a\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> drunk a
drunk a
[PROOF STEP]
show "\<forall>x. drunk x"
[PROOF STATE]
proof (prove)
using this:
\<not> drunk a
drunk a

goal (1 subgoal):
 1. \<forall>x. drunk x
[PROOF STEP]
by contradiction
[PROOF STATE]
proof (state)
this:
\<forall>x. drunk x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
drunk a \<longrightarrow> (\<forall>x. drunk x)

goal (1 subgoal):
 1. \<not> (\<forall>x. drunk x) \<Longrightarrow> \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
drunk a \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
drunk a \<longrightarrow> (\<forall>x. drunk x)

goal (1 subgoal):
 1. \<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>x. drunk x \<longrightarrow> (\<forall>x. drunk x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_poincare_line_points:
  assumes "is_poincare_line H"
  shows "\<exists> u v. u \<in> unit_disc \<and> v \<in> unit_disc \<and> u \<noteq> v \<and> H = poincare_line u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>u v. u \<in> unit_disc \<and> v \<in> unit_disc \<and> u \<noteq> v \<and> H = poincare_line u v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H

goal (1 subgoal):
 1. \<exists>u v. u \<in> unit_disc \<and> v \<in> unit_disc \<and> u \<noteq> v \<and> H = poincare_line u v
[PROOF STEP]
using ex_is_poincare_line_points
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H
is_poincare_line ?H \<Longrightarrow> \<exists>u v. u \<in> unit_disc \<and> v \<in> unit_disc \<and> u \<noteq> v \<and> {u, v} \<subseteq> circline_set ?H

goal (1 subgoal):
 1. \<exists>u v. u \<in> unit_disc \<and> v \<in> unit_disc \<and> u \<noteq> v \<and> H = poincare_line u v
[PROOF STEP]
using unique_poincare_line[where l=H]
[PROOF STATE]
proof (prove)
using this:
is_poincare_line H
is_poincare_line ?H \<Longrightarrow> \<exists>u v. u \<in> unit_disc \<and> v \<in> unit_disc \<and> u \<noteq> v \<and> {u, v} \<subseteq> circline_set ?H
\<lbrakk>?u \<noteq> ?v; ?u \<in> unit_disc; ?v \<in> unit_disc; ?u \<in> circline_set H; ?v \<in> circline_set H; is_poincare_line H\<rbrakk> \<Longrightarrow> H = poincare_line ?u ?v

goal (1 subgoal):
 1. \<exists>u v. u \<in> unit_disc \<and> v \<in> unit_disc \<and> u \<noteq> v \<and> H = poincare_line u v
[PROOF STEP]
by fastforce


[STATEMENT]
lemma LeadsTo_UN_UN_noindex:
     "(!!i. F \<in> (A i) LeadsTo (A' i)) ==> F \<in> (\<Union>i. A i) LeadsTo (\<Union>i. A' i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. F \<in> A i \<longmapsto>w A' i) \<Longrightarrow> F \<in> \<Union> (range A) \<longmapsto>w \<Union> (range A')
[PROOF STEP]
by (blast intro: LeadsTo_UN_UN)


[STATEMENT]
lemma Inf_trans_greatest:
  "\<lbrakk> S \<noteq> {}; \<forall>t\<in>S. \<forall>P. le_trans u t \<rbrakk> \<Longrightarrow> le_trans u (Inf_trans S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<noteq> {}; \<forall>t\<in>S. \<forall>P. le_trans u t\<rbrakk> \<Longrightarrow> le_trans u (Inf_trans S)
[PROOF STEP]
unfolding Inf_trans_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<noteq> {}; \<forall>t\<in>S. \<forall>P. le_trans u t\<rbrakk> \<Longrightarrow> le_trans u (\<lambda>P. Inf_exp {t P |t. t \<in> S})
[PROOF STEP]
by(auto intro!:le_transI[OF Inf_exp_greatest])


[STATEMENT]
lemma eventually_going_to_at:
  "eventually P (f going_to (at a within B) within A) \<longleftrightarrow>
     (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>A. f x \<in> B \<inter> S - {a} \<longrightarrow> P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (f going_to at a within B within A) = (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>A. f x \<in> B \<inter> S - {a} \<longrightarrow> P x))
[PROOF STEP]
unfolding at_within_def going_to_inf eventually_inf_principal
            eventually_going_to_nhds going_to_principal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>A. f x \<in> S \<longrightarrow> x \<in> f -` (B - {a}) \<inter> A \<longrightarrow> P x)) = (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>A. f x \<in> B \<inter> S - {a} \<longrightarrow> P x))
[PROOF STEP]
by fast


[STATEMENT]
lemma iMin_subset: "\<lbrakk> A \<noteq> {}; A \<subseteq> B \<rbrakk> \<Longrightarrow> iMin B \<le> iMin A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<noteq> {}; A \<subseteq> B\<rbrakk> \<Longrightarrow> iMin B \<le> iMin A
[PROOF STEP]
by (blast intro: iMin_le iMinI_ex2)


[STATEMENT]
lemma (in field)
  assumes "finite S"
  assumes "S \<subseteq> carrier R"
  assumes "x \<in> carrier R - S"
  shows
    lagrange_one: "eval (lagrange_basis_polynomial S x) x = \<one>" and
    lagrange_degree: "degree (lagrange_basis_polynomial S x) \<le> card S" and
    lagrange_zero: "\<And>s. s \<in> S \<Longrightarrow> eval (lagrange_basis_polynomial S x) s = \<zero>" and
    lagrange_poly: "lagrange_basis_polynomial S x \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (local.eval (lagrange_basis_polynomial S x) x = \<one> &&& degree (lagrange_basis_polynomial S x) \<le> card S) &&& (\<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>) &&& lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
interpret x:ring_hom_cring "poly_ring R" "R" "(\<lambda>p. eval p x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_cring (poly_ring R) R (\<lambda>p. local.eval p x)
[PROOF STEP]
using assms carrier_is_subring eval_cring_hom
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> carrier R
x \<in> carrier R - S
subring (carrier R) R
\<lbrakk>subring ?K R; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> ring_hom_cring (?K [X]) R (\<lambda>p. local.eval p ?a)

goal (1 subgoal):
 1. ring_hom_cring (poly_ring R) R (\<lambda>p. local.eval p x)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
define p where "p = lagrange_basis_polynomial_aux S"
[PROOF STATE]
proof (state)
this:
p = lagrange_basis_polynomial_aux S

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
have a:"eval p x = (\<Otimes>s \<in> S. x \<ominus> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval p x = finprod R (a_minus R x) S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> carrier R
x \<in> carrier R - S

goal (1 subgoal):
 1. local.eval p x = finprod R (a_minus R x) S
[PROOF STEP]
by (simp add:p_def lagrange_aux_eval)
[PROOF STATE]
proof (state)
this:
local.eval p x = finprod R (a_minus R x) S

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
have b:"p \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<in> carrier (poly_ring R)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> carrier R
x \<in> carrier R - S

goal (1 subgoal):
 1. p \<in> carrier (poly_ring R)
[PROOF STEP]
by (simp add:p_def lagrange_aux_poly)
[PROOF STATE]
proof (state)
this:
p \<in> carrier (poly_ring R)

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
have "\<And>y. y \<in> S \<Longrightarrow> a_minus R x y \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> S \<Longrightarrow> x \<ominus> y \<in> carrier R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
S \<subseteq> carrier R
x \<in> carrier R - S

goal (1 subgoal):
 1. \<And>y. y \<in> S \<Longrightarrow> x \<ominus> y \<in> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?y \<in> S \<Longrightarrow> x \<ominus> ?y \<in> carrier R

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
hence c:"finprod R (a_minus R x) S \<in> Units R"
[PROOF STATE]
proof (prove)
using this:
?y \<in> S \<Longrightarrow> x \<ominus> ?y \<in> carrier R

goal (1 subgoal):
 1. finprod R (a_minus R x) S \<in> Units R
[PROOF STEP]
using finprod_closed[OF Pi_I] assms
[PROOF STATE]
proof (prove)
using this:
?y \<in> S \<Longrightarrow> x \<ominus> ?y \<in> carrier R
(\<And>x. x \<in> ?A \<Longrightarrow> ?f x \<in> carrier R) \<Longrightarrow> finprod R ?f ?A \<in> carrier R
finite S
S \<subseteq> carrier R
x \<in> carrier R - S

goal (1 subgoal):
 1. finprod R (a_minus R x) S \<in> Units R
[PROOF STEP]
by (auto simp add:field_Units finprod_zero_iff)
[PROOF STATE]
proof (state)
this:
finprod R (a_minus R x) S \<in> Units R

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
have "eval (lagrange_basis_polynomial S x) x =
    (\<Otimes>s \<in> S. x \<ominus> s) \<otimes> eval (poly_of_const (inv finprod R (a_minus R x) S)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial S x) x = finprod R (a_minus R x) S \<otimes> local.eval (poly_of_const (inv finprod R (a_minus R x) S)) x
[PROOF STEP]
using poly_of_const_in_carrier Units_inv_closed c p_def[symmetric]
[PROOF STATE]
proof (prove)
using this:
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
?x \<in> Units R \<Longrightarrow> inv ?x \<in> carrier R
finprod R (a_minus R x) S \<in> Units R
lagrange_basis_polynomial_aux S = p

goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial S x) x = finprod R (a_minus R x) S \<otimes> local.eval (poly_of_const (inv finprod R (a_minus R x) S)) x
[PROOF STEP]
by (simp add: lagrange_basis_polynomial_def x.hom_mult[OF b] a)
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial S x) x = finprod R (a_minus R x) S \<otimes> local.eval (poly_of_const (inv finprod R (a_minus R x) S)) x

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial S x) x = finprod R (a_minus R x) S \<otimes> local.eval (poly_of_const (inv finprod R (a_minus R x) S)) x

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
have "... =  \<one>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod R (a_minus R x) S \<otimes> local.eval (poly_of_const (inv finprod R (a_minus R x) S)) x = \<one>
[PROOF STEP]
using poly_of_const_in_carrier Units_inv_closed c eval_poly_of_const
[PROOF STATE]
proof (prove)
using this:
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
?x \<in> Units R \<Longrightarrow> inv ?x \<in> carrier R
finprod R (a_minus R x) S \<in> Units R
?x \<in> carrier R \<Longrightarrow> local.eval (poly_of_const ?x) ?y = ?x

goal (1 subgoal):
 1. finprod R (a_minus R x) S \<otimes> local.eval (poly_of_const (inv finprod R (a_minus R x) S)) x = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finprod R (a_minus R x) S \<otimes> local.eval (poly_of_const (inv finprod R (a_minus R x) S)) x = \<one>

goal (4 subgoals):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
 2. degree (lagrange_basis_polynomial S x) \<le> card S
 3. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 4. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.eval (lagrange_basis_polynomial S x) x = \<one>
[PROOF STEP]
show "eval (lagrange_basis_polynomial S x) x = \<one>"
[PROOF STATE]
proof (prove)
using this:
local.eval (lagrange_basis_polynomial S x) x = \<one>

goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial S x) x = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial S x) x = \<one>

goal (3 subgoals):
 1. degree (lagrange_basis_polynomial S x) \<le> card S
 2. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 3. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
have "degree (lagrange_basis_polynomial S x) \<le> degree p + degree (poly_of_const (inv finprod R (a_minus R x) S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (lagrange_basis_polynomial S x) \<le> degree p + degree (poly_of_const (inv finprod R (a_minus R x) S))
[PROOF STEP]
unfolding lagrange_basis_polynomial_def p_def[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (inv finprod R (a_minus R x) S)) \<le> degree p + degree (poly_of_const (inv finprod R (a_minus R x) S))
[PROOF STEP]
using poly_mult_degree_le[OF b] poly_of_const_in_carrier Units_inv_closed c
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?y \<in> carrier (poly_ring R); degree p \<le> ?n; degree ?y \<le> ?m\<rbrakk> \<Longrightarrow> degree (p \<otimes>\<^bsub>poly_ring R\<^esub> ?y) \<le> ?n + ?m
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
?x \<in> Units R \<Longrightarrow> inv ?x \<in> carrier R
finprod R (a_minus R x) S \<in> Units R

goal (1 subgoal):
 1. degree (p \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (inv finprod R (a_minus R x) S)) \<le> degree p + degree (poly_of_const (inv finprod R (a_minus R x) S))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (lagrange_basis_polynomial S x) \<le> degree p + degree (poly_of_const (inv finprod R (a_minus R x) S))

goal (3 subgoals):
 1. degree (lagrange_basis_polynomial S x) \<le> card S
 2. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 3. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree (lagrange_basis_polynomial S x) \<le> degree p + degree (poly_of_const (inv finprod R (a_minus R x) S))

goal (3 subgoals):
 1. degree (lagrange_basis_polynomial S x) \<le> card S
 2. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 3. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
have "... \<le> card S + 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p + degree (poly_of_const (inv finprod R (a_minus R x) S)) \<le> card S + 0
[PROOF STEP]
using add_mono lagrange_aux_degree[OF assms(1) assms(2)] p_def poly_of_const_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<le> ?b; ?c \<le> ?d\<rbrakk> \<Longrightarrow> ?a + ?c \<le> ?b + ?d
degree (lagrange_basis_polynomial_aux S) \<le> card S
p = lagrange_basis_polynomial_aux S
poly_of_const = (\<lambda>k. local.normalize [k])

goal (1 subgoal):
 1. degree p + degree (poly_of_const (inv finprod R (a_minus R x) S)) \<le> card S + 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree p + degree (poly_of_const (inv finprod R (a_minus R x) S)) \<le> card S + 0

goal (3 subgoals):
 1. degree (lagrange_basis_polynomial S x) \<le> card S
 2. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 3. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree (lagrange_basis_polynomial S x) \<le> card S + 0
[PROOF STEP]
show "degree (lagrange_basis_polynomial S x) \<le> card S"
[PROOF STATE]
proof (prove)
using this:
degree (lagrange_basis_polynomial S x) \<le> card S + 0

goal (1 subgoal):
 1. degree (lagrange_basis_polynomial S x) \<le> card S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (lagrange_basis_polynomial S x) \<le> card S

goal (2 subgoals):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
 2. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
show "\<And>s. s \<in> S \<Longrightarrow> eval (lagrange_basis_polynomial S x) s = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
assume d:"s \<in> S"
[PROOF STATE]
proof (state)
this:
s \<in> S

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
interpret s:ring_hom_cring "poly_ring R" "R" "(\<lambda>p. eval p s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_cring (poly_ring R) R (\<lambda>p. local.eval p s)
[PROOF STEP]
using eval_cring_hom carrier_is_subring assms d
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subring ?K R; ?a \<in> carrier R\<rbrakk> \<Longrightarrow> ring_hom_cring (?K [X]) R (\<lambda>p. local.eval p ?a)
subring (carrier R) R
finite S
S \<subseteq> carrier R
x \<in> carrier R - S
s \<in> S

goal (1 subgoal):
 1. ring_hom_cring (poly_ring R) R (\<lambda>p. local.eval p s)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
have "eval p s = finprod R (a_minus R s) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval p s = finprod R (a_minus R s) S
[PROOF STEP]
using subsetD[OF assms(2) d] assms
[PROOF STATE]
proof (prove)
using this:
s \<in> carrier R
finite S
S \<subseteq> carrier R
x \<in> carrier R - S

goal (1 subgoal):
 1. local.eval p s = finprod R (a_minus R s) S
[PROOF STEP]
by (simp add:p_def lagrange_aux_eval)
[PROOF STATE]
proof (state)
this:
local.eval p s = finprod R (a_minus R s) S

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
local.eval p s = finprod R (a_minus R s) S

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
have "... = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finprod R (a_minus R s) S = \<zero>
[PROOF STEP]
using subsetD[OF assms(2)] d assms
[PROOF STATE]
proof (prove)
using this:
?c \<in> S \<Longrightarrow> ?c \<in> carrier R
s \<in> S
finite S
S \<subseteq> carrier R
x \<in> carrier R - S

goal (1 subgoal):
 1. finprod R (a_minus R s) S = \<zero>
[PROOF STEP]
by (simp add: finprod_zero_iff)
[PROOF STATE]
proof (state)
this:
finprod R (a_minus R s) S = \<zero>

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
local.eval p s = \<zero>
[PROOF STEP]
have "eval p s = \<zero>\<^bsub>R\<^esub>"
[PROOF STATE]
proof (prove)
using this:
local.eval p s = \<zero>

goal (1 subgoal):
 1. local.eval p s = \<zero>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.eval p s = \<zero>

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.eval p s = \<zero>

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
have "eval (poly_of_const (inv finprod R (a_minus R x) S)) s \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.eval (poly_of_const (inv finprod R (a_minus R x) S)) s \<in> carrier R
[PROOF STEP]
using s.hom_closed poly_of_const_in_carrier  Units_inv_closed c
[PROOF STATE]
proof (prove)
using this:
?x \<in> carrier (poly_ring R) \<Longrightarrow> local.eval ?x s \<in> carrier R
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
?x \<in> Units R \<Longrightarrow> inv ?x \<in> carrier R
finprod R (a_minus R x) S \<in> Units R

goal (1 subgoal):
 1. local.eval (poly_of_const (inv finprod R (a_minus R x) S)) s \<in> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
local.eval (poly_of_const (inv finprod R (a_minus R x) S)) s \<in> carrier R

goal (1 subgoal):
 1. \<And>s. s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.eval p s = \<zero>
local.eval (poly_of_const (inv finprod R (a_minus R x) S)) s \<in> carrier R
[PROOF STEP]
show "eval (lagrange_basis_polynomial S x) s = \<zero>"
[PROOF STATE]
proof (prove)
using this:
local.eval p s = \<zero>
local.eval (poly_of_const (inv finprod R (a_minus R x) S)) s \<in> carrier R

goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
using poly_of_const_in_carrier Units_inv_closed c
[PROOF STATE]
proof (prove)
using this:
local.eval p s = \<zero>
local.eval (poly_of_const (inv finprod R (a_minus R x) S)) s \<in> carrier R
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
?x \<in> Units R \<Longrightarrow> inv ?x \<in> carrier R
finprod R (a_minus R x) S \<in> Units R

goal (1 subgoal):
 1. local.eval (lagrange_basis_polynomial S x) s = \<zero>
[PROOF STEP]
by (simp add:lagrange_basis_polynomial_def Let_def p_def[symmetric] s.hom_mult[OF b])
[PROOF STATE]
proof (state)
this:
local.eval (lagrange_basis_polynomial S x) s = \<zero>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?s \<in> S \<Longrightarrow> local.eval (lagrange_basis_polynomial S x) ?s = \<zero>

goal (1 subgoal):
 1. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
interpret r:cring "poly_ring R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cring (poly_ring R)
[PROOF STEP]
using carrier_is_subring domain.univ_poly_is_cring domain_axioms
[PROOF STATE]
proof (prove)
using this:
subring (carrier R) R
\<lbrakk>domain ?R; subring ?K ?R\<rbrakk> \<Longrightarrow> cring (?K [X]\<^bsub>?R\<^esub>)
domain R

goal (1 subgoal):
 1. cring (poly_ring R)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
show "lagrange_basis_polynomial S x \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
using lagrange_basis_polynomial_def p_def[symmetric] poly_of_const_in_carrier Units_inv_closed
      a b c
[PROOF STATE]
proof (prove)
using this:
lagrange_basis_polynomial ?S ?x = lagrange_basis_polynomial_aux ?S \<otimes>\<^bsub>poly_ring R\<^esub> poly_of_const (inv finprod R (a_minus R ?x) ?S)
lagrange_basis_polynomial_aux S = p
?s \<in> carrier R \<Longrightarrow> poly_of_const ?s \<in> carrier (poly_ring R)
?x \<in> Units R \<Longrightarrow> inv ?x \<in> carrier R
local.eval p x = finprod R (a_minus R x) S
p \<in> carrier (poly_ring R)
finprod R (a_minus R x) S \<in> Units R

goal (1 subgoal):
 1. lagrange_basis_polynomial S x \<in> carrier (poly_ring R)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
lagrange_basis_polynomial S x \<in> carrier (poly_ring R)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_iso:
  assumes "finite (B :: 'a::join_semilattice_zero set)"
  shows "A \<subseteq> B \<longrightarrow> \<Sum> A \<le> \<Sum> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> B \<longrightarrow> \<Sum> A \<le> \<Sum> B
[PROOF STEP]
by (metis assms finite_subset order_refl rev_subsetD sum_sup)


[STATEMENT]
lemma pmf_of_st_vec_inj: "(pmf_of_st_vec x = pmf_of_st_vec y) = (x = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pmf_of_st_vec x = pmf_of_st_vec y) = (x = y)
[PROOF STEP]
by (metis st_vec_of_pmf_pmf_of_st_vec)


[STATEMENT]
lemma dyadics_in_open_unit_interval:
   "{0<..<1} \<inter> (\<Union>k m. {real m / 2^k}) = (\<Union>k. \<Union>m \<in> {0<..<2^k}. {real m / 2^k})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0<..<1} \<inter> (\<Union>k m. {real m / 2 ^ k}) = (\<Union>k. \<Union>m\<in>{0<..<2 ^ k}. {real m / 2 ^ k})
[PROOF STEP]
by (auto simp: field_split_simps)


[STATEMENT]
lemma suminf_ennreal2:
  "(\<And>i. 0 \<le> f i) \<Longrightarrow> summable f \<Longrightarrow> (\<Sum>i. ennreal (f i)) = ennreal (\<Sum>i. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>i. 0 \<le> f i; summable f\<rbrakk> \<Longrightarrow> (\<Sum>i. ennreal (f i)) = ennreal (\<Sum>i. f i)
[PROOF STEP]
using suminf_ennreal_eq
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>i. 0 \<le> ?f i; ?f sums ?x\<rbrakk> \<Longrightarrow> (\<Sum>i. ennreal (?f i)) = ennreal ?x

goal (1 subgoal):
 1. \<lbrakk>\<And>i. 0 \<le> f i; summable f\<rbrakk> \<Longrightarrow> (\<Sum>i. ennreal (f i)) = ennreal (\<Sum>i. f i)
[PROOF STEP]
by blast


[STATEMENT]
lemma Complex_Im_express_cnj:
  shows "Complex 0 (Im z) = (z - cnj z)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex 0 (Im z) = (z - cnj z) / 2
[PROOF STEP]
by (cases z) (simp add: Complex_eq)


[STATEMENT]
lemma hyperpow_mult: "\<And>r s n. (r * s::'a::comm_monoid_mult star) pow n = (r pow n) * (s pow n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r s n. (r * s) pow n = r pow n * s pow n
[PROOF STEP]
by transfer (rule power_mult_distrib)


[STATEMENT]
lemma quotient_of_number [simp]:
  "quotient_of 0 = (0, 1)"
  "quotient_of 1 = (1, 1)"
  "quotient_of (numeral k) = (numeral k, 1)"
  "quotient_of (- 1) = (- 1, 1)"
  "quotient_of (- numeral k) = (- numeral k, 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (quotient_of 0 = (0, 1) &&& quotient_of 1 = (1, 1)) &&& quotient_of (numeral k) = (numeral k, 1) &&& quotient_of (- 1) = (- 1, 1) &&& quotient_of (- numeral k) = (- numeral k, 1)
[PROOF STEP]
by (simp_all add: rat_number_expand quotient_of_Fract)


[STATEMENT]
lemma (in state_space)
  shows "\<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace>
          TRY
            WHILE True
            INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace>
            DO IF \<acute>M = a THEN THROW ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 FI OD
          CATCH
            SKIP
          END
          \<lbrace>\<acute>S = a * b\<rbrace>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Gamma>\<turnstile> \<lbrace>\<acute>M = 0 \<and> \<acute>S = 0\<rbrace> TRY WHILE True INV \<lbrace>\<acute>S = \<acute>M * b\<rbrace> DO IF \<acute>M = a THEN THROW ELSE \<acute>S :== \<acute>S + b;; \<acute>M :== \<acute>M + 1 FI OD CATCH SKIP END \<lbrace>\<acute>S = a * b\<rbrace>
[PROOF STEP]
apply vcg
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>M S. \<lbrakk>M = 0; S = 0\<rbrakk> \<Longrightarrow> S = M * b
 2. \<And>M S. \<lbrakk>S = M * b; True\<rbrakk> \<Longrightarrow> (M = a \<longrightarrow> S = a * b) \<and> (M \<noteq> a \<longrightarrow> S + b = (M + 1) * b)
 3. \<And>M S. \<lbrakk>S = M * b; \<not> True\<rbrakk> \<Longrightarrow> S = a * b
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tseq_pre_expression:
  "x \<in> While_program \<Longrightarrow> p \<in> Pre_expression \<Longrightarrow> q \<in> Pre_expression \<Longrightarrow> r \<in> Pre_expression \<Longrightarrow> tseq p x q r m \<in> Pre_expression"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> While_program; p \<in> Pre_expression; q \<in> Pre_expression; r \<in> Pre_expression\<rbrakk> \<Longrightarrow> tseq p x q r m \<in> Pre_expression
[PROOF STEP]
apply (induct m)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<in> While_program; p \<in> Pre_expression; q \<in> Pre_expression; r \<in> Pre_expression\<rbrakk> \<Longrightarrow> tseq p x q r 0 \<in> Pre_expression
 2. \<And>m. \<lbrakk>\<lbrakk>x \<in> While_program; p \<in> Pre_expression; q \<in> Pre_expression; r \<in> Pre_expression\<rbrakk> \<Longrightarrow> tseq p x q r m \<in> Pre_expression; x \<in> While_program; p \<in> Pre_expression; q \<in> Pre_expression; r \<in> Pre_expression\<rbrakk> \<Longrightarrow> tseq p x q r (Suc m) \<in> Pre_expression
[PROOF STEP]
apply (smt tseq_def id_def power_zero_id)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. \<lbrakk>\<lbrakk>x \<in> While_program; p \<in> Pre_expression; q \<in> Pre_expression; r \<in> Pre_expression\<rbrakk> \<Longrightarrow> tseq p x q r m \<in> Pre_expression; x \<in> While_program; p \<in> Pre_expression; q \<in> Pre_expression; r \<in> Pre_expression\<rbrakk> \<Longrightarrow> tseq p x q r (Suc m) \<in> Pre_expression
[PROOF STEP]
by (smt tseq_def power_succ_unfold_ext tfun_pre_expression)


[STATEMENT]
lemma l5_12_a:
  assumes "Bet A B C"
  shows "A B Le A C \<and> B C Le A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A B Le A C \<and> B C Le A C
[PROOF STEP]
using assms between_symmetry cong_left_commutativity cong_reflexivity l5_5_2 le_left_comm
[PROOF STATE]
proof (prove)
using this:
Bet A B C
Bet ?A ?B ?C \<Longrightarrow> Bet ?C ?B ?A
Cong ?A ?B ?C ?D \<Longrightarrow> Cong ?B ?A ?C ?D
Cong ?A ?B ?A ?B
\<exists>X. Bet ?A ?B X \<and> Cong ?A X ?C ?D \<Longrightarrow> ?A ?B Le ?C ?D
?A ?B Le ?C ?D \<Longrightarrow> ?B ?A Le ?C ?D

goal (1 subgoal):
 1. A B Le A C \<and> B C Le A C
[PROOF STEP]
by blast


[STATEMENT]
theorem associative_rat_poly_mat:
 assumes "mat (rat_poly.row_length m1) (rat_poly.row_length m2) m1"
     and "mat (rat_poly.row_length m2) (rat_poly.row_length m3) m2"
     and "mat (rat_poly.row_length m3) nc m3"
 shows "rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)
                     = rat_poly.matrix_mult (rat_poly.matrix_mult m1  m2) m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
have "(rat_poly.matrix_mult m2 m3)
                   = mat_mult (rat_poly.row_length m2) m2 m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.matrix_mult m2 m3 = rat_poly.matrix_mult m2 m3
[PROOF STEP]
using mat_mult_equiv
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult ?m1.0 ?m2.0 = rat_poly.matrix_mult ?m1.0 ?m2.0

goal (1 subgoal):
 1. rat_poly.matrix_mult m2 m3 = rat_poly.matrix_mult m2 m3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult m2 m3 = rat_poly.matrix_mult m2 m3

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rat_poly.matrix_mult m2 m3 = rat_poly.matrix_mult m2 m3
[PROOF STEP]
have "rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)
                   = mat_mult (rat_poly.row_length m1)  m1
                                 (mat_mult (rat_poly.row_length m2) m2 m3)"
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult m2 m3 = rat_poly.matrix_mult m2 m3

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)
[PROOF STEP]
using mat_mult_equiv
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult m2 m3 = rat_poly.matrix_mult m2 m3
rat_poly.matrix_mult ?m1.0 ?m2.0 = rat_poly.matrix_mult ?m1.0 ?m2.0

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
have "...  =    mat_mult (rat_poly.row_length m1)
                           (mat_mult (rat_poly.row_length m1) m1 m2) m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
using assms mat_mult_assoc
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length m1) (rat_poly.row_length m2) m1
mat (rat_poly.row_length m2) (rat_poly.row_length m3) m2
mat (rat_poly.row_length m3) nc m3
\<lbrakk>mat ?nr ?n1.0 ?m1.0; mat ?n1.0 ?n2.0 ?m2.0; mat ?n2.0 ?nc ?m3.0\<rbrakk> \<Longrightarrow> mat_mult ?nr (mat_mult ?nr ?m1.0 ?m2.0) ?m3.0 = mat_mult ?nr ?m1.0 (mat_mult ?n1.0 ?m2.0 ?m3.0)

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
have "... = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
have "mat
           (rat_poly.row_length m1)
           (rat_poly.row_length m3)
                     (rat_poly.matrix_mult m1 m2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (rat_poly.row_length m1) (rat_poly.row_length m3) (rat_poly.matrix_mult m1 m2)
[PROOF STEP]
using assms(1) assms(2) mat_mult
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length m1) (rat_poly.row_length m2) m1
mat (rat_poly.row_length m2) (rat_poly.row_length m3) m2
\<lbrakk>mat ?nr ?n ?m1.0; mat ?n ?nc ?m2.0\<rbrakk> \<Longrightarrow> mat ?nr ?nc (mat_multI ?ze ?pl ?ti ?nr ?m1.0 ?m2.0)

goal (1 subgoal):
 1. mat (rat_poly.row_length m1) (rat_poly.row_length m3) (rat_poly.matrix_mult m1 m2)
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length m1) (rat_poly.row_length m3) (rat_poly.matrix_mult m1 m2)

goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (rat_poly.row_length m1) (rat_poly.row_length m3) (rat_poly.matrix_mult m1 m2)
[PROOF STEP]
have "rat_poly.row_length (rat_poly.matrix_mult m1 m2) =
                     (rat_poly.row_length m1)"
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length m1) (rat_poly.row_length m3) (rat_poly.matrix_mult m1 m2)

goal (1 subgoal):
 1. rat_poly.row_length (rat_poly.matrix_mult m1 m2) = rat_poly.row_length m1
[PROOF STEP]
using assms(1) assms(2) length_0_conv rat_poly.mat_empty_column_length
            rat_poly.matrix_row_length rat_poly.row_length_Nil
            rat_poly.unique_row_col(1) rat_poly.unique_row_col(2)
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length m1) (rat_poly.row_length m3) (rat_poly.matrix_mult m1 m2)
mat (rat_poly.row_length m1) (rat_poly.row_length m2) m1
mat (rat_poly.row_length m2) (rat_poly.row_length m3) m2
(length ?xs = 0) = (?xs = [])
\<lbrakk>mat ?nr ?nc ?M; ?M = []\<rbrakk> \<Longrightarrow> ?nc = 0
mat ?nr ?nc ?M \<Longrightarrow> mat (rat_poly.row_length ?M) (length ?M) ?M
rat_poly.row_length [] = 0
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nr1.0 = ?nr2.0
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nc1.0 = ?nc2.0

goal (1 subgoal):
 1. rat_poly.row_length (rat_poly.matrix_mult m1 m2) = rat_poly.row_length m1
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (rat_poly.matrix_mult m1 m2) = rat_poly.row_length m1

goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rat_poly.row_length (rat_poly.matrix_mult m1 m2) = rat_poly.row_length m1

goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
have "rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
                       = mat_mult (rat_poly.row_length
                                      (rat_poly.matrix_mult m1 m2))
                                   (rat_poly.matrix_mult m1 m2) m3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
using mat_mult_equiv
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult ?m1.0 ?m2.0 = rat_poly.matrix_mult ?m1.0 ?m2.0

goal (1 subgoal):
 1. rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3

goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3

goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
using mat_mult_equiv
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
rat_poly.matrix_mult ?m1.0 ?m2.0 = rat_poly.matrix_mult ?m1.0 ?m2.0

goal (1 subgoal):
 1. mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
by (metis calculation)
[PROOF STATE]
proof (state)
this:
mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3
mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3)
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3
mat_mult (rat_poly.row_length m1) (rat_poly.matrix_mult m1 m2) m3 = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3

goal (1 subgoal):
 1. rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult m1 (rat_poly.matrix_mult m2 m3) = rat_poly.matrix_mult (rat_poly.matrix_mult m1 m2) m3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measure_preserving_preserves_integral:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes "T \<in> measure_preserving M N"
      and [measurable]: "integrable N f"
  shows "integrable M (\<lambda>x. f(T x))" "(\<integral>x. f x \<partial>N) = (\<integral>x. f (T x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable M (\<lambda>x. f (T x)) &&& integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. integrable M (\<lambda>x. f (T x))
 2. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
have a [measurable]: "T \<in> measurable M N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T \<in> M \<rightarrow>\<^sub>M N
[PROOF STEP]
by (rule measure_preservingE(1)[OF assms(1)])
[PROOF STATE]
proof (state)
this:
T \<in> M \<rightarrow>\<^sub>M N

goal (2 subgoals):
 1. integrable M (\<lambda>x. f (T x))
 2. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
have b [measurable]: "f \<in> borel_measurable N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> borel_measurable N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable N

goal (2 subgoals):
 1. integrable M (\<lambda>x. f (T x))
 2. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
have "distr M N T = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distr M N T = N
[PROOF STEP]
using measure_preserving_distr[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
distr M N T = N

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

goal (2 subgoals):
 1. integrable M (\<lambda>x. f (T x))
 2. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distr M N T = N
[PROOF STEP]
have "integrable (distr M N T) f"
[PROOF STATE]
proof (prove)
using this:
distr M N T = N

goal (1 subgoal):
 1. integrable (distr M N T) f
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
distr M N T = N
integrable N f

goal (1 subgoal):
 1. integrable (distr M N T) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integrable (distr M N T) f

goal (2 subgoals):
 1. integrable M (\<lambda>x. f (T x))
 2. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
integrable (distr M N T) f
[PROOF STEP]
show "integrable M (\<lambda>x. f(T x))"
[PROOF STATE]
proof (prove)
using this:
integrable (distr M N T) f

goal (1 subgoal):
 1. integrable M (\<lambda>x. f (T x))
[PROOF STEP]
using integrable_distr_eq[OF a b]
[PROOF STATE]
proof (prove)
using this:
integrable (distr M N T) f
integrable (distr M N T) f = integrable M (\<lambda>x. f (T x))

goal (1 subgoal):
 1. integrable M (\<lambda>x. f (T x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integrable M (\<lambda>x. f (T x))

goal (1 subgoal):
 1. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
have "(\<integral>x. f (T x) \<partial>M) = (\<integral>y. f y \<partial>distr M N T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. f (T x) = integral\<^sup>L (distr M N T) f
[PROOF STEP]
using integral_distr[OF a b]
[PROOF STATE]
proof (prove)
using this:
integral\<^sup>L (distr M N T) f = LINT x|M. f (T x)

goal (1 subgoal):
 1. LINT x|M. f (T x) = integral\<^sup>L (distr M N T) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
LINT x|M. f (T x) = integral\<^sup>L (distr M N T) f

goal (1 subgoal):
 1. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LINT x|M. f (T x) = integral\<^sup>L (distr M N T) f
[PROOF STEP]
show "(\<integral>x. f x \<partial>N) = (\<integral>x. f (T x) \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
LINT x|M. f (T x) = integral\<^sup>L (distr M N T) f

goal (1 subgoal):
 1. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
using \<open>distr M N T = N\<close>
[PROOF STATE]
proof (prove)
using this:
LINT x|M. f (T x) = integral\<^sup>L (distr M N T) f
distr M N T = N

goal (1 subgoal):
 1. integral\<^sup>L N f = LINT x|M. f (T x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
integral\<^sup>L N f = LINT x|M. f (T x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_prod_with_itself_nonneg_reals:
  fixes u::"complex vec"
  shows "\<langle>u|u\<rangle> \<in> nonneg_Reals"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>u|u\<rangle> \<in> \<real>\<^sub>\<ge>\<^sub>0
[PROOF STEP]
using inner_prod_with_itself_real inner_prod_with_itself_Re complex_nonneg_Reals_iff
inner_prod_with_itself_Im
[PROOF STATE]
proof (prove)
using this:
\<langle>?u|?u\<rangle> \<in> \<real>
0 \<le> Re \<langle>?u|?u\<rangle>
(?z \<in> \<real>\<^sub>\<ge>\<^sub>0) = (0 \<le> Re ?z \<and> Im ?z = 0)
Im \<langle>?u|?u\<rangle> = 0

goal (1 subgoal):
 1. \<langle>u|u\<rangle> \<in> \<real>\<^sub>\<ge>\<^sub>0
[PROOF STEP]
by auto


[STATEMENT]
lemma card_differenceset_singleton_mem_eq:
  assumes "a \<in> G" and "A \<subseteq> G"
  shows "card A = card (differenceset A {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card A = card (differenceset A {a})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> G
A \<subseteq> G

goal (1 subgoal):
 1. card A = card (differenceset A {a})
[PROOF STEP]
by (metis card_minusset' card_sumset_singleton_subset_eq differenceset_commute
  minusset_subset_carrier)


[STATEMENT]
lemma cancel_imp_equal:
  "\<lbrakk> u \<cdot> inverse v = \<one>;  u \<in> G; v \<in> G \<rbrakk> \<Longrightarrow> u = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>u \<cdot> local.inverse v = \<one>; u \<in> G; v \<in> G\<rbrakk> \<Longrightarrow> u = v
[PROOF STEP]
by (metis invertible invertible_inverse_closed invertible_right_cancel invertible_right_inverse)


[STATEMENT]
lemma Lim_within_LIMSEQ:
  fixes a :: "'a::first_countable_topology"
  assumes "\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>n. X (S n)) \<longlonglongrightarrow> L"
  shows "(X \<longlongrightarrow> L) (at a within T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X \<longlongrightarrow> L) (at a within T)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>n. X (S n)) \<longlonglongrightarrow> L

goal (1 subgoal):
 1. (X \<longlongrightarrow> L) (at a within T)
[PROOF STEP]
unfolding tendsto_def [where l=L]
[PROOF STATE]
proof (prove)
using this:
\<forall>S. (\<forall>n. S n \<noteq> a \<and> S n \<in> T) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<forall>Sa. open Sa \<longrightarrow> L \<in> Sa \<longrightarrow> (\<forall>\<^sub>F x in sequentially. X (S x) \<in> Sa))

goal (1 subgoal):
 1. \<forall>S. open S \<longrightarrow> L \<in> S \<longrightarrow> (\<forall>\<^sub>F x in at a within T. X x \<in> S)
[PROOF STEP]
by (simp add: sequentially_imp_eventually_within)


[STATEMENT]
lemma mat_of_row_dim[simp]: "dim_row (mat_of_row y) = 1"
  "dim_col (mat_of_row y) = dim_vec y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat_of_row y) = 1 &&& dim_col (mat_of_row y) = dim_vec y
[PROOF STEP]
unfolding mat_of_row_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat 1 (dim_vec y) (\<lambda>ij. y $ snd ij)) = 1 &&& dim_col (mat 1 (dim_vec y) (\<lambda>ij. y $ snd ij)) = dim_vec y
[PROOF STEP]
by auto


[STATEMENT]
lemma index_unit_vec[simp]:
  "i < n \<Longrightarrow> j < n \<Longrightarrow> unit_vec n i $ j = (if j = i then 1 else 0)"
  "i < n \<Longrightarrow> unit_vec n i $ i = 1"
  "dim_vec (unit_vec n i) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> unit_vec n i $ j = (if j = i then 1::'a else (0::'a))) &&& (i < n \<Longrightarrow> unit_vec n i $ i = (1::'b)) &&& dim_vec (unit_vec n i) = n
[PROOF STEP]
unfolding unit_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>i < n; j < n\<rbrakk> \<Longrightarrow> vec n (\<lambda>j. if j = i then 1::'a else (0::'a)) $ j = (if j = i then 1::'a else (0::'a))) &&& (i < n \<Longrightarrow> vec n (\<lambda>j. if j = i then 1::'b else (0::'b)) $ i = (1::'b)) &&& dim_vec (vec n (\<lambda>j. if j = i then 1::'c else (0::'c))) = n
[PROOF STEP]
by auto


[STATEMENT]
lemma consistent_imp_is_solution_solve:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  assumes con: "consistent A b"
  shows "is_solution (fst (the (solve A b))) A b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_solution (fst (the (solve A b))) A b
[PROOF STEP]
unfolding solve_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_solution (fst (the (if consistent A b then Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A) else None))) A b
[PROOF STEP]
unfolding if_P[OF con] fst_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_solution (fst (the (Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A)))) A b
[PROOF STEP]
using consistent_imp_is_solution'[OF con]
[PROOF STATE]
proof (prove)
using this:
is_solution (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b))) A b

goal (1 subgoal):
 1. is_solution (fst (the (Some (solve_consistent_rref (fst (solve_system A b)) (snd (solve_system A b)), basis_null_space A)))) A b
[PROOF STEP]
by simp


[STATEMENT]
lemma nth_list_of_pdevs_pdevs_of_list:
  assumes nz: "\<And>x. x \<in> set xs \<Longrightarrow> x \<noteq> 0"
  assumes l: "n < length xs"
  shows "list_of_pdevs (pdevs_of_list xs) ! n  = ((length xs - Suc n), xs ! (length xs - Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_of_pdevs (pdevs_of_list xs) ! n = (length xs - Suc n, xs ! (length xs - Suc n))
[PROOF STEP]
using nz l
[PROOF STATE]
proof (prove)
using this:
?x \<in> set xs \<Longrightarrow> ?x \<noteq> (0::'a)
n < length xs

goal (1 subgoal):
 1. list_of_pdevs (pdevs_of_list xs) ! n = (length xs - Suc n, xs ! (length xs - Suc n))
[PROOF STEP]
by (auto simp: list_of_pdevs_def pdevs_domain_eq_pdevs_of_list rev_nth pdevs_apply_pdevs_of_list)


[STATEMENT]
lemma cut_le_inext_nth_card_if: "
  card (I \<down>\<le> (I \<rightarrow> n)) = (
  if (n < card I \<or> infinite I) then Suc n else card I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (I \<down>\<le> (I \<rightarrow> n)) = (if n < card I \<or> infinite I then Suc n else card I)
[PROOF STEP]
by (simp add: cut_le_inext_nth_card_eq1 cut_le_inext_nth_card_eq2)


[STATEMENT]
lemma differentiable_on_compose:
   "\<lbrakk>g differentiable_on S; f differentiable_on (g ` S)\<rbrakk> \<Longrightarrow> (\<lambda>x. f (g x)) differentiable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g differentiable_on S; f differentiable_on g ` S\<rbrakk> \<Longrightarrow> (\<lambda>x. f (g x)) differentiable_on S
[PROOF STEP]
by (simp add: differentiable_in_compose differentiable_on_def)


[STATEMENT]
lemma open_segment_of_real:
    "open_segment (of_real x) (of_real y) = of_real ` open_segment x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open_segment (of_real x) (of_real y) = of_real ` open_segment x y
[PROOF STEP]
apply (auto simp: image_iff in_segment scaleR_conv_of_real)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>u. \<lbrakk>x \<noteq> y; 0 < u; u < 1\<rbrakk> \<Longrightarrow> \<exists>xa\<in>open_segment x y. ((1::'a) - of_real u) * of_real x + of_real u * of_real y = of_real xa
 2. \<And>u. \<lbrakk>x \<noteq> y; 0 < u; u < 1\<rbrakk> \<Longrightarrow> \<exists>ua>0. ua < 1 \<and> ((1::'a) - of_real u) * of_real x + of_real u * of_real y = ((1::'a) - of_real ua) * of_real x + of_real ua * of_real y
[PROOF STEP]
apply (rule_tac x="(1-u)*x + u*y" in bexI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>u. \<lbrakk>x \<noteq> y; 0 < u; u < 1\<rbrakk> \<Longrightarrow> ((1::'a) - of_real u) * of_real x + of_real u * of_real y = of_real ((1 - u) * x + u * y)
 2. \<And>u. \<lbrakk>x \<noteq> y; 0 < u; u < 1\<rbrakk> \<Longrightarrow> (1 - u) * x + u * y \<in> open_segment x y
 3. \<And>u. \<lbrakk>x \<noteq> y; 0 < u; u < 1\<rbrakk> \<Longrightarrow> \<exists>ua>0. ua < 1 \<and> ((1::'a) - of_real u) * of_real x + of_real u * of_real y = ((1::'a) - of_real ua) * of_real x + of_real ua * of_real y
[PROOF STEP]
apply (auto simp: in_segment)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma interchange_columns_transpose':
  shows "interchange_columns A a b = transpose (interchange_rows (transpose A) a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interchange_columns A a b = Finite_Cartesian_Product.transpose (interchange_rows (Finite_Cartesian_Product.transpose A) a b)
[PROOF STEP]
unfolding interchange_rows_def interchange_columns_def transpose_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>i j. if j = a then A $ i $ b else if j = b then A $ i $ a else A $ i $ j) = (\<chi>i j. (\<chi>i j. if i = a then (\<chi>i j. A $ j $ i) $ b $ j else if i = b then (\<chi>i j. A $ j $ i) $ a $ j else (\<chi>i j. A $ j $ i) $ i $ j) $ j $ i)
[PROOF STEP]
by vector


[STATEMENT]
lemma complement_path_components_of_Union:
   "C \<in> path_components_of X
        \<Longrightarrow> topspace X - C = \<Union>(path_components_of X - {C})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<in> path_components_of X \<Longrightarrow> topspace X - C = \<Union> (path_components_of X - {C})
[PROOF STEP]
by (metis Diff_cancel Diff_subset Union_path_components_of cSup_singleton diff_Union_pairwise_disjoint insert_subset pairwise_disjoint_path_components_of)


[STATEMENT]
lemma countable_finite: "finite S \<Longrightarrow> countable S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> countable S
[PROOF STEP]
by (blast dest: finite_imp_inj_to_nat_seg countableI)


[STATEMENT]
lemma diagonal_2x2_admits_SNF_iff_diagonal_admits_SNF:
  shows "(\<forall>(A::'a::comm_ring_1 mat). admits_SNF_JNF A) =
      (\<forall>(A::'a mat) \<in> carrier_mat 2 2. admits_SNF_JNF A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A. admits_SNF_JNF A) = (\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>A. admits_SNF_JNF A \<Longrightarrow> \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A
 2. \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A \<Longrightarrow> \<forall>A. admits_SNF_JNF A
[PROOF STEP]
assume "\<forall>A::'a mat. admits_SNF_JNF A"
[PROOF STATE]
proof (state)
this:
\<forall>A. admits_SNF_JNF A

goal (2 subgoals):
 1. \<forall>A. admits_SNF_JNF A \<Longrightarrow> \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A
 2. \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A \<Longrightarrow> \<forall>A. admits_SNF_JNF A
[PROOF STEP]
thus "\<forall>(A::'a mat)\<in>carrier_mat 2 2. admits_SNF_JNF A"
[PROOF STATE]
proof (prove)
using this:
\<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A
[PROOF STEP]
by (insert admits_SNF_JNF_alt_def, blast)
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A \<Longrightarrow> \<forall>A. admits_SNF_JNF A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A \<Longrightarrow> \<forall>A. admits_SNF_JNF A
[PROOF STEP]
assume "\<forall>A::'a mat \<in>carrier_mat 2 2. admits_SNF_JNF A "
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A \<Longrightarrow> \<forall>A. admits_SNF_JNF A
[PROOF STEP]
hence H: "OFCLASS('a, bezout_ring_class)"
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A

goal (1 subgoal):
 1. OFCLASS('a, bezout_ring_class)
[PROOF STEP]
using diagonal_2x2_admits_SNF_iff_bezout_ring[where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A
OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)

goal (1 subgoal):
 1. OFCLASS('a, bezout_ring_class)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
OFCLASS('a, bezout_ring_class)

goal (1 subgoal):
 1. \<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A \<Longrightarrow> \<forall>A. admits_SNF_JNF A
[PROOF STEP]
show "\<forall>A::'a mat. admits_SNF_JNF A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A
[PROOF STEP]
using bezout_ring_imp_diagonal_admits_SNF_JNF
      [OF OFCLASS_bezout_ring_imp_class_bezout_ring[where ?'a='a, OF H]]
[PROOF STATE]
proof (prove)
using this:
\<forall>A. admits_SNF_JNF A

goal (1 subgoal):
 1. \<forall>A. admits_SNF_JNF A
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>A. admits_SNF_JNF A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma invariance_of_domain_sphere_affine_set:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes contf: "continuous_on S f" and injf: "inj_on f S" and fim: "f ` S \<subseteq> T"
      and "r \<noteq> 0" "affine T" and affTU: "aff_dim T < DIM('a)"
      and ope: "openin (top_of_set (sphere a r)) S"
   shows "openin (top_of_set T) (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set T) (f ` S)
[PROOF STEP]
proof (cases "sphere a r = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sphere a r = {} \<Longrightarrow> openin (top_of_set T) (f ` S)
 2. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
sphere a r = {}

goal (2 subgoals):
 1. sphere a r = {} \<Longrightarrow> openin (top_of_set T) (f ` S)
 2. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sphere a r = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sphere a r = {}

goal (1 subgoal):
 1. openin (top_of_set T) (f ` S)
[PROOF STEP]
using ope openin_subset
[PROOF STATE]
proof (prove)
using this:
sphere a r = {}
openin (top_of_set (sphere a r)) S
openin ?U ?S \<Longrightarrow> ?S \<subseteq> topspace ?U

goal (1 subgoal):
 1. openin (top_of_set T) (f ` S)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
openin (top_of_set T) (f ` S)

goal (1 subgoal):
 1. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
sphere a r \<noteq> {}

goal (1 subgoal):
 1. sphere a r \<noteq> {} \<Longrightarrow> openin (top_of_set T) (f ` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set T) (f ` S)
[PROOF STEP]
proof (rule invariance_of_domain_sphere_affine_set_gen [OF contf injf fim bounded_cball convex_cball \<open>affine T\<close>])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. aff_dim T < aff_dim (cball ?x1 ?e1)
 2. openin (top_of_set (rel_frontier (cball ?x1 ?e1))) S
[PROOF STEP]
show "aff_dim T < aff_dim (cball a r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim T < aff_dim (cball a r)
[PROOF STEP]
by (metis False affTU aff_dim_cball assms(4) linorder_cases sphere_empty)
[PROOF STATE]
proof (state)
this:
aff_dim T < aff_dim (cball a r)

goal (1 subgoal):
 1. openin (top_of_set (rel_frontier (cball a r))) S
[PROOF STEP]
show "openin (top_of_set (rel_frontier (cball a r))) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set (rel_frontier (cball a r))) S
[PROOF STEP]
by (simp add: \<open>r \<noteq> 0\<close> ope)
[PROOF STATE]
proof (state)
this:
openin (top_of_set (rel_frontier (cball a r))) S

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
openin (top_of_set T) (f ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nset_Suc:"{j. j \<le> (Suc n)} = insert (Suc n) {j. j \<le> n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {j. j \<le> Suc n} = insert (Suc n) {j. j \<le> n}
[PROOF STEP]
apply (rule equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. {j. j \<le> Suc n} \<subseteq> insert (Suc n) {j. j \<le> n}
 2. insert (Suc n) {j. j \<le> n} \<subseteq> {j. j \<le> Suc n}
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<in> {j. j \<le> Suc n} \<Longrightarrow> x \<in> insert (Suc n) {j. j \<le> n}
 2. insert (Suc n) {j. j \<le> n} \<subseteq> {j. j \<le> Suc n}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. x \<le> Suc n \<Longrightarrow> x = Suc n \<or> x \<le> n
 2. insert (Suc n) {j. j \<le> n} \<subseteq> {j. j \<le> Suc n}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma integrable_sum:
  "\<lbrakk>finite I;  \<And>a. a \<in> I \<Longrightarrow> f a integrable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. \<Sum>a\<in>I. f a x) integrable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>a. a \<in> I \<Longrightarrow> f a integrable_on S\<rbrakk> \<Longrightarrow> (\<lambda>x. \<Sum>a\<in>I. f a x) integrable_on S
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>a. a \<in> I \<Longrightarrow> \<exists>y. (f a has_integral y) S\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. \<Sum>a\<in>I. f a x) has_integral y) S
[PROOF STEP]
using has_integral_sum[of I]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite I; \<And>a. a \<in> I \<Longrightarrow> (?f a has_integral ?i a) ?S\<rbrakk> \<Longrightarrow> ((\<lambda>x. \<Sum>a\<in>I. ?f a x) has_integral sum ?i I) ?S

goal (1 subgoal):
 1. \<lbrakk>finite I; \<And>a. a \<in> I \<Longrightarrow> \<exists>y. (f a has_integral y) S\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. \<Sum>a\<in>I. f a x) has_integral y) S
[PROOF STEP]
by metis


[STATEMENT]
lemma mono_ccSUP:
  "countable I \<Longrightarrow> (SUP x \<in> I. f (A x)) \<le> f (SUP i \<in> I. A i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable I \<Longrightarrow> (SUP x\<in>I. f (A x)) \<le> f (Sup (A ` I))
[PROOF STEP]
by (intro countable_complete_lattice_class.ccSUP_least monoD[OF \<open>mono f\<close>] ccSUP_upper)


[STATEMENT]
lemma openin_subtopology_refl: "openin (subtopology U V) V \<longleftrightarrow> V \<subseteq> topspace U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (subtopology U V) V = (V \<subseteq> topspace U)
[PROOF STEP]
unfolding openin_subtopology
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>T. openin U T \<and> V = T \<inter> V) = (V \<subseteq> topspace U)
[PROOF STEP]
by auto (metis IntD1 in_mono openin_subset)


[STATEMENT]
lemma has_derivative_iff_Ex:
  "(f has_derivative f') (at x) \<longleftrightarrow>
    bounded_linear f' \<and> (\<exists>e. (\<forall>h. f (x+h) = f x + f' h + e h) \<and> ((\<lambda>h. norm (e h) / norm h) \<longlongrightarrow> 0) (at 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_derivative f') (at x) = (bounded_linear f' \<and> (\<exists>e. (\<forall>h. f (x + h) = f x + f' h + e h) \<and> (\<lambda>h. norm (e h) / norm h) \<midarrow>0::'a\<rightarrow> 0))
[PROOF STEP]
unfolding has_derivative_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (bounded_linear f' \<and> (\<lambda>h. norm (f (x + h) - f x - f' h) / norm h) \<midarrow>0::'a\<rightarrow> 0) = (bounded_linear f' \<and> (\<exists>e. (\<forall>h. f (x + h) = f x + f' h + e h) \<and> (\<lambda>h. norm (e h) / norm h) \<midarrow>0::'a\<rightarrow> 0))
[PROOF STEP]
by force


[STATEMENT]
lemma [code]:
    "disjoint_intervals A B =
      (case A of (s,e) \<Rightarrow> case B of (s',e') \<Rightarrow> s > e' \<or> s' > e \<or> s > e \<or> s' > e')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disjoint_intervals A B = (case A of (s, e) \<Rightarrow> case B of (s', e') \<Rightarrow> e' < s \<or> e < s' \<or> e < s \<or> e' < s')
[PROOF STEP]
apply(cases A, cases B)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>A = (a, b); B = (aa, ba)\<rbrakk> \<Longrightarrow> disjoint_intervals A B = (case A of (s, e) \<Rightarrow> case B of (s', e') \<Rightarrow> e' < s \<or> e < s' \<or> e < s \<or> e' < s')
[PROOF STEP]
apply(simp add: disjoint_intervals_def interval_of.simps disjoint_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b aa ba. \<lbrakk>A = (a, b); B = (aa, ba)\<rbrakk> \<Longrightarrow> (a \<le> ba \<longrightarrow> aa \<le> b \<longrightarrow> a \<le> b \<longrightarrow> \<not> aa \<le> ba) = (ba < a \<or> b < aa \<or> b < a \<or> ba < aa)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma mult_mono_nonpos_nonneg: "a * b \<le> c * d"
  if  "a \<le> c" "a \<le> 0" "0 \<le> d" "d \<le> b" for a b c d::"'a::ordered_ring"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b \<le> c * d
[PROOF STEP]
by (meson dual_order.trans mult_left_mono_neg mult_right_mono that)


[STATEMENT]
lemma hypext_inverse_Hyperdual:
  "a \<noteq> 0 \<Longrightarrow>
    (*h* inverse) (Hyperdual a b c d) =
    Hyperdual (inverse a) (- (b / a\<^sup>2)) (- (c / a\<^sup>2)) (2 * b * c / (a ^ 3) - d / a\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> (*h* inverse) (Hyperdual a b c d) = Hyperdual (inverse a) (- (b / a\<^sup>2)) (- (c / a\<^sup>2)) ((2::'a) * b * c / a ^ 3 - d / a\<^sup>2)
[PROOF STEP]
by (simp add: hypext_Hyperdual_eq divide_inverse)


[STATEMENT]
lemma bernoulli_1 [simp]: "bernoulli 1 = -1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli 1 = - 1 / 2
[PROOF STEP]
by (simp add: bernoulli_Suc)


[STATEMENT]
lemma height_node[simp]: "height(node l a r) = max (height l) (height r) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (node l a r) = max (height l) (height r) + 1
[PROOF STEP]
by (simp add: node_def)


[STATEMENT]
lemma (in Module) linmap_im_lincomb:"\<lbrakk>ideal R A; R module N; f \<in> mHom R M N;
      H \<subseteq> carrier M; s \<in> {j. j \<le> (n::nat)} \<rightarrow> A; g \<in> {j. j \<le> n} \<rightarrow> H \<rbrakk> \<Longrightarrow>
      f (l_comb R M n s g) = l_comb R N n s (cmp f g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>ideal R A; R module N; f \<in> mHom R M N; H \<subseteq> carrier M; s \<in> {j. j \<le> n} \<rightarrow> A; g \<in> {j. j \<le> n} \<rightarrow> H\<rbrakk> \<Longrightarrow> f (l_comb R M n s g) = l_comb R N n s (cmp f g)
[PROOF STEP]
apply (simp add:linmap_im_of_lincombTr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma interfree_Map:
  "(\<forall>i j. a\<le>i \<and> i<b \<and> a\<le>j \<and> j<b  \<and> i\<noteq>j \<longrightarrow> interfree_aux \<Gamma> \<Theta> F (c i, A i, c j, pres (A j)))
  \<Longrightarrow> interfree \<Gamma> \<Theta> F (map (\<lambda>k. A k) [a..<b]) (map (\<lambda>k. c k) [a..<b])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i j. a \<le> i \<and> i < b \<and> a \<le> j \<and> j < b \<and> i \<noteq> j \<longrightarrow> interfree_aux \<Gamma> \<Theta> F (c i, A i, c j, fst (A j)) \<Longrightarrow> interfree \<Gamma> \<Theta> F (map A [a..<b]) (map c [a..<b])
[PROOF STEP]
by (force simp add: interfree_def less_diff_conv)


[STATEMENT]
lemma "(X = Y \<inter> Z) = (X \<subseteq> Y \<and> X \<subseteq> Z \<and> (\<forall>V. V \<subseteq> Y \<and> V \<subseteq> Z \<longrightarrow> V \<subseteq> X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X = Y \<inter> Z) = (X \<subseteq> Y \<and> X \<subseteq> Z \<and> (\<forall>V. V \<subseteq> Y \<and> V \<subseteq> Z \<longrightarrow> V \<subseteq> X))
[PROOF STEP]
by (metis Int_greatest Int_lower1 Int_lower2 subset_antisym)


[STATEMENT]
theorem group_BijGroup: "group (BijGroup S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (BijGroup S)
[PROOF STEP]
apply (simp add: BijGroup_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>
[PROOF STEP]
apply (rule groupI)
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>x y. \<lbrakk>x \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>; y \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> y \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>
 2. \<one>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>
 3. \<And>x y z. \<lbrakk>x \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>; y \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>; z \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<rbrakk> \<Longrightarrow> x \<otimes>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> y \<otimes>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> z = x \<otimes>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> (y \<otimes>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> z)
 4. \<And>x. x \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr> \<Longrightarrow> \<one>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> \<otimes>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> x = x
 5. \<And>x. x \<in> carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr> \<Longrightarrow> \<exists>y\<in>carrier \<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>. y \<otimes>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub> x = \<one>\<^bsub>\<lparr>carrier = Bij S, mult = \<lambda>g\<in>Bij S. restrict (compose S g) (Bij S), one = \<lambda>x\<in>S. x\<rparr>\<^esub>
[PROOF STEP]
apply (auto simp: compose_Bij id_Bij Bij_imp_funcset Bij_imp_extensional compose_assoc [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> Bij S \<Longrightarrow> \<exists>y\<in>Bij S. compose S y x = (\<lambda>x\<in>S. x)
[PROOF STEP]
apply (blast intro: Bij_compose_restrict_eq restrict_inv_into_Bij)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iso_bij_betwn_block_sets_inv: "bij_betw ((`) (inv_into \<V> \<pi>)) (set_mset \<B>') (set_mset \<B>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((`) (inv_into \<V> \<pi>)) (set_mset \<B>') (set_mset \<B>)
[PROOF STEP]
using incidence_system_isomorphism.iso_bij_betwn_block_sets inverse_incidence_sys_iso
[PROOF STATE]
proof (prove)
using this:
incidence_system_isomorphism ?\<V> ?\<B> ?\<V>' ?\<B>' ?bij_map \<Longrightarrow> bij_betw ((`) ?bij_map) (set_mset ?\<B>) (set_mset ?\<B>')
incidence_system_isomorphism \<V>' \<B>' \<V> \<B> (inv_into \<V> \<pi>)

goal (1 subgoal):
 1. bij_betw ((`) (inv_into \<V> \<pi>)) (set_mset \<B>') (set_mset \<B>)
[PROOF STEP]
by blast


[STATEMENT]
lemma shiftr1_is_div_2: "(x::('a::len) word) >> 1 = x div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x >> 1 = x div 2
[PROOF STEP]
by (simp add: drop_bit_eq_div shiftr_def)