[STATEMENT]
lemma decompress_compress_mod:
  assumes "x\<in>{\<lceil>q-(q/(2*2^d))\<rceil>..q-1}"
          "of_nat d < \<lceil>(log 2 q)::real\<rceil>"
  shows "abs ((decompress d (compress d x) - x) mod+- q) \<le>
         round ( real_of_int q / real_of_int (2^(d+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "(decompress d (compress d x) - x) = - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. decompress d (compress d x) - x = - x
[PROOF STEP]
using compress_mod[OF assms]
[PROOF STATE]
proof (prove)
using this:
compress d x = 0

goal (1 subgoal):
 1. decompress d (compress d x) - x = - x
[PROOF STEP]
unfolding decompress_def
[PROOF STATE]
proof (prove)
using this:
compress d x = 0

goal (1 subgoal):
 1. round (real_of_int q * real_of_int (compress d x) / real_of_int 2 ^ d) - x = - x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
decompress d (compress d x) - x = - x

goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
decompress d (compress d x) - x = - x

goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "-x mod+- q = -x+q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x mod+- q = - x + q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - x mod+- q = - x + q
[PROOF STEP]
have "(-x + \<lfloor>q/2\<rfloor>) + q < q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x + \<lfloor>real_of_int q / 2\<rfloor> + q < q
[PROOF STEP]
using assms(1)
      break_point_gt_q_div_two[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
x \<in> {\<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>..q - 1}
\<lfloor>real_of_int q / 2\<rfloor> < \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>

goal (1 subgoal):
 1. - x + \<lfloor>real_of_int q / 2\<rfloor> + q < q
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
- x + \<lfloor>real_of_int q / 2\<rfloor> + q < q

goal (1 subgoal):
 1. - x mod+- q = - x + q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
- x + \<lfloor>real_of_int q / 2\<rfloor> + q < q

goal (1 subgoal):
 1. - x mod+- q = - x + q
[PROOF STEP]
have "(-x + \<lfloor>q/2\<rfloor>) + q \<ge> 0 "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> - x + \<lfloor>real_of_int q / 2\<rfloor> + q
[PROOF STEP]
using assms(1) q_gt_zero
[PROOF STATE]
proof (prove)
using this:
x \<in> {\<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>..q - 1}
0 < q

goal (1 subgoal):
 1. 0 \<le> - x + \<lfloor>real_of_int q / 2\<rfloor> + q
[PROOF STEP]
by (smt (verit, best) atLeastAtMost_iff divide_nonneg_nonneg
        of_int_nonneg zero_le_floor)
[PROOF STATE]
proof (state)
this:
0 \<le> - x + \<lfloor>real_of_int q / 2\<rfloor> + q

goal (1 subgoal):
 1. - x mod+- q = - x + q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
- x + \<lfloor>real_of_int q / 2\<rfloor> + q < q
0 \<le> - x + \<lfloor>real_of_int q / 2\<rfloor> + q
[PROOF STEP]
have "(- x + \<lfloor>q/2\<rfloor>) mod q = - x + \<lfloor>q/2\<rfloor> + q"
[PROOF STATE]
proof (prove)
using this:
- x + \<lfloor>real_of_int q / 2\<rfloor> + q < q
0 \<le> - x + \<lfloor>real_of_int q / 2\<rfloor> + q

goal (1 subgoal):
 1. (- x + \<lfloor>real_of_int q / 2\<rfloor>) mod q = - x + \<lfloor>real_of_int q / 2\<rfloor> + q
[PROOF STEP]
by (metis mod_add_self2 mod_pos_pos_trivial)
[PROOF STATE]
proof (state)
this:
(- x + \<lfloor>real_of_int q / 2\<rfloor>) mod q = - x + \<lfloor>real_of_int q / 2\<rfloor> + q

goal (1 subgoal):
 1. - x mod+- q = - x + q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(- x + \<lfloor>real_of_int q / 2\<rfloor>) mod q = - x + \<lfloor>real_of_int q / 2\<rfloor> + q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(- x + \<lfloor>real_of_int q / 2\<rfloor>) mod q = - x + \<lfloor>real_of_int q / 2\<rfloor> + q

goal (1 subgoal):
 1. - x mod+- q = - x + q
[PROOF STEP]
unfolding mod_plus_minus_def
[PROOF STATE]
proof (prove)
using this:
(- x + \<lfloor>real_of_int q / 2\<rfloor>) mod q = - x + \<lfloor>real_of_int q / 2\<rfloor> + q

goal (1 subgoal):
 1. (- x + \<lfloor>real_of_int q / 2\<rfloor>) mod q - \<lfloor>real_of_int q / 2\<rfloor> = - x + q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- x mod+- q = - x + q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- x mod+- q = - x + q

goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
- x mod+- q = - x + q

goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "abs (q - x) \<le> round ( real_of_int q /
    real_of_int (2^(d+1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "abs (q-x) = q-x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>q - x\<bar> = q - x
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> {\<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>..q - 1}

goal (1 subgoal):
 1. \<bar>q - x\<bar> = q - x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>q - x\<bar> = q - x

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<bar>q - x\<bar> = q - x

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> \<le> q - \<lceil>q - q/(2*2^d)\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q - x \<le> q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> {\<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>..q - 1}

goal (1 subgoal):
 1. q - x \<le> q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
q - x \<le> q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
q - x \<le> q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil>

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> = - \<lceil>- q/(2*2^d)\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil> = - \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil>
[PROOF STEP]
using ceiling_int[of q "- q/(2*2^d)"]
[PROOF STATE]
proof (prove)
using this:
\<lceil>real_of_int q + real_of_int (- q) / (2 * 2 ^ d)\<rceil> = q + \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil>

goal (1 subgoal):
 1. q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil> = - \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil> = - \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil>

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
q - \<lceil>real_of_int q - real_of_int q / (2 * 2 ^ d)\<rceil> = - \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil>

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> = \<lfloor>q/(2*2^d)\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil> = \<lfloor>real_of_int q / (2 * 2 ^ d)\<rfloor>
[PROOF STEP]
by (simp add: ceiling_def)
[PROOF STATE]
proof (state)
this:
- \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil> = \<lfloor>real_of_int q / (2 * 2 ^ d)\<rfloor>

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- \<lceil>real_of_int (- q) / (2 * 2 ^ d)\<rceil> = \<lfloor>real_of_int q / (2 * 2 ^ d)\<rfloor>

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
have "\<dots> \<le> round (q/(2*2^d))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>real_of_int q / (2 * 2 ^ d)\<rfloor> \<le> round (real_of_int q / (2 * 2 ^ d))
[PROOF STEP]
using floor_le_round
[PROOF STATE]
proof (prove)
using this:
\<lfloor>?x\<rfloor> \<le> round ?x

goal (1 subgoal):
 1. \<lfloor>real_of_int q / (2 * 2 ^ d)\<rfloor> \<le> round (real_of_int q / (2 * 2 ^ d))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lfloor>real_of_int q / (2 * 2 ^ d)\<rfloor> \<le> round (real_of_int q / (2 * 2 ^ d))

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<bar>q - x\<bar> \<le> round (real_of_int q / (2 * 2 ^ d))
[PROOF STEP]
have "abs (q-x) \<le> round (q/(2^(d+1)))"
[PROOF STATE]
proof (prove)
using this:
\<bar>q - x\<bar> \<le> round (real_of_int q / (2 * 2 ^ d))

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / 2 ^ (d + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>q - x\<bar> \<le> round (real_of_int q / 2 ^ (d + 1))

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<bar>q - x\<bar> \<le> round (real_of_int q / 2 ^ (d + 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<bar>q - x\<bar> \<le> round (real_of_int q / 2 ^ (d + 1))

goal (1 subgoal):
 1. \<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))

goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
decompress d (compress d x) - x = - x
- x mod+- q = - x + q
\<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
decompress d (compress d x) - x = - x
- x mod+- q = - x + q
\<bar>q - x\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))

goal (1 subgoal):
 1. \<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<bar>(decompress d (compress d x) - x) mod+- q\<bar> \<le> round (real_of_int q / real_of_int (2 ^ (d + 1)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_acc_suffix[simp]: "is_acc (suffix i r) \<longleftrightarrow> is_acc r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_acc (suffix i r) = is_acc r
[PROOF STEP]
unfolding is_acc_def suffix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A\<in>F. \<exists>\<^sub>\<infinity>ia. r (i + ia) \<in> A) = (\<forall>A\<in>F. \<exists>\<^sub>\<infinity>i. r i \<in> A)
[PROOF STEP]
apply (clarsimp simp: INFM_nat)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>A\<in>F. \<forall>m. \<exists>ia>m. r (i + ia) \<in> A) = (\<forall>A\<in>F. \<forall>m. \<exists>i>m. r i \<in> A)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>A\<in>F. \<forall>m. \<exists>ia>m. r (i + ia) \<in> A \<Longrightarrow> \<forall>A\<in>F. \<forall>m. \<exists>i>m. r i \<in> A
 2. \<forall>A\<in>F. \<forall>m. \<exists>i>m. r i \<in> A \<Longrightarrow> \<forall>A\<in>F. \<forall>m. \<exists>ia>m. r (i + ia) \<in> A
[PROOF STEP]
apply (metis trans_less_add2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A\<in>F. \<forall>m. \<exists>i>m. r i \<in> A \<Longrightarrow> \<forall>A\<in>F. \<forall>m. \<exists>ia>m. r (i + ia) \<in> A
[PROOF STEP]
by (metis add_lessD1 less_imp_add_positive nat_add_left_cancel_less)


[STATEMENT]
lemma ainvf_l:"\<lbrakk>aGroup E; aGroup F; bijec\<^bsub>E,F\<^esub> f; x \<in> carrier E\<rbrakk> \<Longrightarrow>
                      (ainvf\<^bsub>E,F\<^esub> f) (f x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; bijec\<^bsub>E,F\<^esub> f; x \<in> carrier E\<rbrakk> \<Longrightarrow> (ainvf\<^bsub>E,F\<^esub> f) (f x) = x
[PROOF STEP]
apply (simp add:bijec_def, erule conjE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; x \<in> carrier E; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f\<rbrakk> \<Longrightarrow> (ainvf\<^bsub>E,F\<^esub> f) (f x) = x
[PROOF STEP]
apply (frule injec_inj_on[of "E" "F" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; x \<in> carrier E; injec\<^bsub>E,F\<^esub> f; surjec\<^bsub>E,F\<^esub> f; inj_on f (carrier E)\<rbrakk> \<Longrightarrow> (ainvf\<^bsub>E,F\<^esub> f) (f x) = x
[PROOF STEP]
apply (simp add:surjec_def aHom_def, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; x \<in> carrier E; injec\<^bsub>E,F\<^esub> f; inj_on f (carrier E); f \<in> carrier E \<rightarrow> carrier F; f \<in> extensional (carrier E); \<forall>a\<in>carrier E. \<forall>b\<in>carrier E. f (a \<plusminus>\<^bsub>E\<^esub> b) = f a \<plusminus>\<^bsub>F\<^esub> f b; surj_to f (carrier E) (carrier F)\<rbrakk> \<Longrightarrow> (ainvf\<^bsub>E,F\<^esub> f) (f x) = x
[PROOF STEP]
apply (frule invfun_l[of "f" "carrier E" "carrier F" "x"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup E; aGroup F; x \<in> carrier E; injec\<^bsub>E,F\<^esub> f; inj_on f (carrier E); f \<in> carrier E \<rightarrow> carrier F; f \<in> extensional (carrier E); \<forall>a\<in>carrier E. \<forall>b\<in>carrier E. f (a \<plusminus>\<^bsub>E\<^esub> b) = f a \<plusminus>\<^bsub>F\<^esub> f b; surj_to f (carrier E) (carrier F); (f\<inverse>\<^bsub>carrier F,carrier E\<^esub>) (f x) = x\<rbrakk> \<Longrightarrow> (ainvf\<^bsub>E,F\<^esub> f) (f x) = x
[PROOF STEP]
apply (simp add:ainvf_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma representation_sum:
  "independent basis \<Longrightarrow> (\<And>i. i \<in> I \<Longrightarrow> v i \<in> span basis) \<Longrightarrow>
    representation basis (sum v I) = (\<lambda>b. \<Sum>i\<in>I. representation basis (v i) b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>independent basis; \<And>i. i \<in> I \<Longrightarrow> v i \<in> span basis\<rbrakk> \<Longrightarrow> representation basis (sum v I) = (\<lambda>b. \<Sum>i\<in>I. representation basis (v i) b)
[PROOF STEP]
by (induction I rule: infinite_finite_induct)
     (auto simp: representation_zero representation_add span_sum)


[STATEMENT]
lemma facet_of_halfspace_le:
    "F facet_of {x. a \<bullet> x \<le> b} \<longleftrightarrow> a \<noteq> 0 \<and> F = {x. a \<bullet> x = b}"
    (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F facet_of {x. a \<bullet> x \<le> b}) = (a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b})
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. F facet_of {x. a \<bullet> x \<le> b} \<Longrightarrow> a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b}
 2. a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b} \<Longrightarrow> F facet_of {x. a \<bullet> x \<le> b}
[PROOF STEP]
assume c: ?lhs
[PROOF STATE]
proof (state)
this:
F facet_of {x. a \<bullet> x \<le> b}

goal (2 subgoals):
 1. F facet_of {x. a \<bullet> x \<le> b} \<Longrightarrow> a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b}
 2. a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b} \<Longrightarrow> F facet_of {x. a \<bullet> x \<le> b}
[PROOF STEP]
with c facet_of_irrefl
[PROOF STATE]
proof (chain)
picking this:
F facet_of {x. a \<bullet> x \<le> b}
\<not> ?S facet_of ?S
F facet_of {x. a \<bullet> x \<le> b}
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
F facet_of {x. a \<bullet> x \<le> b}
\<not> ?S facet_of ?S
F facet_of {x. a \<bullet> x \<le> b}

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b}
[PROOF STEP]
by (force simp: aff_dim_halfspace_le facet_of_def face_of_halfspace_le cong: conj_cong split: if_split_asm)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b}

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b} \<Longrightarrow> F facet_of {x. a \<bullet> x \<le> b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b} \<Longrightarrow> F facet_of {x. a \<bullet> x \<le> b}
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b}

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b} \<Longrightarrow> F facet_of {x. a \<bullet> x \<le> b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b}
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
a \<noteq> (0::'a) \<and> F = {x. a \<bullet> x = b}

goal (1 subgoal):
 1. F facet_of {x. a \<bullet> x \<le> b}
[PROOF STEP]
by (simp add: hyperplane_facet_of_halfspace_le)
[PROOF STATE]
proof (state)
this:
F facet_of {x. a \<bullet> x \<le> b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_imp_compactin:
   "\<lbrakk>S \<subseteq> topspace X; finite S\<rbrakk> \<Longrightarrow> compactin X S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> topspace X; finite S\<rbrakk> \<Longrightarrow> compactin X S
[PROOF STEP]
by (metis compactin_subspace compact_space finite_UnionD inf.absorb_iff2 order_refl topspace_subtopology)


[STATEMENT]
lemma walk_length_rev: "walk_length p = walk_length (rev p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. walk_length p = walk_length (rev p)
[PROOF STEP]
using walk_edges_rev walk_length_def
[PROOF STATE]
proof (prove)
using this:
rev (walk_edges ?xs) = walk_edges (rev ?xs)
walk_length ?p \<equiv> length (walk_edges ?p)

goal (1 subgoal):
 1. walk_length p = walk_length (rev p)
[PROOF STEP]
by (metis length_rev)


[STATEMENT]
lemma has_field_derivative_tanh [THEN DERIV_chain2, derivative_intros]:
  "cosh x \<noteq> 0 \<Longrightarrow> (tanh has_field_derivative 1 - tanh x ^ 2)
                     (at (x :: 'a :: {banach, real_normed_field}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x \<noteq> (0::'a) \<Longrightarrow> (tanh has_field_derivative (1::'a) - (tanh x)\<^sup>2) (at x)
[PROOF STEP]
unfolding tanh_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cosh x \<noteq> (0::'a) \<Longrightarrow> ((\<lambda>x. sinh x / cosh x) has_field_derivative (1::'a) - (sinh x / cosh x)\<^sup>2) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: power2_eq_square field_split_simps)


[STATEMENT]
lemma delete2_def2:
  "delete2 x (t,n,dl) =
  (let t' = del x t in
   case t' of
    None \<Rightarrow> (t,n,dl) |
    Some t' \<Rightarrow> (let n' = n-1; dl' = dl + 1
      in if bal_d n' dl' then (t',n',dl')
         else let t'' = bal_tree n' t' in (t'', n', 0)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.delete2 x (t, n, dl) = (let t' = del x t in case t' of None \<Rightarrow> (t, n, dl) | Some t' \<Rightarrow> let n' = n - 1; dl' = dl + 1 in if bal_d n' dl' then (t', n', dl') else let t'' = Root_Balanced_Tree.bal_tree n' t' in (t'', n', 0))
[PROOF STEP]
using val_cong[OF delete2_tm.simps(1)]
[PROOF STATE]
proof (prove)
using this:
Time_Monad.val (delete2_tm ?x1 (?t1, ?n1, ?dl1)) = Time_Monad.val (del_tm ?x1 ?t1 \<bind> case_option (return (?t1, ?n1, ?dl1)) (\<lambda>t'. let n' = ?n1 - 1; dl' = ?dl1 + 1 in if bal_d n' dl' then return (t', n', dl') else bal_tree_tm n' t' \<bind> (\<lambda>t''. return (t'', n', 0))) \<bind> tick)

goal (1 subgoal):
 1. local.delete2 x (t, n, dl) = (let t' = del x t in case t' of None \<Rightarrow> (t, n, dl) | Some t' \<Rightarrow> let n' = n - 1; dl' = dl + 1 in if bal_d n' dl' then (t', n', dl') else let t'' = Root_Balanced_Tree.bal_tree n' t' in (t'', n', 0))
[PROOF STEP]
by(simp only: delete2_def ins3_def del_def bal_tree_def val_simps option.case_distrib[of val])


[STATEMENT]
lemma set2list_correct:"\<lbrakk>finite A; A \<noteq> {}; set2list A = xs\<rbrakk> \<Longrightarrow> set xs = A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; A \<noteq> {}; set2list A = xs\<rbrakk> \<Longrightarrow> set xs = A
[PROOF STEP]
by (auto dest:set2list_prop simp:set2list_def)


[STATEMENT]
lemma set_diag_mat_smult:
  assumes "A\<in> carrier_mat n n"
  shows "set (diag_mat (x \<cdot>\<^sub>m A)) = {x * a |a. a\<in> set (diag_mat A)}" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (diag_mat (x \<cdot>\<^sub>m A)) = {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (diag_mat (x \<cdot>\<^sub>m A)) \<subseteq> {x * a |a. a \<in> set (diag_mat A)}
 2. {x * a |a. a \<in> set (diag_mat A)} \<subseteq> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
show "?L \<subseteq> ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (diag_mat (x \<cdot>\<^sub>m A)) \<subseteq> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
assume "b \<in> set (diag_mat (x \<cdot>\<^sub>m A))"
[PROOF STATE]
proof (state)
this:
b \<in> set (diag_mat (x \<cdot>\<^sub>m A))

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
hence "\<exists>i < length (diag_mat (x \<cdot>\<^sub>m A)). nth (diag_mat (x \<cdot>\<^sub>m A))  i = b"
[PROOF STATE]
proof (prove)
using this:
b \<in> set (diag_mat (x \<cdot>\<^sub>m A))

goal (1 subgoal):
 1. \<exists>i<length (diag_mat (x \<cdot>\<^sub>m A)). diag_mat (x \<cdot>\<^sub>m A) ! i = b
[PROOF STEP]
using in_set_conv_nth[of b]
[PROOF STATE]
proof (prove)
using this:
b \<in> set (diag_mat (x \<cdot>\<^sub>m A))
(b \<in> set ?xs) = (\<exists>i<length ?xs. ?xs ! i = b)

goal (1 subgoal):
 1. \<exists>i<length (diag_mat (x \<cdot>\<^sub>m A)). diag_mat (x \<cdot>\<^sub>m A) ! i = b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<exists>i<length (diag_mat (x \<cdot>\<^sub>m A)). diag_mat (x \<cdot>\<^sub>m A) ! i = b

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>i<length (diag_mat (x \<cdot>\<^sub>m A)). diag_mat (x \<cdot>\<^sub>m A) ! i = b
[PROOF STEP]
obtain i where "i < length (diag_mat (x \<cdot>\<^sub>m A))" and "nth (diag_mat (x \<cdot>\<^sub>m A))  i = b"
[PROOF STATE]
proof (prove)
using this:
\<exists>i<length (diag_mat (x \<cdot>\<^sub>m A)). diag_mat (x \<cdot>\<^sub>m A) ! i = b

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length (diag_mat (x \<cdot>\<^sub>m A)); diag_mat (x \<cdot>\<^sub>m A) ! i = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (diag_mat (x \<cdot>\<^sub>m A))
diag_mat (x \<cdot>\<^sub>m A) ! i = b

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
note iprop = this
[PROOF STATE]
proof (state)
this:
i < length (diag_mat (x \<cdot>\<^sub>m A))
diag_mat (x \<cdot>\<^sub>m A) ! i = b

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
hence "i < dim_row (x \<cdot>\<^sub>m A)"
[PROOF STATE]
proof (prove)
using this:
i < length (diag_mat (x \<cdot>\<^sub>m A))
diag_mat (x \<cdot>\<^sub>m A) ! i = b

goal (1 subgoal):
 1. i < dim_row (x \<cdot>\<^sub>m A)
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
i < length (map (\<lambda>i. (x \<cdot>\<^sub>m A) $$ (i, i)) [0..<dim_row (x \<cdot>\<^sub>m A)])
map (\<lambda>i. (x \<cdot>\<^sub>m A) $$ (i, i)) [0..<dim_row (x \<cdot>\<^sub>m A)] ! i = b

goal (1 subgoal):
 1. i < dim_row (x \<cdot>\<^sub>m A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < dim_row (x \<cdot>\<^sub>m A)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
hence "i < n"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (x \<cdot>\<^sub>m A)

goal (1 subgoal):
 1. i < n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row (x \<cdot>\<^sub>m A)
A \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
have "b = (x \<cdot>\<^sub>m A)$$(i,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = (x \<cdot>\<^sub>m A) $$ (i, i)
[PROOF STEP]
using iprop
[PROOF STATE]
proof (prove)
using this:
i < length (diag_mat (x \<cdot>\<^sub>m A))
diag_mat (x \<cdot>\<^sub>m A) ! i = b

goal (1 subgoal):
 1. b = (x \<cdot>\<^sub>m A) $$ (i, i)
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
i < length (map (\<lambda>i. (x \<cdot>\<^sub>m A) $$ (i, i)) [0..<dim_row (x \<cdot>\<^sub>m A)])
map (\<lambda>i. (x \<cdot>\<^sub>m A) $$ (i, i)) [0..<dim_row (x \<cdot>\<^sub>m A)] ! i = b

goal (1 subgoal):
 1. b = (x \<cdot>\<^sub>m A) $$ (i, i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b = (x \<cdot>\<^sub>m A) $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b = (x \<cdot>\<^sub>m A) $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
have "... = x * A$$(i,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot>\<^sub>m A) $$ (i, i) = x * A $$ (i, i)
[PROOF STEP]
using \<open>i < n\<close> assms
[PROOF STATE]
proof (prove)
using this:
i < n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. (x \<cdot>\<^sub>m A) $$ (i, i) = x * A $$ (i, i)
[PROOF STEP]
unfolding uminus_mat_def
[PROOF STATE]
proof (prove)
using this:
i < n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. (x \<cdot>\<^sub>m A) $$ (i, i) = x * A $$ (i, i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x \<cdot>\<^sub>m A) $$ (i, i) = x * A $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(x \<cdot>\<^sub>m A) $$ (i, i) = x * A $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
have "... \<in> ?R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * A $$ (i, i) \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
using iprop assms \<open>i < n\<close>
        in_set_conv_nth[of "A$$(i,i)"]
[PROOF STATE]
proof (prove)
using this:
i < length (diag_mat (x \<cdot>\<^sub>m A))
diag_mat (x \<cdot>\<^sub>m A) ! i = b
A \<in> carrier_mat n n
i < n
(A $$ (i, i) \<in> set ?xs) = (\<exists>ia<length ?xs. ?xs ! ia = A $$ (i, i))

goal (1 subgoal):
 1. x * A $$ (i, i) \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
by (metis (mono_tags, lifting) carrier_matD(1) diag_elems_mem diag_elems_set_diag_mat
          mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
x * A $$ (i, i) \<in> {x * a |a. a \<in> set (diag_mat A)}

goal (1 subgoal):
 1. \<And>xa. xa \<in> set (diag_mat (x \<cdot>\<^sub>m A)) \<Longrightarrow> xa \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
b \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
show "b \<in> ?R"
[PROOF STATE]
proof (prove)
using this:
b \<in> {x * a |a. a \<in> set (diag_mat A)}

goal (1 subgoal):
 1. b \<in> {x * a |a. a \<in> set (diag_mat A)}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
b \<in> {x * a |a. a \<in> set (diag_mat A)}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set (diag_mat (x \<cdot>\<^sub>m A)) \<subseteq> {x * a |a. a \<in> set (diag_mat A)}

goal (1 subgoal):
 1. {x * a |a. a \<in> set (diag_mat A)} \<subseteq> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {x * a |a. a \<in> set (diag_mat A)} \<subseteq> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
show "?R \<subseteq> ?L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x * a |a. a \<in> set (diag_mat A)} \<subseteq> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
assume "b\<in> ?R"
[PROOF STATE]
proof (state)
this:
b \<in> {x * a |a. a \<in> set (diag_mat A)}

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
hence "\<exists>i < length (diag_mat A). x * (nth (diag_mat A)  i) = b"
[PROOF STATE]
proof (prove)
using this:
b \<in> {x * a |a. a \<in> set (diag_mat A)}

goal (1 subgoal):
 1. \<exists>i<length (diag_mat A). x * diag_mat A ! i = b
[PROOF STEP]
using in_set_conv_nth[of x]
[PROOF STATE]
proof (prove)
using this:
b \<in> {x * a |a. a \<in> set (diag_mat A)}
(x \<in> set ?xs) = (\<exists>i<length ?xs. ?xs ! i = x)

goal (1 subgoal):
 1. \<exists>i<length (diag_mat A). x * diag_mat A ! i = b
[PROOF STEP]
by (smt (z3) in_set_conv_nth mem_Collect_eq)
[PROOF STATE]
proof (state)
this:
\<exists>i<length (diag_mat A). x * diag_mat A ! i = b

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>i<length (diag_mat A). x * diag_mat A ! i = b
[PROOF STEP]
obtain i where "i < length (diag_mat A)" and "x * (nth (diag_mat A)  i) = b"
[PROOF STATE]
proof (prove)
using this:
\<exists>i<length (diag_mat A). x * diag_mat A ! i = b

goal (1 subgoal):
 1. (\<And>i. \<lbrakk>i < length (diag_mat A); x * diag_mat A ! i = b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < length (diag_mat A)
x * diag_mat A ! i = b

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
note iprop = this
[PROOF STATE]
proof (state)
this:
i < length (diag_mat A)
x * diag_mat A ! i = b

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
hence "i < dim_row (x \<cdot>\<^sub>m A)"
[PROOF STATE]
proof (prove)
using this:
i < length (diag_mat A)
x * diag_mat A ! i = b

goal (1 subgoal):
 1. i < dim_row (x \<cdot>\<^sub>m A)
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
i < length (map (\<lambda>i. A $$ (i, i)) [0..<dim_row A])
x * map (\<lambda>i. A $$ (i, i)) [0..<dim_row A] ! i = b

goal (1 subgoal):
 1. i < dim_row (x \<cdot>\<^sub>m A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
i < dim_row (x \<cdot>\<^sub>m A)

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
hence "i < n"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (x \<cdot>\<^sub>m A)

goal (1 subgoal):
 1. i < n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row (x \<cdot>\<^sub>m A)
A \<in> carrier_mat n n

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

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
have "b = x *A$$(i,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b = x * A $$ (i, i)
[PROOF STEP]
using iprop
[PROOF STATE]
proof (prove)
using this:
i < length (diag_mat A)
x * diag_mat A ! i = b

goal (1 subgoal):
 1. b = x * A $$ (i, i)
[PROOF STEP]
unfolding diag_mat_def
[PROOF STATE]
proof (prove)
using this:
i < length (map (\<lambda>i. A $$ (i, i)) [0..<dim_row A])
x * map (\<lambda>i. A $$ (i, i)) [0..<dim_row A] ! i = b

goal (1 subgoal):
 1. b = x * A $$ (i, i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b = x * A $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b = x * A $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
have "... = (x \<cdot>\<^sub>m A)$$(i,i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * A $$ (i, i) = (x \<cdot>\<^sub>m A) $$ (i, i)
[PROOF STEP]
using \<open>i < n\<close> assms
[PROOF STATE]
proof (prove)
using this:
i < n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. x * A $$ (i, i) = (x \<cdot>\<^sub>m A) $$ (i, i)
[PROOF STEP]
unfolding uminus_mat_def
[PROOF STATE]
proof (prove)
using this:
i < n
A \<in> carrier_mat n n

goal (1 subgoal):
 1. x * A $$ (i, i) = (x \<cdot>\<^sub>m A) $$ (i, i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x * A $$ (i, i) = (x \<cdot>\<^sub>m A) $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * A $$ (i, i) = (x \<cdot>\<^sub>m A) $$ (i, i)

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
have "... \<in> ?L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot>\<^sub>m A) $$ (i, i) \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
using iprop assms \<open>i < n\<close>
        in_set_conv_nth[of "A$$(i,i)"]
[PROOF STATE]
proof (prove)
using this:
i < length (diag_mat A)
x * diag_mat A ! i = b
A \<in> carrier_mat n n
i < n
(A $$ (i, i) \<in> set ?xs) = (\<exists>ia<length ?xs. ?xs ! ia = A $$ (i, i))

goal (1 subgoal):
 1. (x \<cdot>\<^sub>m A) $$ (i, i) \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
by (metis \<open>i < dim_row (x \<cdot>\<^sub>m A)\<close> diag_elems_mem diag_elems_set_diag_mat)
[PROOF STATE]
proof (state)
this:
(x \<cdot>\<^sub>m A) $$ (i, i) \<in> set (diag_mat (x \<cdot>\<^sub>m A))

goal (1 subgoal):
 1. \<And>xa. xa \<in> {x * a |a. a \<in> set (diag_mat A)} \<Longrightarrow> xa \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
b \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
show "b \<in> ?L"
[PROOF STATE]
proof (prove)
using this:
b \<in> set (diag_mat (x \<cdot>\<^sub>m A))

goal (1 subgoal):
 1. b \<in> set (diag_mat (x \<cdot>\<^sub>m A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
b \<in> set (diag_mat (x \<cdot>\<^sub>m A))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
{x * a |a. a \<in> set (diag_mat A)} \<subseteq> set (diag_mat (x \<cdot>\<^sub>m A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma basis_row_space:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
shows "vec.independent (basis_row_space A)
  \<and> vec.span (basis_row_space A) = row_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (basis_row_space A) \<and> vec.span (basis_row_space A) = row_space A
[PROOF STEP]
proof (rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. vec.independent (basis_row_space A)
 2. vec.span (basis_row_space A) = row_space A
[PROOF STEP]
show "vec.independent (basis_row_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (basis_row_space A)
[PROOF STEP]
unfolding basis_row_space_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent {row i (Gauss_Jordan A) |i. row i (Gauss_Jordan A) \<noteq> 0}
[PROOF STEP]
using independent_not_zero_rows_rref[OF rref_Gauss_Jordan]
[PROOF STATE]
proof (prove)
using this:
vec.independent {row i (Gauss_Jordan ?A1) |i. row i (Gauss_Jordan ?A1) \<noteq> 0}

goal (1 subgoal):
 1. vec.independent {row i (Gauss_Jordan A) |i. row i (Gauss_Jordan A) \<noteq> 0}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec.independent (basis_row_space A)

goal (1 subgoal):
 1. vec.span (basis_row_space A) = row_space A
[PROOF STEP]
show "vec.span (basis_row_space A) = row_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.span (basis_row_space A) = row_space A
[PROOF STEP]
proof (rule vec.span_subspace)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. basis_row_space A \<subseteq> row_space A
 2. row_space A \<subseteq> vec.span (basis_row_space A)
 3. vec.subspace (row_space A)
[PROOF STEP]
show "basis_row_space A \<subseteq> row_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_row_space A \<subseteq> row_space A
[PROOF STEP]
by (rule basis_row_space_subset_row_space)
[PROOF STATE]
proof (state)
this:
basis_row_space A \<subseteq> row_space A

goal (2 subgoals):
 1. row_space A \<subseteq> vec.span (basis_row_space A)
 2. vec.subspace (row_space A)
[PROOF STEP]
show "row_space A \<subseteq> vec.span (basis_row_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_space A \<subseteq> vec.span (basis_row_space A)
[PROOF STEP]
by (rule row_space_subset_span_basis_row_space)
[PROOF STATE]
proof (state)
this:
row_space A \<subseteq> vec.span (basis_row_space A)

goal (1 subgoal):
 1. vec.subspace (row_space A)
[PROOF STEP]
show "vec.subspace (row_space A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.subspace (row_space A)
[PROOF STEP]
by (rule subspace_row_space)
[PROOF STATE]
proof (state)
this:
vec.subspace (row_space A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vec.span (basis_row_space A) = row_space A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_lim_sequentially:
  fixes l::complex
  shows "(f \<longlongrightarrow> l) sequentially \<Longrightarrow> (\<exists>N. \<forall>n\<ge>N. f n \<in> \<real>) \<Longrightarrow> l \<in> \<real>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<longlonglongrightarrow> l; \<exists>N. \<forall>n\<ge>N. f n \<in> \<real>\<rbrakk> \<Longrightarrow> l \<in> \<real>
[PROOF STEP]
by (rule real_lim [where F=sequentially]) (auto simp: eventually_sequentially)


[STATEMENT]
lemma "x + 3 \<ge> 4 \<or> x < (1::int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 \<le> x + 3 \<or> x < 1
[PROOF STEP]
by smt


[STATEMENT]
lemma of_nat64_n_less_equal_power_2:
 "n < 64 \<Longrightarrow> ((of_nat n)::64 word) < 2 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < 64 \<Longrightarrow> word_of_nat n < 2 ^ n
[PROOF STEP]
by (rule of_nat_n_less_equal_power_2, clarsimp simp: word_size)


[STATEMENT]
lemma quad_form_scale_v:
  shows "quad_form (k *\<^sub>s\<^sub>v v) H = cor ((cmod k)\<^sup>2) * quad_form v H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quad_form (k *\<^sub>s\<^sub>v v) H = cor ((cmod k)\<^sup>2) * quad_form v H
[PROOF STEP]
using bilinear_form_scale_v1 bilinear_form_scale_v2
[PROOF STATE]
proof (prove)
using this:
bilinear_form (?k *\<^sub>s\<^sub>v ?v1.0) ?v2.0 ?H = cnj ?k * bilinear_form ?v1.0 ?v2.0 ?H
bilinear_form ?v1.0 (?k *\<^sub>s\<^sub>v ?v2.0) ?H = ?k * bilinear_form ?v1.0 ?v2.0 ?H

goal (1 subgoal):
 1. quad_form (k *\<^sub>s\<^sub>v v) H = cor ((cmod k)\<^sup>2) * quad_form v H
[PROOF STEP]
by (simp add: complex_mult_cnj_cmod field_simps)


[STATEMENT]
lemma ennsqrt_4 [simp]:
  "ennsqrt 4 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennsqrt 4 = 2
[PROOF STEP]
by (metis ennreal_numeral ennsqrt_ennreal_ennreal_sqrt real_sqrt_four zero_le_numeral)


[STATEMENT]
lemma CDIM_positive [simp]: "0 < CDIM('a::ceuclidean_space)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < CDIM('a)
[PROOF STEP]
by (simp add: card_gt_0_iff)


[STATEMENT]
lemma rot_x_ivl:
  assumes "(0::real) \<le> x" "x \<le> 1"  "0 \<le> y" "y \<le> 1"
  shows "0 \<le> rot_x'' x y \<and> rot_x'' x y \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<and> x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 \<le> x_coord_inv ((2 * y - 1) * circle_y (x_coord x))
 2. x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1
[PROOF STEP]
have "\<And>a::real. 0 \<le> a \<and> a \<le> 1/2 \<Longrightarrow> 0 \<le> 1/2 + (2 * y - 1) * a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<and> a \<le> 1 / 2 \<Longrightarrow> 0 \<le> 1 / 2 + (2 * y - 1) * a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> 1
0 \<le> y
y \<le> 1

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<and> a \<le> 1 / 2 \<Longrightarrow> 0 \<le> 1 / 2 + (2 * y - 1) * a
[PROOF STEP]
by (sos "(((A<0 * R<1) + (((A<=4 * R<1) * (R<1/2 * [1]^2)) + (((A<=1 * (A<=5 * R<1)) * (R<1 * [1]^2)) + ((A<=0 * (A<=4 * R<1)) * (R<1 * [1]^2))))))")
[PROOF STATE]
proof (state)
this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 0 \<le> 1 / 2 + (2 * y - 1) * ?a

goal (2 subgoals):
 1. 0 \<le> x_coord_inv ((2 * y - 1) * circle_y (x_coord x))
 2. x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 0 \<le> 1 / 2 + (2 * y - 1) * ?a
[PROOF STEP]
show "0 \<le> rot_x'' x y"
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 0 \<le> 1 / 2 + (2 * y - 1) * ?a

goal (1 subgoal):
 1. 0 \<le> x_coord_inv ((2 * y - 1) * circle_y (x_coord x))
[PROOF STEP]
using assms circle_y_x_coord_bounds
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 0 \<le> 1 / 2 + (2 * y - 1) * ?a
0 \<le> x
x \<le> 1
0 \<le> y
y \<le> 1
\<lbrakk>0 \<le> ?x; ?x \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> circle_y (x_coord ?x) \<and> circle_y (x_coord ?x) \<le> 1 / 2

goal (1 subgoal):
 1. 0 \<le> x_coord_inv ((2 * y - 1) * circle_y (x_coord x))
[PROOF STEP]
by(auto simp add: x_coord_inv_def)
[PROOF STATE]
proof (state)
this:
0 \<le> x_coord_inv ((2 * y - 1) * circle_y (x_coord x))

goal (1 subgoal):
 1. x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1
[PROOF STEP]
have "\<And>a::real. 0 \<le> a \<and> a \<le> 1/2 \<Longrightarrow> 1/2 + (2 * y - 1) * a \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<and> a \<le> 1 / 2 \<Longrightarrow> 1 / 2 + (2 * y - 1) * a \<le> 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
x \<le> 1
0 \<le> y
y \<le> 1

goal (1 subgoal):
 1. \<And>a. 0 \<le> a \<and> a \<le> 1 / 2 \<Longrightarrow> 1 / 2 + (2 * y - 1) * a \<le> 1
[PROOF STEP]
by (sos "(((A<0 * R<1) + (((A<=5 * R<1) * (R<1/2 * [1]^2)) + (((A<=1 * (A<=4 * R<1)) * (R<1 * [1]^2)) + ((A<=0 * (A<=5 * R<1)) * (R<1 * [1]^2))))))")
[PROOF STATE]
proof (state)
this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 1 / 2 + (2 * y - 1) * ?a \<le> 1

goal (1 subgoal):
 1. x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 1 / 2 + (2 * y - 1) * ?a \<le> 1
[PROOF STEP]
show "rot_x'' x y \<le> 1"
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 1 / 2 + (2 * y - 1) * ?a \<le> 1

goal (1 subgoal):
 1. x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1
[PROOF STEP]
using assms circle_y_x_coord_bounds
[PROOF STATE]
proof (prove)
using this:
0 \<le> ?a \<and> ?a \<le> 1 / 2 \<Longrightarrow> 1 / 2 + (2 * y - 1) * ?a \<le> 1
0 \<le> x
x \<le> 1
0 \<le> y
y \<le> 1
\<lbrakk>0 \<le> ?x; ?x \<le> 1\<rbrakk> \<Longrightarrow> 0 \<le> circle_y (x_coord ?x) \<and> circle_y (x_coord ?x) \<le> 1 / 2

goal (1 subgoal):
 1. x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1
[PROOF STEP]
by (auto simp add: x_coord_inv_def)
[PROOF STATE]
proof (state)
this:
x_coord_inv ((2 * y - 1) * circle_y (x_coord x)) \<le> 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma length_Basis_list_pos[simp]: "length Basis_list > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < length Basis_list
[PROOF STEP]
by (metis length_pos_if_in_set Basis_list SOME_Basis)


[STATEMENT]
lemma (in subgroup) rcos_module:
  assumes "group G" "x \<in> carrier G" "x' \<in> carrier G"
  shows "(x' \<in> H #> x) = (x' \<otimes> inv x \<in> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x' \<in> H #> x) = (x' \<otimes> inv x \<in> H)
[PROOF STEP]
using rcos_module_rev rcos_module_imp assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Group.group G; ?x \<in> carrier G; ?x' \<in> carrier G; ?x' \<otimes> inv ?x \<in> H\<rbrakk> \<Longrightarrow> ?x' \<in> H #> ?x
\<lbrakk>Group.group G; ?x \<in> carrier G; ?x' \<in> H #> ?x\<rbrakk> \<Longrightarrow> ?x' \<otimes> inv ?x \<in> H
Group.group G
x \<in> carrier G
x' \<in> carrier G

goal (1 subgoal):
 1. (x' \<in> H #> x) = (x' \<otimes> inv x \<in> H)
[PROOF STEP]
by blast


[STATEMENT]
lemma closed_segment_subsetD:
  "0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> (X + x *\<^sub>R H) \<in> S"
  if "closed_segment X (X + H) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> X + x *\<^sub>R H \<in> S
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
closed_segment X (X + H) \<subseteq> S

goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> X + x *\<^sub>R H \<in> S
[PROOF STEP]
by (rule subsetD) (auto simp: closed_segment_def algebra_simps intro!: exI[where x=x])


[STATEMENT]
lemma sum_list_Suc:
  "sum_list (map (\<lambda>x. Suc(f x)) xs) = sum_list (map f xs) + length xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>xs. Suc (f x)) = sum_list (map f xs) + length xs
[PROOF STEP]
by(induction xs; simp)


[STATEMENT]
lemma length_eq_card_columns:
  fixes A::"'a^'columns::{mod_type}^'rows::{mod_type}"
  shows "IArray.length (matrix_to_iarray A !! 0) = CARD ('columns)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.length (matrix_to_iarray A !! 0) = CARD('columns)
[PROOF STEP]
unfolding matrix_to_iarray_def o_def vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.length (IArray (map (\<lambda>x. IArray.of_fun (\<lambda>i. A $ mod_type_class.from_nat x $ mod_type_class.from_nat i) CARD('columns)) [0..<CARD('rows)]) !! 0) = CARD('columns)
[PROOF STEP]
by simp


[STATEMENT]
lemma vector_derivative_at_within_ivl:
  "(f has_vector_derivative f') (at x) \<Longrightarrow>
    a \<le> x \<Longrightarrow> x \<le> b \<Longrightarrow> a<b \<Longrightarrow> vector_derivative f (at x within {a..b}) = f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_vector_derivative f') (at x); a \<le> x; x \<le> b; a < b\<rbrakk> \<Longrightarrow> vector_derivative f (at x within {a..b}) = f'
[PROOF STEP]
using has_vector_derivative_at_within vector_derivative_within_cbox
[PROOF STATE]
proof (prove)
using this:
(?f has_vector_derivative ?f') (at ?x) \<Longrightarrow> (?f has_vector_derivative ?f') (at ?x within ?S)
\<lbrakk>?a < ?b; ?x \<in> cbox ?a ?b; (?f has_vector_derivative ?f') (at ?x within cbox ?a ?b)\<rbrakk> \<Longrightarrow> vector_derivative ?f (at ?x within cbox ?a ?b) = ?f'

goal (1 subgoal):
 1. \<lbrakk>(f has_vector_derivative f') (at x); a \<le> x; x \<le> b; a < b\<rbrakk> \<Longrightarrow> vector_derivative f (at x within {a..b}) = f'
[PROOF STEP]
by fastforce


[STATEMENT]
lemma last_t_fusion [simp]: "last x = first y \<Longrightarrow> last (t_fusion x y) = last y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Dioid_Models.last x = first y \<Longrightarrow> Dioid_Models.last (t_fusion x y) = Dioid_Models.last y
[PROOF STEP]
by (simp add: first_def t_fusion_def)


[STATEMENT]
lemma insert_lemma: "x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
assume A: "x \<notin> nat_to_set u"
[PROOF STATE]
proof (state)
this:
x \<notin> nat_to_set u

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
define D where "D = nat_to_set u"
[PROOF STATE]
proof (state)
this:
D = nat_to_set u

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
from A D_def
[PROOF STATE]
proof (chain)
picking this:
x \<notin> nat_to_set u
D = nat_to_set u
[PROOF STEP]
have S1: "x \<notin> D"
[PROOF STATE]
proof (prove)
using this:
x \<notin> nat_to_set u
D = nat_to_set u

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

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
have "finite (nat_to_set u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (nat_to_set u)
[PROOF STEP]
by (rule nat_to_set_is_finite)
[PROOF STATE]
proof (state)
this:
finite (nat_to_set u)

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
with D_def
[PROOF STATE]
proof (chain)
picking this:
D = nat_to_set u
finite (nat_to_set u)
[PROOF STEP]
have D_finite: "finite D"
[PROOF STATE]
proof (prove)
using this:
D = nat_to_set u
finite (nat_to_set u)

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

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
let ?f = "\<lambda> (x::nat). (2::nat)^x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
from set_to_nat_def
[PROOF STATE]
proof (chain)
picking this:
set_to_nat = sum ((^) 2)
[PROOF STEP]
have "set_to_nat (D \<union> {x}) = sum ?f (D \<union> {x})"
[PROOF STATE]
proof (prove)
using this:
set_to_nat = sum ((^) 2)

goal (1 subgoal):
 1. set_to_nat (D \<union> {x}) = sum ((^) 2) (D \<union> {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_to_nat (D \<union> {x}) = sum ((^) 2) (D \<union> {x})

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_to_nat (D \<union> {x}) = sum ((^) 2) (D \<union> {x})

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
from D_finite S1
[PROOF STATE]
proof (chain)
picking this:
finite D
x \<notin> D
[PROOF STEP]
have "\<dots> = ?f x + sum ?f D"
[PROOF STATE]
proof (prove)
using this:
finite D
x \<notin> D

goal (1 subgoal):
 1. sum ((^) 2) (D \<union> {x}) = 2 ^ x + sum ((^) 2) D
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum ((^) 2) (D \<union> {x}) = 2 ^ x + sum ((^) 2) D

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum ((^) 2) (D \<union> {x}) = 2 ^ x + sum ((^) 2) D

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
from set_to_nat_def
[PROOF STATE]
proof (chain)
picking this:
set_to_nat = sum ((^) 2)
[PROOF STEP]
have "\<dots> = 2 ^ x + set_to_nat D"
[PROOF STATE]
proof (prove)
using this:
set_to_nat = sum ((^) 2)

goal (1 subgoal):
 1. 2 ^ x + sum ((^) 2) D = 2 ^ x + set_to_nat D
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
2 ^ x + sum ((^) 2) D = 2 ^ x + set_to_nat D

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
set_to_nat (D \<union> {x}) = 2 ^ x + set_to_nat D
[PROOF STEP]
have "set_to_nat (D \<union> {x}) = set_to_nat D + 2 ^ x"
[PROOF STATE]
proof (prove)
using this:
set_to_nat (D \<union> {x}) = 2 ^ x + set_to_nat D

goal (1 subgoal):
 1. set_to_nat (D \<union> {x}) = set_to_nat D + 2 ^ x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_to_nat (D \<union> {x}) = set_to_nat D + 2 ^ x

goal (1 subgoal):
 1. x \<notin> nat_to_set u \<Longrightarrow> set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
with D_def
[PROOF STATE]
proof (chain)
picking this:
D = nat_to_set u
set_to_nat (D \<union> {x}) = set_to_nat D + 2 ^ x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
D = nat_to_set u
set_to_nat (D \<union> {x}) = set_to_nat D + 2 ^ x

goal (1 subgoal):
 1. set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_to_nat (nat_to_set u \<union> {x}) = u + 2 ^ x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem join_connection: "(x \<sqsubseteq> y) = (x \<squnion> y = y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<sqsubseteq> y) = (x \<squnion> y = y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<sqsubseteq> y \<Longrightarrow> x \<squnion> y = y
 2. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
assume "x \<sqsubseteq> y"
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> y

goal (2 subgoals):
 1. x \<sqsubseteq> y \<Longrightarrow> x \<squnion> y = y
 2. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<sqsubseteq> y
[PROOF STEP]
have "is_sup x y y"
[PROOF STATE]
proof (prove)
using this:
x \<sqsubseteq> y

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

goal (2 subgoals):
 1. x \<sqsubseteq> y \<Longrightarrow> x \<squnion> y = y
 2. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
is_sup x y y
[PROOF STEP]
show "x \<squnion> y = y"
[PROOF STATE]
proof (prove)
using this:
is_sup x y y

goal (1 subgoal):
 1. x \<squnion> y = y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<squnion> y = y

goal (1 subgoal):
 1. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
have "x \<sqsubseteq> x \<squnion> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqsubseteq> x \<squnion> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> x \<squnion> y

goal (1 subgoal):
 1. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x \<sqsubseteq> x \<squnion> y

goal (1 subgoal):
 1. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
assume "x \<squnion> y = y"
[PROOF STATE]
proof (state)
this:
x \<squnion> y = y

goal (1 subgoal):
 1. x \<squnion> y = y \<Longrightarrow> x \<sqsubseteq> y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x \<sqsubseteq> y
[PROOF STEP]
show "x \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
using this:
x \<sqsubseteq> y

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma msb_word_of_int:
  "msb (word_of_int x::'a::len word) = bit x (LENGTH('a) - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. msb (word_of_int x) = bit x (LENGTH('a) - 1)
[PROOF STEP]
by (simp add: msb_word_iff_bit bit_simps)


[STATEMENT]
lemma ir_While_backwards:
  "(\<And>n. ir_hoare (\<lambda> s s'. P n s s' \<and> bval b s) c SKIP (P (Suc n))) \<Longrightarrow>
                       ir_hoare (\<lambda>s s'. \<exists>n. P n s s' \<and> \<not> bval b s) SKIP c' Q \<Longrightarrow>
                       ir_hoare (P 0) (WHILE b DO c) c' Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. ir_hoare (\<lambda>s s'. P n s s' \<and> bval b s) c SKIP (P (Suc n)); ir_hoare (\<lambda>s s'. \<exists>n. P n s s' \<and> \<not> bval b s) SKIP c' Q\<rbrakk> \<Longrightarrow> ir_hoare (P 0) (WHILE b DO c) c' Q
[PROOF STEP]
apply(rule ir_While_backwards_frontier)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>\<And>n. ir_hoare (\<lambda>s s'. P n s s' \<and> bval b s) c SKIP (P (Suc n)); ir_hoare (\<lambda>s s'. \<exists>n. P n s s' \<and> \<not> bval b s) SKIP c' Q\<rbrakk> \<Longrightarrow> ir_hoare (\<lambda>s s'. P n s s' \<and> bval b s) c SKIP (P (Suc n))
 2. \<lbrakk>\<And>n. ir_hoare (\<lambda>s s'. P n s s' \<and> bval b s) c SKIP (P (Suc n)); ir_hoare (\<lambda>s s'. \<exists>n. P n s s' \<and> \<not> bval b s) SKIP c' Q\<rbrakk> \<Longrightarrow> ir_hoare (\<lambda>s s'. \<exists>n. P n s s') (WHILE b DO c) c' Q
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. ir_hoare (\<lambda>s s'. P n s s' \<and> bval b s) c SKIP (P (Suc n)); ir_hoare (\<lambda>s s'. \<exists>n. P n s s' \<and> \<not> bval b s) SKIP c' Q\<rbrakk> \<Longrightarrow> ir_hoare (\<lambda>s s'. \<exists>n. P n s s') (WHILE b DO c) c' Q
[PROOF STEP]
apply(rule ir_While_False)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. ir_hoare (\<lambda>s s'. P n s s' \<and> bval b s) c SKIP (P (Suc n)); ir_hoare (\<lambda>s s'. \<exists>n. P n s s' \<and> \<not> bval b s) SKIP c' Q\<rbrakk> \<Longrightarrow> ir_hoare (\<lambda>s s'. (\<exists>n. P n s s') \<and> \<not> bval b s) SKIP c' Q
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma complex_of_real_strict_mono_iff[simp]:
  "complex_of_real x < complex_of_real y \<longleftrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (complex_of_real x < complex_of_real y) = (x < y)
[PROOF STEP]
unfolding less_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Re (complex_of_real x) < Re (complex_of_real y) \<and> Im (complex_of_real x) = Im (complex_of_real y)) = (x < y)
[PROOF STEP]
by auto


[STATEMENT]
lemma nth_akiyama_tanigawa_step_aux:
  "n < length xs - 1 \<Longrightarrow>
     akiyama_tanigawa_step_aux m xs ! n = real (m + n) * (xs ! n - xs ! Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < length xs - 1 \<Longrightarrow> akiyama_tanigawa_step_aux m xs ! n = real (m + n) * (xs ! n - xs ! Suc n)
[PROOF STEP]
proof (induction m xs arbitrary: n rule: akiyama_tanigawa_step_aux.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>m x y xs n. \<lbrakk>\<And>n. n < length (y # xs) - 1 \<Longrightarrow> akiyama_tanigawa_step_aux (Suc m) (y # xs) ! n = real (Suc m + n) * ((y # xs) ! n - (y # xs) ! Suc n); n < length (x # y # xs) - 1\<rbrakk> \<Longrightarrow> akiyama_tanigawa_step_aux m (x # y # xs) ! n = real (m + n) * ((x # y # xs) ! n - (x # y # xs) ! Suc n)
 2. \<And>m n. n < length [] - 1 \<Longrightarrow> akiyama_tanigawa_step_aux m [] ! n = real (m + n) * ([] ! n - [] ! Suc n)
 3. \<And>m v n. n < length [v] - 1 \<Longrightarrow> akiyama_tanigawa_step_aux m [v] ! n = real (m + n) * ([v] ! n - [v] ! Suc n)
[PROOF STEP]
case (1 m x y xs n)
[PROOF STATE]
proof (state)
this:
?n < length (y # xs) - 1 \<Longrightarrow> akiyama_tanigawa_step_aux (Suc m) (y # xs) ! ?n = real (Suc m + ?n) * ((y # xs) ! ?n - (y # xs) ! Suc ?n)
n < length (x # y # xs) - 1

goal (3 subgoals):
 1. \<And>m x y xs n. \<lbrakk>\<And>n. n < length (y # xs) - 1 \<Longrightarrow> akiyama_tanigawa_step_aux (Suc m) (y # xs) ! n = real (Suc m + n) * ((y # xs) ! n - (y # xs) ! Suc n); n < length (x # y # xs) - 1\<rbrakk> \<Longrightarrow> akiyama_tanigawa_step_aux m (x # y # xs) ! n = real (m + n) * ((x # y # xs) ! n - (x # y # xs) ! Suc n)
 2. \<And>m n. n < length [] - 1 \<Longrightarrow> akiyama_tanigawa_step_aux m [] ! n = real (m + n) * ([] ! n - [] ! Suc n)
 3. \<And>m v n. n < length [v] - 1 \<Longrightarrow> akiyama_tanigawa_step_aux m [v] ! n = real (m + n) * ([v] ! n - [v] ! Suc n)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
?n < length (y # xs) - 1 \<Longrightarrow> akiyama_tanigawa_step_aux (Suc m) (y # xs) ! ?n = real (Suc m + ?n) * ((y # xs) ! ?n - (y # xs) ! Suc ?n)
n < length (x # y # xs) - 1

goal (1 subgoal):
 1. akiyama_tanigawa_step_aux m (x # y # xs) ! n = real (m + n) * ((x # y # xs) ! n - (x # y # xs) ! Suc n)
[PROOF STEP]
by (cases n) auto
[PROOF STATE]
proof (state)
this:
akiyama_tanigawa_step_aux m (x # y # xs) ! n = real (m + n) * ((x # y # xs) ! n - (x # y # xs) ! Suc n)

goal (2 subgoals):
 1. \<And>m n. n < length [] - 1 \<Longrightarrow> akiyama_tanigawa_step_aux m [] ! n = real (m + n) * ([] ! n - [] ! Suc n)
 2. \<And>m v n. n < length [v] - 1 \<Longrightarrow> akiyama_tanigawa_step_aux m [v] ! n = real (m + n) * ([v] ! n - [v] ! Suc n)
[PROOF STEP]
qed auto


[STATEMENT]
lemma fin_ex_inf_eq_limit: "finite A \<Longrightarrow> (\<exists>\<^sub>\<infinity>i. w i \<in> A) \<longleftrightarrow> limit w \<inter> A \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> (\<exists>\<^sub>\<infinity>i. w i \<in> A) = (limit w \<inter> A \<noteq> {})
[PROOF STEP]
by (metis INF_limit_inter equals0D finite_Int limit_inter_INF)