[STATEMENT]
lemma separated_disj_Union2:
assumes pl: "inv g" and fin: "final g" and ne: "noExceptionals g (set V)"
and pS: "separated g (set V)" and dist: "distinct V"
and V_subset: "set V \<subseteq> set (vertices g)"
shows "(\<Sum>\<^bsub>v \<in> V\<^esub> \<Sum>\<^bsub>f \<in> facesAt g v\<^esub> (w::face \<Rightarrow> nat) f)
       = (\<Sum>\<^bsub>f \<in> [f\<leftarrow>faces g . \<exists>v \<in> set V. f \<in> set (facesAt g v)]\<^esub> w f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (facesAt g v) w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v)) (faces g)) w
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (facesAt g v) w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v)) (faces g)) w
[PROOF STEP]
let ?P = "\<lambda>f. |vertices f| \<le> 4"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (facesAt g v) w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v)) (faces g)) w
[PROOF STEP]
have "\<forall>v \<in> set V. \<forall>f \<in> set (facesAt g v). |vertices f| \<le> 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>v\<in>set V. \<forall>f\<in>set (facesAt g v). |vertices f| \<le> 4
[PROOF STEP]
using V_subset ne
[PROOF STATE]
proof (prove)
using this:
set V \<subseteq> \<V> g
noExceptionals g (set V)

goal (1 subgoal):
 1. \<forall>v\<in>set V. \<forall>f\<in>set (facesAt g v). |vertices f| \<le> 4
[PROOF STEP]
by (auto simp: noExceptionals_def
      intro: minGraphProps5[OF inv_mgp[OF pl]] not_exceptional[OF pl fin])
[PROOF STATE]
proof (state)
this:
\<forall>v\<in>set V. \<forall>f\<in>set (facesAt g v). |vertices f| \<le> 4

goal (1 subgoal):
 1. (\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (facesAt g v) w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v)) (faces g)) w
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>set V. \<forall>f\<in>set (facesAt g v). |vertices f| \<le> 4

goal (1 subgoal):
 1. (\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (facesAt g v) w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v)) (faces g)) w
[PROOF STEP]
using ListSum_V_F_eq_ListSum_F[where P = ?P, OF pl pS dist V_subset]
[PROOF STATE]
proof (prove)
using this:
\<forall>v\<in>set V. \<forall>f\<in>set (facesAt g v). |vertices f| \<le> 4
\<forall>f\<in>{f. |vertices f| \<le> 4}. |vertices f| \<le> 4 \<Longrightarrow> (\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (filter (\<lambda>f. |vertices f| \<le> 4) (facesAt g v)) ?w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v) \<inter> {f. |vertices f| \<le> 4}) (faces g)) ?w

goal (1 subgoal):
 1. (\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (facesAt g v) w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v)) (faces g)) w
[PROOF STEP]
by (simp add: Int_def cong: conj_cong)
[PROOF STATE]
proof (state)
this:
(\<Sum>\<^bsub>v\<in>V\<^esub> ListSum (facesAt g v) w) = ListSum (filter (\<lambda>f. \<exists>v\<in>set V. f \<in> set (facesAt g v)) (faces g)) w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) inv_solve_left:
  "\<lbrakk> a \<in> carrier G; b \<in> carrier G; c \<in> carrier G \<rbrakk> \<Longrightarrow> a = inv b \<otimes> c \<longleftrightarrow> c = b \<otimes> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier G; b \<in> carrier G; c \<in> carrier G\<rbrakk> \<Longrightarrow> (a = inv b \<otimes> c) = (c = b \<otimes> a)
[PROOF STEP]
by (metis inv_equality l_inv_ex l_one m_assoc r_inv)


[STATEMENT]
lemma sorted_list_of_map_inj:
    "inj_on sorted_list_of_map (Collect (finite o dom))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on sorted_list_of_map (Collect (finite \<circ> dom))
[PROOF STEP]
apply (rule inj_onI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> Collect (finite \<circ> dom); y \<in> Collect (finite \<circ> dom); sorted_list_of_map x = sorted_list_of_map y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
using sorted_list_of_map_inj_aux
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite (dom ?A); finite (dom ?B); sorted_list_of_map ?A = sorted_list_of_map ?B\<rbrakk> \<Longrightarrow> ?A = ?B

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> Collect (finite \<circ> dom); y \<in> Collect (finite \<circ> dom); sorted_list_of_map x = sorted_list_of_map y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
by auto


[STATEMENT]
lemma perm_count_conv: "mset A = mset B \<longleftrightarrow> (\<forall> x. count_list A x = count_list B x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (mset A = mset B) = (\<forall>x. count_list A x = count_list B x)
[PROOF STEP]
by (simp add: count_eq multiset_eq_iff)


[STATEMENT]
lemma eucl_of_list_inner:
  "(eucl_of_list xs::'a) \<bullet> eucl_of_list ys = (\<Sum>(x,y)\<leftarrow>zip xs ys. x * y)"
  if "length xs = DIM('a::executable_euclidean_space)"
    "length ys = DIM('a::executable_euclidean_space)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs \<bullet> eucl_of_list ys = sum_list (map2 (*) xs ys)
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
length xs = DIM('a)
length ys = DIM('a)

goal (1 subgoal):
 1. eucl_of_list xs \<bullet> eucl_of_list ys = sum_list (map2 (*) xs ys)
[PROOF STEP]
by (auto simp: nth_eucl_def eucl_of_list_inner_eq inner_lv_rel_def)


[STATEMENT]
lemma aboveS_decr:
assumes TRANS: "trans r" and ANTISYM: "antisym r" and
        REL: "(a,b) \<in> r"
shows "aboveS r b \<le> aboveS r a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aboveS r b \<subseteq> aboveS r a
[PROOF STEP]
proof(unfold aboveS_def, auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>a \<noteq> b; (b, a) \<in> r\<rbrakk> \<Longrightarrow> False
 2. \<And>x. \<lbrakk>x \<noteq> b; (b, x) \<in> r\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
assume *: "a \<noteq> b" and **: "(b,a) \<in> r"
[PROOF STATE]
proof (state)
this:
a \<noteq> b
(b, a) \<in> r

goal (2 subgoals):
 1. \<lbrakk>a \<noteq> b; (b, a) \<in> r\<rbrakk> \<Longrightarrow> False
 2. \<And>x. \<lbrakk>x \<noteq> b; (b, x) \<in> r\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
with ANTISYM antisym_def[of r] REL
[PROOF STATE]
proof (chain)
picking this:
antisym r
antisym r = (\<forall>x y. (x, y) \<in> r \<longrightarrow> (y, x) \<in> r \<longrightarrow> x = y)
(a, b) \<in> r
a \<noteq> b
(b, a) \<in> r
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
antisym r
antisym r = (\<forall>x y. (x, y) \<in> r \<longrightarrow> (y, x) \<in> r \<longrightarrow> x = y)
(a, b) \<in> r
a \<noteq> b
(b, a) \<in> r

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<noteq> b; (b, x) \<in> r\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<noteq> b; (b, x) \<in> r\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<noteq> b; (b, x) \<in> r\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
assume "x \<noteq> b" "(b,x) \<in> r"
[PROOF STATE]
proof (state)
this:
x \<noteq> b
(b, x) \<in> r

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<noteq> b; (b, x) \<in> r\<rbrakk> \<Longrightarrow> (a, x) \<in> r
[PROOF STEP]
with REL TRANS trans_def[of r]
[PROOF STATE]
proof (chain)
picking this:
(a, b) \<in> r
trans r
trans r = (\<forall>x y z. (x, y) \<in> r \<longrightarrow> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r)
x \<noteq> b
(b, x) \<in> r
[PROOF STEP]
show "(a,x) \<in> r"
[PROOF STATE]
proof (prove)
using this:
(a, b) \<in> r
trans r
trans r = (\<forall>x y z. (x, y) \<in> r \<longrightarrow> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r)
x \<noteq> b
(b, x) \<in> r

goal (1 subgoal):
 1. (a, x) \<in> r
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(a, x) \<in> r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma INF_ennreal_const_add:
  fixes f g :: "nat \<Rightarrow> ennreal"
  shows "(INF i. c + f i) = c + (INF i. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i. c + f i) = c + Inf (range f)
[PROOF STEP]
using INF_ennreal_add_const[of f c]
[PROOF STATE]
proof (prove)
using this:
(INF i. f i + c) = Inf (range f) + c

goal (1 subgoal):
 1. (INF i. c + f i) = c + Inf (range f)
[PROOF STEP]
by (simp add: ac_simps)


[STATEMENT]
lemma poly_divide_tendsto_0_at_infinity:
  fixes p::"'a::real_normed_field poly"
  assumes "degree p > degree q"
  shows "((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> 0 ) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
define pp where "pp=(\<lambda>x. x^(degree p) / poly p x)"
[PROOF STATE]
proof (state)
this:
pp = (\<lambda>x. x ^ degree p / poly p x)

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
define qq where "qq=(\<lambda>x. poly q x/x^(degree q))"
[PROOF STATE]
proof (state)
this:
qq = (\<lambda>x. poly q x / x ^ degree q)

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
define dd where "dd=(\<lambda>x::'a. 1/x^(degree p - degree q))"
[PROOF STATE]
proof (state)
this:
dd = (\<lambda>x. (1::'a) / x ^ (degree p - degree q))

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
have "\<forall>\<^sub>Fx in at_infinity.  poly q x / poly p x = qq x * pp x * dd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. poly q x / poly p x = qq x * pp x * dd x
[PROOF STEP]
proof (rule eventually_at_infinityI[of 1])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 1 \<le> norm x \<Longrightarrow> poly q x / poly p x = qq x * pp x * dd x
[PROOF STEP]
fix x::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. 1 \<le> norm x \<Longrightarrow> poly q x / poly p x = qq x * pp x * dd x
[PROOF STEP]
assume "norm x\<ge>1"
[PROOF STATE]
proof (state)
this:
1 \<le> norm x

goal (1 subgoal):
 1. \<And>x. 1 \<le> norm x \<Longrightarrow> poly q x / poly p x = qq x * pp x * dd x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> norm x
[PROOF STEP]
have "x\<noteq>0"
[PROOF STATE]
proof (prove)
using this:
1 \<le> norm x

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

goal (1 subgoal):
 1. \<And>x. 1 \<le> norm x \<Longrightarrow> poly q x / poly p x = qq x * pp x * dd x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> (0::'a)
[PROOF STEP]
show "poly q x / poly p x = qq x * pp x * dd x"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. poly q x / poly p x = qq x * pp x * dd x
[PROOF STEP]
unfolding qq_def pp_def dd_def
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. poly q x / poly p x = poly q x / x ^ degree q * (x ^ degree p / poly p x) * ((1::'a) / x ^ (degree p - degree q))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
degree q < degree p

goal (1 subgoal):
 1. poly q x / poly p x = poly q x / x ^ degree q * (x ^ degree p / poly p x) * ((1::'a) / x ^ (degree p - degree q))
[PROOF STEP]
by (auto simp add:field_simps divide_simps power_diff)
[PROOF STATE]
proof (state)
this:
poly q x / poly p x = qq x * pp x * dd x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_infinity. poly q x / poly p x = qq x * pp x * dd x

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_infinity. poly q x / poly p x = qq x * pp x * dd x

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
have "((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> 0) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
have "(qq \<longlongrightarrow> lead_coeff q) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (qq \<longlongrightarrow> lead_coeff q) at_infinity
[PROOF STEP]
unfolding qq_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. poly q x / x ^ degree q) \<longlongrightarrow> lead_coeff q) at_infinity
[PROOF STEP]
using poly_divide_tendsto_aux[of q]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. poly q x / x ^ degree q) \<longlongrightarrow> lead_coeff q) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / x ^ degree q) \<longlongrightarrow> lead_coeff q) at_infinity
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(qq \<longlongrightarrow> lead_coeff q) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(qq \<longlongrightarrow> lead_coeff q) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
have "(pp \<longlongrightarrow> 1/lead_coeff p) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
[PROOF STEP]
have "p\<noteq>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<noteq> 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
degree q < degree p

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

goal (1 subgoal):
 1. (pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. (pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
[PROOF STEP]
unfolding pp_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. ((\<lambda>x. x ^ degree p / poly p x) \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
[PROOF STEP]
using poly_divide_tendsto_aux[of p]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
((\<lambda>x. poly p x / x ^ degree p) \<longlongrightarrow> lead_coeff p) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. x ^ degree p / poly p x) \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
[PROOF STEP]
apply (drule_tac tendsto_inverse)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. p \<noteq> 0 \<Longrightarrow> lead_coeff p \<noteq> (0::'a)
 2. \<lbrakk>p \<noteq> 0; ((\<lambda>x. inverse (poly p x / x ^ degree p)) \<longlongrightarrow> inverse (lead_coeff p)) at_infinity\<rbrakk> \<Longrightarrow> ((\<lambda>x. x ^ degree p / poly p x) \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
[PROOF STEP]
by (auto simp add:inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
(pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
have "(dd \<longlongrightarrow> 0) at_infinity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dd \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
unfolding dd_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. (1::'a) / x ^ (degree p - degree q)) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
apply (rule tendsto_divide_0)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ((\<lambda>x. 1::'a) \<longlongrightarrow> ?c) at_infinity
 2. LIM x at_infinity. x ^ (degree p - degree q) :> at_infinity
[PROOF STEP]
by (auto intro!: filterlim_power_at_infinity simp add:assms)
[PROOF STATE]
proof (state)
this:
(dd \<longlongrightarrow> (0::'a)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(qq \<longlongrightarrow> lead_coeff q) at_infinity
(pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
(dd \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(qq \<longlongrightarrow> lead_coeff q) at_infinity
(pp \<longlongrightarrow> (1::'a) / lead_coeff p) at_infinity
(dd \<longlongrightarrow> (0::'a)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
by (auto intro:tendsto_eq_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_infinity. poly q x / poly p x = qq x * pp x * dd x
((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_infinity. poly q x / poly p x = qq x * pp x * dd x
((\<lambda>x. qq x * pp x * dd x) \<longlongrightarrow> (0::'a)) at_infinity

goal (1 subgoal):
 1. ((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity
[PROOF STEP]
by (auto dest:tendsto_cong)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. poly q x / poly p x) \<longlongrightarrow> (0::'a)) at_infinity

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multrow_mat_inv: assumes k: "k < n" and a: "(a :: 'a :: division_ring) \<noteq> 0"
  shows "multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
have "multrow_mat n k a * multrow_mat n k (inverse a) =
    multrow_mat n k a * (multrow_mat n k (inverse a) * 1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = multrow_mat n k a * (multrow_mat n k (inverse a) * 1\<^sub>m n)
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
k < n

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = multrow_mat n k a * (multrow_mat n k (inverse a) * 1\<^sub>m n)
[PROOF STEP]
by (simp add: right_mult_one_mat[of _ n])
[PROOF STATE]
proof (state)
this:
multrow_mat n k a * multrow_mat n k (inverse a) = multrow_mat n k a * (multrow_mat n k (inverse a) * 1\<^sub>m n)

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multrow_mat n k a * multrow_mat n k (inverse a) = multrow_mat n k a * (multrow_mat n k (inverse a) * 1\<^sub>m n)

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
have "multrow_mat n k (inverse a) * 1\<^sub>m n = multrow k (inverse a) (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multrow_mat n k (inverse a) * 1\<^sub>m n = multrow k (inverse a) (1\<^sub>m n)
[PROOF STEP]
by (rule multrow_mat[symmetric, of _ _ n], insert k, auto)
[PROOF STATE]
proof (state)
this:
multrow_mat n k (inverse a) * 1\<^sub>m n = multrow k (inverse a) (1\<^sub>m n)

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multrow_mat n k (inverse a) * 1\<^sub>m n = multrow k (inverse a) (1\<^sub>m n)

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
have "multrow_mat n k a * \<dots> = multrow k a \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multrow_mat n k a * multrow k (inverse a) (1\<^sub>m n) = multrow k a (multrow k (inverse a) (1\<^sub>m n))
[PROOF STEP]
by (rule multrow_mat[symmetric, of _ _ n], insert k, auto)
[PROOF STATE]
proof (state)
this:
multrow_mat n k a * multrow k (inverse a) (1\<^sub>m n) = multrow k a (multrow k (inverse a) (1\<^sub>m n))

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multrow_mat n k a * multrow k (inverse a) (1\<^sub>m n) = multrow k a (multrow k (inverse a) (1\<^sub>m n))

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
have "\<dots> = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multrow k a (multrow k (inverse a) (1\<^sub>m n)) = 1\<^sub>m n
[PROOF STEP]
by (rule eq_matI, insert a k a, auto)
[PROOF STATE]
proof (state)
this:
multrow k a (multrow k (inverse a) (1\<^sub>m n)) = 1\<^sub>m n

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n

goal (1 subgoal):
 1. multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
multrow_mat n k a * multrow_mat n k (inverse a) = 1\<^sub>m n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r01_binary_expression_correct:
  assumes "0 < r"
     and  "r < 1"
   shows "r = (\<Sum>n. real (r01_binary_expansion' r n) * (1/2)^(Suc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)
[PROOF STEP]
have "(\<lambda>n. (\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) (Suc n)) = r01_binary_expression r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r
[PROOF STEP]
have "\<And>n. {..<Suc n} = {0..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. {..<Suc n} = {0..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<Suc ?n} = {0..?n}

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{..<Suc ?n} = {0..?n}

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r
[PROOF STEP]
by(auto simp add: r01_binary_expression_def r01_binary_sum_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r

goal (1 subgoal):
 1. r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)
[PROOF STEP]
hence "LIMSEQ (\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i)  r"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r
[PROOF STEP]
using r01_binary_expression_converges_to_r[OF assms] LIMSEQ_imp_Suc[of "\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i" r]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r01_binary_expression r
r01_binary_expression r \<longlonglongrightarrow> r
(\<lambda>n. \<Sum>i<Suc n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r \<Longrightarrow> (\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r

goal (1 subgoal):
 1. r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r

goal (1 subgoal):
 1. r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)
[PROOF STEP]
using suminf_eq_lim[of "\<lambda>n. real (r01_binary_expansion' r n) * (1/2)^(Suc n)"] assms limI[of "(\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i)" r]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r
(\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n) = lim (\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i)
0 < r
r < 1
(\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) \<longlonglongrightarrow> r \<Longrightarrow> lim (\<lambda>n. \<Sum>i<n. real (r01_binary_expansion' r i) * (1 / 2) ^ Suc i) = r

goal (1 subgoal):
 1. r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r = (\<Sum>n. real (r01_binary_expansion' r n) * (1 / 2) ^ Suc n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_monotone_0_pi_le:
  assumes "0 \<le> y" and "y \<le> x" and "x \<le> pi"
  shows "cos x \<le> cos y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<le> cos y
[PROOF STEP]
proof (cases "y < x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. y < x \<Longrightarrow> cos x \<le> cos y
 2. \<not> y < x \<Longrightarrow> cos x \<le> cos y
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y < x

goal (2 subgoals):
 1. y < x \<Longrightarrow> cos x \<le> cos y
 2. \<not> y < x \<Longrightarrow> cos x \<le> cos y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x \<le> cos y
[PROOF STEP]
using cos_monotone_0_pi[OF \<open>0 \<le> y\<close> True \<open>x \<le> pi\<close>]
[PROOF STATE]
proof (prove)
using this:
cos x < cos y

goal (1 subgoal):
 1. cos x \<le> cos y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos x \<le> cos y

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> cos x \<le> cos y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> cos x \<le> cos y
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> y < x

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> cos x \<le> cos y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> y < x
[PROOF STEP]
have "y = x"
[PROOF STATE]
proof (prove)
using this:
\<not> y < x

goal (1 subgoal):
 1. y = x
[PROOF STEP]
using \<open>y \<le> x\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> y < x
y \<le> x

goal (1 subgoal):
 1. y = x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y = x

goal (1 subgoal):
 1. \<not> y < x \<Longrightarrow> cos x \<le> cos y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
y = x

goal (1 subgoal):
 1. cos x \<le> cos y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos x \<le> cos y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_aggregate_Cons: "
  \<lbrakk> 0 < k; length xs = k \<rbrakk> \<Longrightarrow>
  f_aggregate (xs @ ys) k ag = ag xs # (f_aggregate ys k ag)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; length xs = k\<rbrakk> \<Longrightarrow> f_aggregate (xs @ ys) k ag = ag xs # f_aggregate ys k ag
[PROOF STEP]
by (simp add: f_aggregate_def list_slice_def)


[STATEMENT]
lemma hoare_if_then_else:
  assumes "(\<lambda>s. P s \<and> T s) \<le> |X] Q"
    and "(\<lambda>s. P s \<and> \<not> T s) \<le> |Y] Q"
  shows "P \<le> |IF T THEN X ELSE Y] Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<le> |IF T THEN X ELSE Y] Q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>s. P s \<and> T s) \<le> |X] Q
(\<lambda>s. P s \<and> \<not> T s) \<le> |Y] Q

goal (1 subgoal):
 1. P \<le> |IF T THEN X ELSE Y] Q
[PROOF STEP]
unfolding fbox_def ifthenelse_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>s. P s \<and> T s) \<le> (\<lambda>s. \<forall>s'. s' \<in> X s \<longrightarrow> Q s')
(\<lambda>s. P s \<and> \<not> T s) \<le> (\<lambda>s. \<forall>s'. s' \<in> Y s \<longrightarrow> Q s')

goal (1 subgoal):
 1. P \<le> (\<lambda>s. \<forall>s'. s' \<in> (if T s then X s else Y s) \<longrightarrow> Q s')
[PROOF STEP]
by auto

\<comment> \<open> Finite iteration \<close>


[STATEMENT]
lemma connected_disjoint_Union_open_unique:
  assumes A: "pairwise disjnt A" and B: "pairwise disjnt B"
      and SA: "\<And>S. S \<in> A \<Longrightarrow> open S \<and> connected S \<and> S \<noteq> {}"
      and SB: "\<And>S. S \<in> B \<Longrightarrow> open S \<and> connected S \<and> S \<noteq> {}"
      and eq [simp]: "\<Union>A = \<Union>B"
    shows "A = B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = B
[PROOF STEP]
by (rule subset_antisym; metis connected_disjoint_Union_open_subset assms)


[STATEMENT]
lemma carrier_subgroup_generated_alt:
  assumes "Group.group G" "S \<subseteq> carrier G"
  shows "carrier (subgroup_generated G S) = \<Inter>{H. subgroup H G \<and> carrier G \<inter> S \<subseteq> H}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (subgroup_generated G S) = \<Inter> {H. subgroup H G \<and> carrier G \<inter> S \<subseteq> H}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Group.group G
S \<subseteq> carrier G

goal (1 subgoal):
 1. carrier (subgroup_generated G S) = \<Inter> {H. subgroup H G \<and> carrier G \<inter> S \<subseteq> H}
[PROOF STEP]
by (auto simp: group.generate_minimal subgroup_generated_def)


[STATEMENT]
lemma matrix_sum_dim:
  fixes f :: "nat \<Rightarrow> 'b::semiring_1 mat"
  shows "(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f 0 \<in> carrier_mat d d
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
?k < 0 \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (2 subgoals):
 1. (\<And>k. k < 0 \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f 0 \<in> carrier_mat d d
 2. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_sum d f 0 \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f 0 \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d
[PROOF STEP]
have "f n \<in> carrier_mat d d"
[PROOF STATE]
proof (prove)
using this:
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. f n \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f n \<in> carrier_mat d d

goal (1 subgoal):
 1. \<And>n. \<lbrakk>(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d; \<And>k. k < Suc n \<Longrightarrow> f k \<in> carrier_mat d d\<rbrakk> \<Longrightarrow> matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f n \<in> carrier_mat d d
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
f n \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
f n \<in> carrier_mat d d
(\<And>k. k < n \<Longrightarrow> f k \<in> carrier_mat d d) \<Longrightarrow> matrix_sum d f n \<in> carrier_mat d d
?k < Suc n \<Longrightarrow> f ?k \<in> carrier_mat d d

goal (1 subgoal):
 1. matrix_sum d f (Suc n) \<in> carrier_mat d d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_sum d f (Suc n) \<in> carrier_mat d d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_mset_lt_lt_le: "a < b \<Longrightarrow> A \<le> B \<Longrightarrow> add_mset a A < add_mset b B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; A \<le> B\<rbrakk> \<Longrightarrow> add_mset a A < add_mset b B
[PROOF STEP]
using add_mset_lt_lt_lt le_neq_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a < ?b; ?A < ?B\<rbrakk> \<Longrightarrow> add_mset ?a ?A < add_mset ?b ?B
\<lbrakk>?a \<le> ?b; ?a \<noteq> ?b\<rbrakk> \<Longrightarrow> ?a < ?b

goal (1 subgoal):
 1. \<lbrakk>a < b; A \<le> B\<rbrakk> \<Longrightarrow> add_mset a A < add_mset b B
[PROOF STEP]
by fastforce


[STATEMENT]
lemma INF_nat_minus:
  fixes f :: "nat \<Rightarrow> 'a::refinement_lattice"
  shows "(\<Sqinter>j\<in>{j. i < j}. f (j - i)) = (\<Sqinter>k\<in>{k. 0 < k}. f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sqinter>j::nat\<in>{j::nat. i < j}. f (j - i)) = \<Sqinter> (f ` {k::nat. (0::nat) < k})
variables:
i :: nat
f :: nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
apply (rule antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<Sqinter>j::nat\<in>{j::nat. i < j}. f (j - i)) \<sqsubseteq> \<Sqinter> (f ` {k::nat. (0::nat) < k})
 2. \<Sqinter> (f ` {k::nat. (0::nat) < k}) \<sqsubseteq> (\<Sqinter>j::nat\<in>{j::nat. i < j}. f (j - i))
variables:
i :: nat
f :: nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
apply (rule INF_mono, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>m::nat. (0::nat) < m \<Longrightarrow> \<exists>j>i. f (j - i) \<sqsubseteq> f m
 2. \<Sqinter> (f ` {k::nat. (0::nat) < k}) \<sqsubseteq> (\<Sqinter>j::nat\<in>{j::nat. i < j}. f (j - i))
variables:
f :: nat \<Rightarrow> 'a
i :: nat
type variables:
'a :: refinement_lattice
[PROOF STEP]
apply (metis add.right_neutral add_diff_cancel_left' add_less_cancel_left order_refl)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> (f ` {k::nat. (0::nat) < k}) \<sqsubseteq> (\<Sqinter>j::nat\<in>{j::nat. i < j}. f (j - i))
variables:
i :: nat
f :: nat \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
[PROOF STEP]
apply (rule INF_mono, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m::nat. i < m \<Longrightarrow> \<exists>k>0::nat. f k \<sqsubseteq> f (m - i)
variables:
f :: nat \<Rightarrow> 'a
i :: nat
type variables:
'a :: refinement_lattice
[PROOF STEP]
by (meson order_refl zero_less_diff)


[STATEMENT]
lemma ordered_map_set_eq:
  assumes "finite S" "is_map S"
  shows "set (ordered_map S) = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
have "set (ordered_map S) = get_map S ` set (sorted_list_of_set (fst ` S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (ordered_map S) = get_map S ` set (sorted_list_of_set (fst ` S))
[PROOF STEP]
unfolding ordered_map_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map (get_map S) (sorted_list_of_set (fst ` S))) = get_map S ` set (sorted_list_of_set (fst ` S))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (ordered_map S) = get_map S ` set (sorted_list_of_set (fst ` S))

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (ordered_map S) = get_map S ` set (sorted_list_of_set (fst ` S))

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
have "\<dots> = get_map S ` (fst ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_map S ` set (sorted_list_of_set (fst ` S)) = get_map S ` fst ` S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
is_map S

goal (1 subgoal):
 1. get_map S ` set (sorted_list_of_set (fst ` S)) = get_map S ` fst ` S
[PROOF STEP]
by (auto simp: sorted_list_of_set)
[PROOF STATE]
proof (state)
this:
get_map S ` set (sorted_list_of_set (fst ` S)) = get_map S ` fst ` S

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
get_map S ` set (sorted_list_of_set (fst ` S)) = get_map S ` fst ` S

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
have "\<dots> = (get_map S \<circ> fst) ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_map S ` fst ` S = (get_map S \<circ> fst) ` S
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. get_map S ` fst ` S = (\<lambda>x. get_map S (fst x)) ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
get_map S ` fst ` S = (get_map S \<circ> fst) ` S

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
get_map S ` fst ` S = (get_map S \<circ> fst) ` S

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
have "\<dots> = id ` S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (get_map S \<circ> fst) ` S = id ` S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
is_map S

goal (1 subgoal):
 1. (get_map S \<circ> fst) ` S = id ` S
[PROOF STEP]
by (force simp: get_map_elem)
[PROOF STATE]
proof (state)
this:
(get_map S \<circ> fst) ` S = id ` S

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set (ordered_map S) = id ` S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (ordered_map S) = id ` S

goal (1 subgoal):
 1. set (ordered_map S) = S
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set (ordered_map S) = S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eucl_of_list_eucl_nth:
  "(eucl_of_list xs::'a) $\<^sub>e i = xs ! i"
  if "length xs = DIM('a::executable_euclidean_space)"
    "i < DIM('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eucl_of_list xs $\<^sub>e i = xs ! i
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
length xs = DIM('a)
i < DIM('a)

goal (1 subgoal):
 1. eucl_of_list xs $\<^sub>e i = xs ! i
[PROOF STEP]
apply (auto simp: nth_eucl_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length xs = DIM('a); i < DIM('a)\<rbrakk> \<Longrightarrow> eucl_of_list xs \<bullet> Basis_list ! i = xs ! i
[PROOF STEP]
by (metis list_of_eucl_eucl_of_list list_of_eucl_nth)


[STATEMENT]
lemma min_int_poly_1 [simp]: "min_int_poly (1 :: 'a :: {field_char_0, field_gcd}) = [:-1, 1:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_int_poly (1::'a) = [:- 1, 1:]
[PROOF STEP]
using min_int_poly_of_int[of 1]
[PROOF STATE]
proof (prove)
using this:
min_int_poly (of_int 1) = [:- of_int 1, 1:]

goal (1 subgoal):
 1. min_int_poly (1::'a) = [:- 1, 1:]
[PROOF STEP]
unfolding of_int_1
[PROOF STATE]
proof (prove)
using this:
min_int_poly (1::?'a) = [:- 1, 1:]

goal (1 subgoal):
 1. min_int_poly (1::'a) = [:- 1, 1:]
[PROOF STEP]
by simp


[STATEMENT]
theorem Class_equivalence:
  "\<lbrakk> a \<in> S; b \<in> S \<rbrakk> \<Longrightarrow> Class a = Class b \<longleftrightarrow> (a, b) \<in> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> S; b \<in> S\<rbrakk> \<Longrightarrow> (Class a = Class b) = ((a, b) \<in> E)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>a \<in> S; b \<in> S; Class a = Class b\<rbrakk> \<Longrightarrow> (a, b) \<in> E
 2. \<lbrakk>a \<in> S; b \<in> S; (a, b) \<in> E\<rbrakk> \<Longrightarrow> Class a = Class b
[PROOF STEP]
fix a and b
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>a \<in> S; b \<in> S; Class a = Class b\<rbrakk> \<Longrightarrow> (a, b) \<in> E
 2. \<lbrakk>a \<in> S; b \<in> S; (a, b) \<in> E\<rbrakk> \<Longrightarrow> Class a = Class b
[PROOF STEP]
assume "a \<in> S" "b \<in> S" "Class a = Class b"
[PROOF STATE]
proof (state)
this:
a \<in> S
b \<in> S
Class a = Class b

goal (2 subgoals):
 1. \<lbrakk>a \<in> S; b \<in> S; Class a = Class b\<rbrakk> \<Longrightarrow> (a, b) \<in> E
 2. \<lbrakk>a \<in> S; b \<in> S; (a, b) \<in> E\<rbrakk> \<Longrightarrow> Class a = Class b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<in> S
b \<in> S
Class a = Class b
[PROOF STEP]
have "a \<in> Class a"
[PROOF STATE]
proof (prove)
using this:
a \<in> S
b \<in> S
Class a = Class b

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

goal (2 subgoals):
 1. \<lbrakk>a \<in> S; b \<in> S; Class a = Class b\<rbrakk> \<Longrightarrow> (a, b) \<in> E
 2. \<lbrakk>a \<in> S; b \<in> S; (a, b) \<in> E\<rbrakk> \<Longrightarrow> Class a = Class b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a \<in> Class a

goal (2 subgoals):
 1. \<lbrakk>a \<in> S; b \<in> S; Class a = Class b\<rbrakk> \<Longrightarrow> (a, b) \<in> E
 2. \<lbrakk>a \<in> S; b \<in> S; (a, b) \<in> E\<rbrakk> \<Longrightarrow> Class a = Class b
[PROOF STEP]
note \<open>Class a = Class b\<close>
[PROOF STATE]
proof (state)
this:
Class a = Class b

goal (2 subgoals):
 1. \<lbrakk>a \<in> S; b \<in> S; Class a = Class b\<rbrakk> \<Longrightarrow> (a, b) \<in> E
 2. \<lbrakk>a \<in> S; b \<in> S; (a, b) \<in> E\<rbrakk> \<Longrightarrow> Class a = Class b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a \<in> Class b
[PROOF STEP]
show "(a, b) \<in> E"
[PROOF STATE]
proof (prove)
using this:
a \<in> Class b

goal (1 subgoal):
 1. (a, b) \<in> E
[PROOF STEP]
by (fast intro: \<open>b \<in> S\<close>)
[PROOF STATE]
proof (state)
this:
(a, b) \<in> E

goal (1 subgoal):
 1. \<lbrakk>a \<in> S; b \<in> S; (a, b) \<in> E\<rbrakk> \<Longrightarrow> Class a = Class b
[PROOF STEP]
qed (rule Class_eq)


[STATEMENT]
lemma Field_sym_asym_factor_Un:
  "Field (sym_factor r) \<union> Field (asym_factor r) = Field r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Field (sym_factor r) \<union> Field (asym_factor r) = Field r
[PROOF STEP]
using sym_asym_factor_Un Field_Un
[PROOF STATE]
proof (prove)
using this:
sym_factor ?r \<union> asym_factor ?r = ?r
Field (?r \<union> ?s) = Field ?r \<union> Field ?s

goal (1 subgoal):
 1. Field (sym_factor r) \<union> Field (asym_factor r) = Field r
[PROOF STEP]
by metis


[STATEMENT]
lemma subst_compose_same:
  "\<And> \<phi> t1 t2 x. \<phi> \<in> fmla \<Longrightarrow> t1 \<in> trm \<Longrightarrow> t2 \<in> trm \<Longrightarrow> x \<in> var \<Longrightarrow>
  subst (subst \<phi> t1 x) t2 x = subst \<phi> (substT t1 t2 x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>\<phi> t1 t2 x. \<lbrakk>\<phi> \<in> fmla; t1 \<in> trm; t2 \<in> trm; x \<in> var\<rbrakk> \<Longrightarrow> subst (subst \<phi> t1 x) t2 x = subst \<phi> (substT t1 t2 x) x
[PROOF STEP]
using subst_compose_eq_or
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?\<phi> \<in> fmla; ?t1.0 \<in> trm; ?t2.0 \<in> trm; ?x1.0 \<in> var; ?x2.0 \<in> var; ?x1.0 = ?x2.0 \<or> ?x2.0 \<notin> Fvars ?\<phi>\<rbrakk> \<Longrightarrow> subst (subst ?\<phi> ?t1.0 ?x1.0) ?t2.0 ?x2.0 = subst ?\<phi> (substT ?t1.0 ?t2.0 ?x2.0) ?x1.0

goal (1 subgoal):
 1. \<And>\<phi> t1 t2 x. \<lbrakk>\<phi> \<in> fmla; t1 \<in> trm; t2 \<in> trm; x \<in> var\<rbrakk> \<Longrightarrow> subst (subst \<phi> t1 x) t2 x = subst \<phi> (substT t1 t2 x) x
[PROOF STEP]
by blast


[STATEMENT]
lemma card_geq_2_iff_contains_2_elems:
  shows "card A \<ge> 2 \<longleftrightarrow> finite A \<and> (\<exists> x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 \<le> card A) = (finite A \<and> (\<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A))
[PROOF STEP]
proof (intro iffI conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. 2 \<le> card A \<Longrightarrow> finite A
 2. 2 \<le> card A \<Longrightarrow> \<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A
 3. finite A \<and> (\<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A) \<Longrightarrow> 2 \<le> card A
[PROOF STEP]
assume *: "finite A \<and> (\<exists> x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A)"
[PROOF STATE]
proof (state)
this:
finite A \<and> (\<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A)

goal (3 subgoals):
 1. 2 \<le> card A \<Longrightarrow> finite A
 2. 2 \<le> card A \<Longrightarrow> \<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A
 3. finite A \<and> (\<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A) \<Longrightarrow> 2 \<le> card A
[PROOF STEP]
thus "card A \<ge> 2"
[PROOF STATE]
proof (prove)
using this:
finite A \<and> (\<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A)

goal (1 subgoal):
 1. 2 \<le> card A
[PROOF STEP]
by (metis card_0_eq card_Suc_eq empty_iff leI less_2_cases singletonD)
[PROOF STATE]
proof (state)
this:
2 \<le> card A

goal (2 subgoals):
 1. 2 \<le> card A \<Longrightarrow> finite A
 2. 2 \<le> card A \<Longrightarrow> \<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 2 \<le> card A \<Longrightarrow> finite A
 2. 2 \<le> card A \<Longrightarrow> \<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A
[PROOF STEP]
assume *: "2 \<le> card A"
[PROOF STATE]
proof (state)
this:
2 \<le> card A

goal (2 subgoals):
 1. 2 \<le> card A \<Longrightarrow> finite A
 2. 2 \<le> card A \<Longrightarrow> \<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
2 \<le> card A
[PROOF STEP]
show "finite A"
[PROOF STATE]
proof (prove)
using this:
2 \<le> card A

goal (1 subgoal):
 1. finite A
[PROOF STEP]
using card.infinite
[PROOF STATE]
proof (prove)
using this:
2 \<le> card A
infinite ?A \<Longrightarrow> card ?A = 0

goal (1 subgoal):
 1. finite A
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite A

goal (1 subgoal):
 1. 2 \<le> card A \<Longrightarrow> \<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A
[PROOF STEP]
show "\<exists> x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A
[PROOF STEP]
by (meson "*" card_2_iff' in_mono obtain_subset_with_card_n)
[PROOF STATE]
proof (state)
this:
\<exists>x y. x \<noteq> y \<and> x \<in> A \<and> y \<in> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_neq_4k1: "of_nat m \<noteq> (4 * of_nat k + 1) / (2 * 2^n :: 'a::field_char_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat m \<noteq> ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
assume "of_nat m = (4 * of_nat k + 1) / (2 * 2^n :: 'a)"
[PROOF STATE]
proof (state)
this:
of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n)

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n)
[PROOF STEP]
have "of_nat (m * (2 * 2^n)) = (of_nat (Suc (4 * k)) :: 'a)"
[PROOF STATE]
proof (prove)
using this:
of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n)

goal (1 subgoal):
 1. of_nat (m * (2 * 2 ^ n)) = of_nat (Suc (4 * k))
[PROOF STEP]
by (simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
of_nat (m * (2 * 2 ^ n)) = of_nat (Suc (4 * k))

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
of_nat (m * (2 * 2 ^ n)) = of_nat (Suc (4 * k))
[PROOF STEP]
have "m * (2 * 2^n) = Suc (4 * k)"
[PROOF STATE]
proof (prove)
using this:
of_nat (m * (2 * 2 ^ n)) = of_nat (Suc (4 * k))

goal (1 subgoal):
 1. m * (2 * 2 ^ n) = Suc (4 * k)
[PROOF STEP]
using of_nat_eq_iff
[PROOF STATE]
proof (prove)
using this:
of_nat (m * (2 * 2 ^ n)) = of_nat (Suc (4 * k))
(of_nat ?m = of_nat ?n) = (?m = ?n)

goal (1 subgoal):
 1. m * (2 * 2 ^ n) = Suc (4 * k)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
m * (2 * 2 ^ n) = Suc (4 * k)

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m * (2 * 2 ^ n) = Suc (4 * k)
[PROOF STEP]
have "odd (m * (2 * 2^n))"
[PROOF STATE]
proof (prove)
using this:
m * (2 * 2 ^ n) = Suc (4 * k)

goal (1 subgoal):
 1. odd (m * (2 * 2 ^ n))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
odd (m * (2 * 2 ^ n))

goal (1 subgoal):
 1. of_nat m = ((4::'a) * of_nat k + (1::'a)) / ((2::'a) * (2::'a) ^ n) \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
odd (m * (2 * 2 ^ n))
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
odd (m * (2 * 2 ^ n))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_permute_rows: assumes A: "A \<in> carrier_mat n n"
  and p: "p permutes {0 ..< (n :: nat)}"
  shows "det (mat n n (\<lambda> (i,j). A $$ (p i, j))) = signof p * det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
let ?U = "{0 ..< (n :: nat)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
have cong: "\<And> a b c. b = c \<Longrightarrow> a * b = a * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c. b = c \<Longrightarrow> a * b = a * c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?b = ?c \<Longrightarrow> ?a * ?b = ?a * ?c

goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
have "det (mat n n (\<lambda> (i,j). A $$ (p i, j))) =
    (\<Sum> q \<in> {q . q permutes ?U}. signof q * (\<Prod> i \<in> ?U. A $$ (p i, q i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = (\<Sum>q | q permutes {0..<n}. of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, q i)))
[PROOF STEP]
unfolding det_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if dim_row (mat n n (\<lambda>(i, j). A $$ (p i, j))) = dim_col (mat n n (\<lambda>(i, j). A $$ (p i, j))) then \<Sum>p | p permutes {0..<dim_row (mat n n (\<lambda>(i, j). A $$ (p i, j)))}. of_int (sign p) * (\<Prod>i = 0..<dim_row (mat n n (\<lambda>(i, j). A $$ (p i, j))). mat n n (\<lambda>(i, j). A $$ (p i, j)) $$ (i, p i)) else (0::'a)) = (\<Sum>q | q permutes {0..<n}. of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, q i)))
[PROOF STEP]
using A p
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n
p permutes {0..<n}

goal (1 subgoal):
 1. (if dim_row (mat n n (\<lambda>(i, j). A $$ (p i, j))) = dim_col (mat n n (\<lambda>(i, j). A $$ (p i, j))) then \<Sum>p | p permutes {0..<dim_row (mat n n (\<lambda>(i, j). A $$ (p i, j)))}. of_int (sign p) * (\<Prod>i = 0..<dim_row (mat n n (\<lambda>(i, j). A $$ (p i, j))). mat n n (\<lambda>(i, j). A $$ (p i, j)) $$ (i, p i)) else (0::'a)) = (\<Sum>q | q permutes {0..<n}. of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, q i)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = (\<Sum>q | q permutes {0..<n}. of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, q i)))

goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = (\<Sum>q | q permutes {0..<n}. of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, q i)))

goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
have "\<dots> = (\<Sum> q \<in> {q . q permutes ?U}. signof (q \<circ> p) * (\<Prod> i \<in> ?U. A $$ (p i, (q \<circ> p) i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q | q permutes {0..<n}. of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, q i))) = (\<Sum>q | q permutes {0..<n}. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)))
[PROOF STEP]
by (rule sum_permutations_compose_right[OF p])
[PROOF STATE]
proof (state)
this:
(\<Sum>q | q permutes {0..<n}. of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, q i))) = (\<Sum>q | q permutes {0..<n}. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)))

goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = (\<Sum>q | q permutes {0..<n}. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)))
[PROOF STEP]
have 1: "det (mat n n (\<lambda> (i,j). A $$ (p i, j)))
    = (\<Sum> q \<in> {q . q permutes ?U}. signof (q \<circ> p) * (\<Prod> i \<in> ?U. A $$ (p i, (q \<circ> p) i)))"
[PROOF STATE]
proof (prove)
using this:
det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = (\<Sum>q | q permutes {0..<n}. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)))

goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = (\<Sum>q | q permutes {0..<n}. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = (\<Sum>q | q permutes {0..<n}. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)))

goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
have 2: "signof p * det A =
    (\<Sum> q\<in>{q. q permutes ?U}. signof p * signof q * (\<Prod>i\<in> ?U. A $$ (i, q i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign p) * det A = (\<Sum>q | q permutes {0..<n}. of_int (sign p) * of_int (sign q) * (\<Prod>i = 0..<n. A $$ (i, q i)))
[PROOF STEP]
unfolding det_def'[OF A] sum_distrib_left
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>na\<in>{p. p permutes {0..<n}}. of_int (sign p) * (of_int (sign na) * (\<Prod>i = 0..<n. A $$ (i, na i)))) = (\<Sum>q | q permutes {0..<n}. of_int (sign p) * of_int (sign q) * (\<Prod>i = 0..<n. A $$ (i, q i)))
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
of_int (sign p) * det A = (\<Sum>q | q permutes {0..<n}. of_int (sign p) * of_int (sign q) * (\<Prod>i = 0..<n. A $$ (i, q i)))

goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A
[PROOF STEP]
unfolding 1 2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>q | q permutes {0..<n}. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i))) = (\<Sum>q | q permutes {0..<n}. of_int (sign p) * of_int (sign q) * (\<Prod>i = 0..<n. A $$ (i, q i)))
[PROOF STEP]
proof (rule sum.cong, insert p A, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
fix q
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
assume q: "q permutes ?U"
[PROOF STATE]
proof (state)
this:
q permutes {0..<n}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
let ?inv = "Hilbert_Choice.inv"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
from permutes_inv[OF p]
[PROOF STATE]
proof (chain)
picking this:
inv p permutes {0..<n}
[PROOF STEP]
have ip: "?inv p permutes ?U"
[PROOF STATE]
proof (prove)
using this:
inv p permutes {0..<n}

goal (1 subgoal):
 1. inv p permutes {0..<n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
inv p permutes {0..<n}

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
have "prod (\<lambda>i. A $$ (p i, (q \<circ> p) i)) ?U =
      prod (\<lambda>i. A $$ ((p \<circ> ?inv p) i, (q \<circ> (p \<circ> ?inv p)) i)) ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)) = (\<Prod>i = 0..<n. A $$ ((p \<circ> inv p) i, (q \<circ> (p \<circ> inv p)) i))
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. A $$ (p i, q (p i))) = (\<Prod>i = 0..<n. A $$ (p (inv p i), q (p (inv p i))))
[PROOF STEP]
by (rule trans[OF prod.permute[OF ip] prod.cong], insert A p q, auto)
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)) = (\<Prod>i = 0..<n. A $$ ((p \<circ> inv p) i, (q \<circ> (p \<circ> inv p)) i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)) = (\<Prod>i = 0..<n. A $$ ((p \<circ> inv p) i, (q \<circ> (p \<circ> inv p)) i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
have "\<dots> = prod (\<lambda>i. A$$(i,q i)) ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>i = 0..<n. A $$ ((p \<circ> inv p) i, (q \<circ> (p \<circ> inv p)) i)) = (\<Prod>i = 0..<n. A $$ (i, q i))
[PROOF STEP]
by (simp only: o_def permutes_inverses[OF p])
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A $$ ((p \<circ> inv p) i, (q \<circ> (p \<circ> inv p)) i)) = (\<Prod>i = 0..<n. A $$ (i, q i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)) = (\<Prod>i = 0..<n. A $$ (i, q i))
[PROOF STEP]
have thp: "prod (\<lambda>i. A $$ (p i, (q \<circ> p) i)) ?U = prod (\<lambda>i. A$$(i,q i)) ?U"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)) = (\<Prod>i = 0..<n. A $$ (i, q i))

goal (1 subgoal):
 1. (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)) = (\<Prod>i = 0..<n. A $$ (i, q i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i)) = (\<Prod>i = 0..<n. A $$ (i, q i))

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x permutes {0..<n}; p permutes {0..<n}; A \<in> carrier_mat n n\<rbrakk> \<Longrightarrow> of_int (sign (x \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, x (p i))) = of_int (sign p) * of_int (sign x) * (\<Prod>i = 0..<n. A $$ (i, x i))
[PROOF STEP]
show "signof (q \<circ> p) * (\<Prod>i\<in>{0..<n}. A $$ (p i, q (p i))) =
         signof p * signof q * (\<Prod>i\<in>{0..<n}. A $$ (i, q i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, q (p i))) = of_int (sign p) * of_int (sign q) * (\<Prod>i = 0..<n. A $$ (i, q i))
[PROOF STEP]
unfolding thp[symmetric] signof_compose[OF q p]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (sign q) * of_int (sign p) * (\<Prod>i = 0..<n. A $$ (p i, q (p i))) = of_int (sign p) * of_int (sign q) * (\<Prod>i = 0..<n. A $$ (p i, (q \<circ> p) i))
[PROOF STEP]
by (simp add: ac_simps)
[PROOF STATE]
proof (state)
this:
of_int (sign (q \<circ> p)) * (\<Prod>i = 0..<n. A $$ (p i, q (p i))) = of_int (sign p) * of_int (sign q) * (\<Prod>i = 0..<n. A $$ (i, q i))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (mat n n (\<lambda>(i, j). A $$ (p i, j))) = of_int (sign p) * det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_iff4:
assumes WELL: "Well_order r"  and WELL': "Well_order r'"
shows "iso r r' f = (embed r r' f \<and> embed r' r (inv_into (Field r) f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iso r r' f = (embed r r' f \<and> embed r' r (inv_into (Field r) f))
[PROOF STEP]
using assms embed_bothWays_iso
[PROOF STATE]
proof (prove)
using this:
Well_order r
Well_order r'
\<lbrakk>Well_order ?r; Well_order ?r'; embed ?r ?r' ?f; embed ?r' ?r ?g\<rbrakk> \<Longrightarrow> iso ?r ?r' ?f

goal (1 subgoal):
 1. iso r r' f = (embed r r' f \<and> embed r' r (inv_into (Field r) f))
[PROOF STEP]
by(unfold iso_def, auto simp add: inv_into_Field_embed_bij_betw)


[STATEMENT]
lemma iso_order_closed:
  assumes "\<phi> \<in> iso G H"
  shows "order G = order H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order G = order H
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> Group.iso G H

goal (1 subgoal):
 1. order G = order H
[PROOF STEP]
unfolding order_def iso_def
[PROOF STATE]
proof (prove)
using this:
\<phi> \<in> {h \<in> hom G H. bij_betw h (carrier G) (carrier H)}

goal (1 subgoal):
 1. card (carrier G) = card (carrier H)
[PROOF STEP]
by (metis (no_types) bij_betw_same_card mem_Collect_eq)


[STATEMENT]
lemma (in strategic_space_2p) sum_of_prob:
  fixes v :: "complex Matrix.mat"
  assumes "state 2 v"
  shows "(prob00 v) + (prob11 v) + (prob01 v) + (prob10 v) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = 1
[PROOF STEP]
have "(prob00 v) + (prob11 v) + (prob01 v) + (prob10 v) =
        (cmod (v $$ (0,0)))\<^sup>2 + (cmod (v $$ (1,0)))\<^sup>2 + (cmod (v $$ (2,0)))\<^sup>2 + (cmod (v $$ (3,0)))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2 + (cmod (v $$ (2, 0)))\<^sup>2 + (cmod (v $$ (3, 0)))\<^sup>2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
state 2 v

goal (1 subgoal):
 1. (if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2 + (cmod (v $$ (2, 0)))\<^sup>2 + (cmod (v $$ (3, 0)))\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2 + (cmod (v $$ (2, 0)))\<^sup>2 + (cmod (v $$ (3, 0)))\<^sup>2

goal (1 subgoal):
 1. (if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2 + (cmod (v $$ (2, 0)))\<^sup>2 + (cmod (v $$ (3, 0)))\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2 + (cmod (v $$ (2, 0)))\<^sup>2 + (cmod (v $$ (3, 0)))\<^sup>2

goal (1 subgoal):
 1. (if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = 1
[PROOF STEP]
using state_def assms cpx_vec_length_def
[PROOF STATE]
proof (prove)
using this:
(if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = (cmod (v $$ (0, 0)))\<^sup>2 + (cmod (v $$ (1, 0)))\<^sup>2 + (cmod (v $$ (2, 0)))\<^sup>2 + (cmod (v $$ (3, 0)))\<^sup>2
state ?n ?v \<equiv> dim_col ?v = 1 \<and> dim_row ?v = 2 ^ ?n \<and> \<parallel>Matrix.col ?v 0\<parallel> = 1
state 2 v
\<parallel>?v\<parallel> \<equiv> sqrt (\<Sum>i<dim_vec ?v. (cmod (?v $ i))\<^sup>2)

goal (1 subgoal):
 1. (if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = 1
[PROOF STEP]
by (auto simp add: set_4)
[PROOF STATE]
proof (state)
this:
(if state 2 v then (cmod (v $$ (0, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (3, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (1, 0)))\<^sup>2 else undefined) + (if state 2 v then (cmod (v $$ (2, 0)))\<^sup>2 else undefined) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_cancel:
  assumes "eventually (\<lambda>x. f x \<noteq> 0) F"
  assumes "eventually (\<lambda>x. g x \<noteq> 0) F"
  shows   "(\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x)) \<longleftrightarrow> g \<in> L F (f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x))) = (g \<in> L F f)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x)) \<Longrightarrow> g \<in> L F f
 2. g \<in> L F f \<Longrightarrow> (\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x))
[PROOF STEP]
assume "(\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x))"
[PROOF STATE]
proof (state)
this:
(\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x))

goal (2 subgoals):
 1. (\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x)) \<Longrightarrow> g \<in> L F f
 2. g \<in> L F f \<Longrightarrow> (\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x))
[PROOF STEP]
from inverse[OF _ _ this] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<forall>\<^sub>F x in F. inverse (f x) \<noteq> (0::'b); \<forall>\<^sub>F x in F. inverse (g x) \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. inverse (inverse (g x))) \<in> L F (\<lambda>x. inverse (inverse (f x)))
\<forall>\<^sub>F x in F. f x \<noteq> (0::'b)
\<forall>\<^sub>F x in F. g x \<noteq> (0::'b)
[PROOF STEP]
show "g \<in> L F (f)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>\<^sub>F x in F. inverse (f x) \<noteq> (0::'b); \<forall>\<^sub>F x in F. inverse (g x) \<noteq> (0::'b)\<rbrakk> \<Longrightarrow> (\<lambda>x. inverse (inverse (g x))) \<in> L F (\<lambda>x. inverse (inverse (f x)))
\<forall>\<^sub>F x in F. f x \<noteq> (0::'b)
\<forall>\<^sub>F x in F. g x \<noteq> (0::'b)

goal (1 subgoal):
 1. g \<in> L F f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
g \<in> L F f

goal (1 subgoal):
 1. g \<in> L F f \<Longrightarrow> (\<lambda>x. inverse (f x)) \<in> L F (\<lambda>x. inverse (g x))
[PROOF STEP]
qed (intro inverse assms)


[STATEMENT]
lemma finite_psupset_wf[simp, intro]: "finite S \<Longrightarrow> wf (finite_psupset S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> wf (finite_psupset S)
[PROOF STEP]
unfolding finite_psupset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> wf {(Q', Q). Q \<subset> Q' \<and> Q' \<subseteq> S}
[PROOF STEP]
by (blast intro: wf_bounded_supset)


[STATEMENT]
lemma int_of_integer_0: "int_of_integer 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_of_integer 0 = 0
[PROOF STEP]
unfolding int_of_integer_0_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = 0
[PROOF STEP]
by simp


[STATEMENT]
theorem (in linorder) rbt_lookup_rbt_map_entry:
  "rbt_lookup (rbt_map_entry k f t) = (rbt_lookup t)(k := map_option f (rbt_lookup t k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rbt_lookup (rbt_map_entry k f t) = (rbt_lookup t)(k := map_option f (rbt_lookup t k))
[PROOF STEP]
by (induct t) (auto split: option.splits simp add: fun_eq_iff)


[STATEMENT]
lemma det_column_add:
assumes i_not_j: "i \<noteq> j"
shows "det (column_add A i j q) = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
have "(column_add A i j q) = (transpose (row_add (transpose A) i j q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column_add A i j q = Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q)
[PROOF STEP]
unfolding transpose_def column_add_def row_add_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>ia ja. if ja = i then A $ ia $ i + A $ ia $ j * q else A $ ia $ ja) = (\<chi>ia ja. (\<chi>ia ja. if ia = i then (\<chi>i j. A $ j $ i) $ i $ ja + q * (\<chi>i j. A $ j $ i) $ j $ ja else (\<chi>i j. A $ j $ i) $ ia $ ja) $ ja $ ia)
[PROOF STEP]
by vector
[PROOF STATE]
proof (state)
this:
column_add A i j q = Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q)

goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
hence "det (column_add A i j q) = det (transpose (row_add (transpose A) i j q))"
[PROOF STATE]
proof (prove)
using this:
column_add A i j q = Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q)

goal (1 subgoal):
 1. det (column_add A i j q) = det (Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (column_add A i j q) = det (Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q))

goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (column_add A i j q) = det (Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q))

goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
have "... = det (row_add (transpose A) i j q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q)) = det (row_add (Finite_Cartesian_Product.transpose A) i j q)
[PROOF STEP]
unfolding det_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add (Finite_Cartesian_Product.transpose A) i j q) = det (row_add (Finite_Cartesian_Product.transpose A) i j q)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det (Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q)) = det (row_add (Finite_Cartesian_Product.transpose A) i j q)

goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (Finite_Cartesian_Product.transpose (row_add (Finite_Cartesian_Product.transpose A) i j q)) = det (row_add (Finite_Cartesian_Product.transpose A) i j q)

goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
have "... = det A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (row_add (Finite_Cartesian_Product.transpose A) i j q) = det A
[PROOF STEP]
unfolding det_row_add'[OF i_not_j] det_transpose
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = det A
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det (row_add (Finite_Cartesian_Product.transpose A) i j q) = det A

goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (column_add A i j q) = det A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
det (column_add A i j q) = det A

goal (1 subgoal):
 1. det (column_add A i j q) = det A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det (column_add A i j q) = det A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_cvec_scale:
  assumes "z' = k *\<^sub>s\<^sub>v z"
  shows "\<langle>z'\<rangle>\<^sup>2 = Re (cnj k * k) * \<langle>z\<rangle>\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>z'\<rangle>\<^sup>2 = Re (cnj k * k) * \<langle>z\<rangle>\<^sup>2
[PROOF STEP]
unfolding norm_cvec_square
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re \<langle>z',z'\<rangle> = Re (cnj k * k) * Re \<langle>z,z\<rangle>
[PROOF STEP]
using inprod_cvec_bilinear1[OF assms, of z']
[PROOF STATE]
proof (prove)
using this:
\<langle>z',z'\<rangle> = cnj k * \<langle>z,z'\<rangle>

goal (1 subgoal):
 1. Re \<langle>z',z'\<rangle> = Re (cnj k * k) * Re \<langle>z,z\<rangle>
[PROOF STEP]
using inprod_cvec_bilinear2[OF assms, of z]
[PROOF STATE]
proof (prove)
using this:
\<langle>z',z'\<rangle> = cnj k * \<langle>z,z'\<rangle>
\<langle>z,z'\<rangle> = k * \<langle>z,z\<rangle>

goal (1 subgoal):
 1. Re \<langle>z',z'\<rangle> = Re (cnj k * k) * Re \<langle>z,z\<rangle>
[PROOF STEP]
by (simp del: inprod_cvec_def add: field_simps)


[STATEMENT]
lemma eq_mod_dvd_minus:
  fixes c::"'a::unique_euclidean_ring"
  assumes "c \<noteq> 0" and "a mod c = b mod c"
  shows "c dvd a - b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c dvd a - b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)
a mod c = b mod c

goal (1 subgoal):
 1. c dvd a - b
[PROOF STEP]
by (simp add: mod_eq_dvd_iff)


[STATEMENT]
lemma eventually_mono_power_odd:
  assumes "odd n" "eventually (\<lambda>x. f x \<le> (g x :: real)) at_top"
  shows   "eventually (\<lambda>x. f x ^ n \<le> g x ^ n) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x ^ n \<le> g x ^ n
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. f x \<le> g x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. f x ^ n \<le> g x ^ n
[PROOF STEP]
by eventually_elim (insert assms(1), auto intro: power_mono_odd)


[STATEMENT]
lemma power_eq_imp_eq_norm:
  fixes w :: "'a::real_normed_div_algebra"
  assumes eq: "w ^ n = z ^ n" and "n > 0"
    shows "norm w = norm z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm w = norm z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm w = norm z
[PROOF STEP]
have "norm w ^ n = norm z ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm w ^ n = norm z ^ n
[PROOF STEP]
by (metis (no_types) eq norm_power)
[PROOF STATE]
proof (state)
this:
norm w ^ n = norm z ^ n

goal (1 subgoal):
 1. norm w = norm z
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
norm w ^ n = norm z ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm w ^ n = norm z ^ n

goal (1 subgoal):
 1. norm w = norm z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
norm w ^ n = norm z ^ n
w ^ n = z ^ n
0 < n

goal (1 subgoal):
 1. norm w = norm z
[PROOF STEP]
by (force intro: power_eq_imp_eq_base)
[PROOF STATE]
proof (state)
this:
norm w = norm z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_ge_one_plus_x_over_n_power_n:
  assumes "x \<ge> - real n" "n > 0"
  shows "(1 + x / of_nat n) ^ n \<le> exp x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
proof (cases "x = - of_nat n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
 2. x \<noteq> - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> - real n

goal (2 subgoals):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
 2. x \<noteq> - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
from assms False
[PROOF STATE]
proof (chain)
picking this:
- real n \<le> x
0 < n
x \<noteq> - real n
[PROOF STEP]
have "(1 + x / of_nat n) ^ n = exp (of_nat n * ln (1 + x / of_nat n))"
[PROOF STATE]
proof (prove)
using this:
- real n \<le> x
0 < n
x \<noteq> - real n

goal (1 subgoal):
 1. (1 + x / real n) ^ n = exp (real n * ln (1 + x / real n))
[PROOF STEP]
by (subst exp_of_nat_mult, subst exp_ln) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
(1 + x / real n) ^ n = exp (real n * ln (1 + x / real n))

goal (2 subgoals):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
 2. x \<noteq> - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(1 + x / real n) ^ n = exp (real n * ln (1 + x / real n))

goal (2 subgoals):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
 2. x \<noteq> - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
from assms False
[PROOF STATE]
proof (chain)
picking this:
- real n \<le> x
0 < n
x \<noteq> - real n
[PROOF STEP]
have "ln (1 + x / real n) \<le> x / real n"
[PROOF STATE]
proof (prove)
using this:
- real n \<le> x
0 < n
x \<noteq> - real n

goal (1 subgoal):
 1. ln (1 + x / real n) \<le> x / real n
[PROOF STEP]
by (intro ln_add_one_self_le_self2) (simp_all add: field_simps)
[PROOF STATE]
proof (state)
this:
ln (1 + x / real n) \<le> x / real n

goal (2 subgoals):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
 2. x \<noteq> - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
- real n \<le> x
0 < n
ln (1 + x / real n) \<le> x / real n
[PROOF STEP]
have "exp (of_nat n * ln (1 + x / of_nat n)) \<le> exp x"
[PROOF STATE]
proof (prove)
using this:
- real n \<le> x
0 < n
ln (1 + x / real n) \<le> x / real n

goal (1 subgoal):
 1. exp (real n * ln (1 + x / real n)) \<le> exp x
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
exp (real n * ln (1 + x / real n)) \<le> exp x

goal (2 subgoals):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
 2. x \<noteq> - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(1 + x / real n) ^ n \<le> exp x

goal (1 subgoal):
 1. (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(1 + x / real n) ^ n \<le> exp x

goal (1 subgoal):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = - real n

goal (1 subgoal):
 1. x = - real n \<Longrightarrow> (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = - real n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = - real n

goal (1 subgoal):
 1. (1 + x / real n) ^ n \<le> exp x
[PROOF STEP]
by (simp add: zero_power)
[PROOF STATE]
proof (state)
this:
(1 + x / real n) ^ n \<le> exp x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma imp_trans: "((P \<longrightarrow> Q) \<and> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R) = true"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((P \<longrightarrow> Q) \<and> (Q \<longrightarrow> R) \<longrightarrow> P \<longrightarrow> R) = true
[PROOF STEP]
by (rule ext) blast


[STATEMENT]
lemma rtranclp_unfold: "rtranclp R x z \<Longrightarrow> x = z \<or> (\<exists>y. R x y \<and> rtranclp R y z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R\<^sup>*\<^sup>* x z \<Longrightarrow> x = z \<or> (\<exists>y. R x y \<and> R\<^sup>*\<^sup>* y z)
[PROOF STEP]
by (induction x z rule: rtranclp.induct) auto


[STATEMENT]
lemma subset_with_given_card_exists:
  assumes "n \<le> card A"
  shows "\<exists>B \<subseteq> A. card B = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<le> card A

goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = n
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = 0
 2. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<le> card A

goal (2 subgoals):
 1. 0 \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = 0
 2. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> card A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 \<le> card A

goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>B\<subseteq>A. card B = 0

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n
Suc n \<le> card A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n
Suc n \<le> card A
[PROOF STEP]
obtain B where "B \<subseteq> A" "card B = n"
[PROOF STATE]
proof (prove)
using this:
n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n
Suc n \<le> card A

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>B \<subseteq> A; card B = n\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
B \<subseteq> A
card B = n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
from this \<open>B \<subseteq> A\<close> \<open>card B = n\<close>
[PROOF STATE]
proof (chain)
picking this:
B \<subseteq> A
card B = n
B \<subseteq> A
card B = n
[PROOF STEP]
have "card B < card A"
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
card B = n
B \<subseteq> A
card B = n

goal (1 subgoal):
 1. card B < card A
[PROOF STEP]
using Suc.prems
[PROOF STATE]
proof (prove)
using this:
B \<subseteq> A
card B = n
B \<subseteq> A
card B = n
Suc n \<le> card A

goal (1 subgoal):
 1. card B < card A
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
card B < card A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
from \<open>Suc n \<le> card A\<close> card.infinite
[PROOF STATE]
proof (chain)
picking this:
Suc n \<le> card A
infinite ?A \<Longrightarrow> card ?A = 0
[PROOF STEP]
have "finite A"
[PROOF STATE]
proof (prove)
using this:
Suc n \<le> card A
infinite ?A \<Longrightarrow> card ?A = 0

goal (1 subgoal):
 1. finite A
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite A

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
from this \<open>B \<subseteq> A\<close> finite_subset
[PROOF STATE]
proof (chain)
picking this:
finite A
B \<subseteq> A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A
[PROOF STEP]
have "finite B"
[PROOF STATE]
proof (prove)
using this:
finite A
B \<subseteq> A
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finite B

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
from \<open>card B < card A\<close> \<open>B \<subseteq> A\<close>
[PROOF STATE]
proof (chain)
picking this:
card B < card A
B \<subseteq> A
[PROOF STEP]
obtain a where "a \<in> A" "a \<notin> B"
[PROOF STATE]
proof (prove)
using this:
card B < card A
B \<subseteq> A

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> A; a \<notin> B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis less_irrefl subsetI subset_antisym)
[PROOF STATE]
proof (state)
this:
a \<in> A
a \<notin> B

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
have "insert a B \<subseteq> A" "card (insert a B) = Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert a B \<subseteq> A &&& card (insert a B) = Suc n
[PROOF STEP]
using \<open>finite B\<close> \<open>a \<in> A\<close> \<open>a \<notin> B\<close> \<open>B \<subseteq> A\<close> \<open>card B = n\<close>
[PROOF STATE]
proof (prove)
using this:
finite B
a \<in> A
a \<notin> B
B \<subseteq> A
card B = n

goal (1 subgoal):
 1. insert a B \<subseteq> A &&& card (insert a B) = Suc n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert a B \<subseteq> A
card (insert a B) = Suc n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>n \<le> card A \<Longrightarrow> \<exists>B\<subseteq>A. card B = n; Suc n \<le> card A\<rbrakk> \<Longrightarrow> \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
insert a B \<subseteq> A
card (insert a B) = Suc n
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
insert a B \<subseteq> A
card (insert a B) = Suc n

goal (1 subgoal):
 1. \<exists>B\<subseteq>A. card B = Suc n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>B\<subseteq>A. card B = Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_pivot_positions_dim_row:
  assumes "row_echelon_form A"
  shows "length (pivot_positions A) \<le> dim_row A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
have 1: "A \<in> carrier_mat (dim_row A) (dim_col A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat (dim_row A) (dim_col A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<in> carrier_mat (dim_row A) (dim_col A)

goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
obtain f where 2: "pivot_fun A f (dim_col A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. pivot_fun A f (dim_col A) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms row_echelon_form_def
[PROOF STATE]
proof (prove)
using this:
row_echelon_form A
row_echelon_form ?A \<equiv> \<exists>f. pivot_fun ?A f (dim_col ?A)

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

goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
from pivot_positions(4)[OF 1 2]
[PROOF STATE]
proof (chain)
picking this:
length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}
[PROOF STEP]
have
    "length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}"
[PROOF STATE]
proof (prove)
using this:
length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}

goal (1 subgoal):
 1. length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}

goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}

goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
have "... \<le> card {i. i < dim_row A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)} \<le> card {i. i < dim_row A}
[PROOF STEP]
apply (rule card_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite {i. i < dim_row A}
 2. {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)} \<subseteq> {i. i < dim_row A}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)} \<le> card {i. i < dim_row A}

goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}
card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)} \<le> card {i. i < dim_row A}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (pivot_positions A) = card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)}
card {i. i < dim_row A \<and> row A i \<noteq> 0\<^sub>v (dim_col A)} \<le> card {i. i < dim_row A}

goal (1 subgoal):
 1. length (pivot_positions A) \<le> dim_row A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (pivot_positions A) \<le> dim_row A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isometry_preserves_geodesic_segment_between:
  assumes "isometry_on X f"
          "G \<subseteq> X" "geodesic_segment_between G x y"
  shows "geodesic_segment_between (f`G) (f x) (f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between (f ` G) (f x) (f y)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. geodesic_segment_between (f ` G) (f x) (f y)
[PROOF STEP]
obtain g where g: "g 0 = x" "g (dist x y) = y" "isometry_on {0..dist x y} g" "G = g`{0..dist x y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. \<lbrakk>g 0 = x; g (dist x y) = y; isometry_on {0..dist x y} g; G = g ` {0..dist x y}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson \<open>geodesic_segment_between G x y\<close> geodesic_segment_between_def)
[PROOF STATE]
proof (state)
this:
g 0 = x
g (dist x y) = y
isometry_on {0..dist x y} g
G = g ` {0..dist x y}

goal (1 subgoal):
 1. geodesic_segment_between (f ` G) (f x) (f y)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g 0 = x
g (dist x y) = y
isometry_on {0..dist x y} g
G = g ` {0..dist x y}
[PROOF STEP]
have *: "f`G = (f o g) `{0..dist x y}" "f x = (f o g) 0" "f y = (f o g) (dist x y)"
[PROOF STATE]
proof (prove)
using this:
g 0 = x
g (dist x y) = y
isometry_on {0..dist x y} g
G = g ` {0..dist x y}

goal (1 subgoal):
 1. f ` G = (f \<circ> g) ` {0..dist x y} &&& f x = (f \<circ> g) 0 &&& f y = (f \<circ> g) (dist x y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f ` G = (f \<circ> g) ` {0..dist x y}
f x = (f \<circ> g) 0
f y = (f \<circ> g) (dist x y)

goal (1 subgoal):
 1. geodesic_segment_between (f ` G) (f x) (f y)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between (f ` G) (f x) (f y)
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_segment_between ((f \<circ> g) ` {0..dist x y}) ((f \<circ> g) 0) ((f \<circ> g) (dist x y))
[PROOF STEP]
apply (intro geodesic_segmentI2(1))
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. isometry_on {0..dist x y} (f \<circ> g)
 2. 0 \<le> dist x y
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. isometry_on {0..dist x y} (\<lambda>x. f (g x))
 2. 0 \<le> dist x y
[PROOF STEP]
apply (rule isometry_on_compose[of _ g])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. isometry_on {0..dist x y} g
 2. isometry_on (g ` {0..dist x y}) f
 3. 0 \<le> dist x y
[PROOF STEP]
using g(3) g(4) assms
[PROOF STATE]
proof (prove)
using this:
isometry_on {0..dist x y} g
G = g ` {0..dist x y}
isometry_on X f
G \<subseteq> X
geodesic_segment_between G x y

goal (3 subgoals):
 1. isometry_on {0..dist x y} g
 2. isometry_on (g ` {0..dist x y}) f
 3. 0 \<le> dist x y
[PROOF STEP]
by (auto intro: isometry_on_subset)
[PROOF STATE]
proof (state)
this:
geodesic_segment_between (f ` G) (f x) (f y)

goal:
No subgoals!
[PROOF STEP]
qed