[STATEMENT]
lemma ysq_dom_y_plus_coeff_2:
  fixes b:: "real"
  fixes c:: "real"
  shows "\<exists>(w::real). \<forall>(y::real). (y > w \<longrightarrow> y^2 > b*y + c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
have "\<exists>(w::real). \<forall>(y::real). (y < w \<longrightarrow> y^2 > -b*y + c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>w. \<forall>y<w. - b * y + c < y\<^sup>2
[PROOF STEP]
using ysq_dom_y_plus_coeff[where b = "-b", where c = "c"]
[PROOF STATE]
proof (prove)
using this:
\<exists>w. \<forall>y<w. - b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<exists>w. \<forall>y<w. - b * y + c < y\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>w. \<forall>y<w. - b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>w. \<forall>y<w. - b * y + c < y\<^sup>2
[PROOF STEP]
obtain w where w_prop: "\<forall>(y::real). (y < w \<longrightarrow> y^2 > -b*y + c)"
[PROOF STATE]
proof (prove)
using this:
\<exists>w. \<forall>y<w. - b * y + c < y\<^sup>2

goal (1 subgoal):
 1. (\<And>w. \<forall>y<w. - b * y + c < y\<^sup>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y<w. - b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
let ?mn = "min w (-1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
have "\<forall>(y::real). (y < ?mn \<longrightarrow> y^2 > -b*y + c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y<min w (- 1). - b * y + c < y\<^sup>2
[PROOF STEP]
using w_prop
[PROOF STATE]
proof (prove)
using this:
\<forall>y<w. - b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<forall>y<min w (- 1). - b * y + c < y\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y<min w (- 1). - b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>y<min w (- 1). - b * y + c < y\<^sup>2
[PROOF STEP]
have "\<forall>(y::real). (y > (-1*?mn) \<longrightarrow> y^2 > b*y + c)"
[PROOF STATE]
proof (prove)
using this:
\<forall>y<min w (- 1). - b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<forall>y>- 1 * min w (- 1). b * y + c < y\<^sup>2
[PROOF STEP]
by (metis (no_types, opaque_lifting) minus_less_iff minus_mult_commute mult_1 power2_eq_iff)
[PROOF STATE]
proof (state)
this:
\<forall>y>- 1 * min w (- 1). b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>y>- 1 * min w (- 1). b * y + c < y\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>y>- 1 * min w (- 1). b * y + c < y\<^sup>2

goal (1 subgoal):
 1. \<exists>w. \<forall>y>w. b * y + c < y\<^sup>2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>w. \<forall>y>w. b * y + c < y\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rev_bl_order_rev_simp:
  "length xs = length ys \<Longrightarrow>
   rev_bl_order F (xs @ [x]) (ys @ [y]) = ((y \<and> \<not> x) \<or> ((y \<or> \<not> x) \<and> rev_bl_order F xs ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys \<Longrightarrow> rev_bl_order F (xs @ [x]) (ys @ [y]) = (y \<and> \<not> x \<or> (y \<or> \<not> x) \<and> rev_bl_order F xs ys)
[PROOF STEP]
by (induct arbitrary: F rule: list_induct2) (auto simp: rev_bl_order_simps)


[STATEMENT]
lemma from_univ_poly_add:
  assumes "i \<le> n"
  assumes "p \<in> carrier (UP (R[\<X>\<^bsub>n\<^esub>])) "
  assumes "Q \<in> carrier (UP (R[\<X>\<^bsub>n\<^esub>])) "
  shows "from_univ_poly (Suc n) i (p \<oplus>\<^bsub>UP (R[\<X>\<^bsub>n\<^esub>])\<^esub>Q) =
        from_univ_poly (Suc n) i p \<oplus>\<^bsub>R[\<X>\<^bsub>Suc n\<^esub>]\<^esub> from_univ_poly (Suc n) i Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_univ_poly (Suc n) i (p \<oplus>\<^bsub>UP (R [\<X>\<^bsub>n\<^esub>])\<^esub> Q) = from_univ_poly (Suc n) i p \<oplus>\<^bsub>R [\<X>\<^bsub>Suc n\<^esub>]\<^esub> from_univ_poly (Suc n) i Q
[PROOF STEP]
using from_univ_poly_is_hom ring_hom_add
[PROOF STATE]
proof (prove)
using this:
?i \<le> ?n \<Longrightarrow> from_univ_poly (Suc ?n) ?i \<in> ring_hom (UP (R [\<X>\<^bsub>?n\<^esub>])) (R [\<X>\<^bsub>Suc ?n\<^esub>])
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<oplus>\<^bsub>?R\<^esub> ?y) = ?h ?x \<oplus>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. from_univ_poly (Suc n) i (p \<oplus>\<^bsub>UP (R [\<X>\<^bsub>n\<^esub>])\<^esub> Q) = from_univ_poly (Suc n) i p \<oplus>\<^bsub>R [\<X>\<^bsub>Suc n\<^esub>]\<^esub> from_univ_poly (Suc n) i Q
[PROOF STEP]
by (metis assms(1) assms(2) assms(3))


[STATEMENT]
lemma list_set_cart_autoref[autoref_rules]:
    fixes Rx :: "('xi \<times> 'x) set"
    fixes Ry :: "('yi \<times> 'y) set"
    shows "(\<lambda>xl yl. [ (x,y). x\<leftarrow>xl, y\<leftarrow>yl], op_set_cart)
    \<in> \<langle>Rx\<rangle>list_set_rel \<rightarrow> \<langle>Ry\<rangle>list_set_rel \<rightarrow> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>xl yl. concat (map (\<lambda>x. map (Pair x) yl) xl), op_set_cart) \<in> \<langle>Rx\<rangle>list_set_rel \<rightarrow> \<langle>Ry\<rangle>list_set_rel \<rightarrow> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
proof (intro fun_relI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a a' aa a'a. \<lbrakk>(a, a') \<in> \<langle>Rx\<rangle>list_set_rel; (aa, a'a) \<in> \<langle>Ry\<rangle>list_set_rel\<rbrakk> \<Longrightarrow> (concat (map (\<lambda>x. map (Pair x) aa) a), op_set_cart a' a'a) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
fix xl xs yl ys
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a a' aa a'a. \<lbrakk>(a, a') \<in> \<langle>Rx\<rangle>list_set_rel; (aa, a'a) \<in> \<langle>Ry\<rangle>list_set_rel\<rbrakk> \<Longrightarrow> (concat (map (\<lambda>x. map (Pair x) aa) a), op_set_cart a' a'a) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
assume "(xl, xs) \<in> \<langle>Rx\<rangle>list_set_rel" "(yl, ys) \<in> \<langle>Ry\<rangle>list_set_rel"
[PROOF STATE]
proof (state)
this:
(xl, xs) \<in> \<langle>Rx\<rangle>list_set_rel
(yl, ys) \<in> \<langle>Ry\<rangle>list_set_rel

goal (1 subgoal):
 1. \<And>a a' aa a'a. \<lbrakk>(a, a') \<in> \<langle>Rx\<rangle>list_set_rel; (aa, a'a) \<in> \<langle>Ry\<rangle>list_set_rel\<rbrakk> \<Longrightarrow> (concat (map (\<lambda>x. map (Pair x) aa) a), op_set_cart a' a'a) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(xl, xs) \<in> \<langle>Rx\<rangle>list_set_rel
(yl, ys) \<in> \<langle>Ry\<rangle>list_set_rel
[PROOF STEP]
obtain xl' :: "'x list" and yl' :: "'y list" where
      [param]: "(xl,xl')\<in>\<langle>Rx\<rangle>list_rel" "(yl,yl')\<in>\<langle>Ry\<rangle>list_rel"
      and XLS: "(xl',xs)\<in>br set distinct" and YLS: "(yl',ys)\<in>br set distinct"
[PROOF STATE]
proof (prove)
using this:
(xl, xs) \<in> \<langle>Rx\<rangle>list_set_rel
(yl, ys) \<in> \<langle>Ry\<rangle>list_set_rel

goal (1 subgoal):
 1. (\<And>xl' yl'. \<lbrakk>(xl, xl') \<in> \<langle>Rx\<rangle>list_rel; (yl, yl') \<in> \<langle>Ry\<rangle>list_rel; (xl', xs) \<in> br set distinct; (yl', ys) \<in> br set distinct\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding list_set_rel_def
[PROOF STATE]
proof (prove)
using this:
(xl, xs) \<in> \<langle>Rx\<rangle>list_rel O br set distinct
(yl, ys) \<in> \<langle>Ry\<rangle>list_rel O br set distinct

goal (1 subgoal):
 1. (\<And>xl' yl'. \<lbrakk>(xl, xl') \<in> \<langle>Rx\<rangle>list_rel; (yl, yl') \<in> \<langle>Ry\<rangle>list_rel; (xl', xs) \<in> br set distinct; (yl', ys) \<in> br set distinct\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(xl, xl') \<in> \<langle>Rx\<rangle>list_rel
(yl, yl') \<in> \<langle>Ry\<rangle>list_rel
(xl', xs) \<in> br set distinct
(yl', ys) \<in> br set distinct

goal (1 subgoal):
 1. \<And>a a' aa a'a. \<lbrakk>(a, a') \<in> \<langle>Rx\<rangle>list_set_rel; (aa, a'a) \<in> \<langle>Ry\<rangle>list_set_rel\<rbrakk> \<Longrightarrow> (concat (map (\<lambda>x. map (Pair x) aa) a), op_set_cart a' a'a) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
have "([ (x,y). x\<leftarrow>xl, y\<leftarrow>yl ], [ (x,y). x\<leftarrow>xl', y\<leftarrow>yl' ])
      \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (concat (map (\<lambda>x. map (Pair x) yl) xl), concat (map (\<lambda>x. map (Pair x) yl') xl')) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel
[PROOF STEP]
by parametricity
[PROOF STATE]
proof (state)
this:
(concat (map (\<lambda>x. map (Pair x) yl) xl), concat (map (\<lambda>x. map (Pair x) yl') xl')) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel

goal (1 subgoal):
 1. \<And>a a' aa a'a. \<lbrakk>(a, a') \<in> \<langle>Rx\<rangle>list_set_rel; (aa, a'a) \<in> \<langle>Ry\<rangle>list_set_rel\<rbrakk> \<Longrightarrow> (concat (map (\<lambda>x. map (Pair x) aa) a), op_set_cart a' a'a) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(concat (map (\<lambda>x. map (Pair x) yl) xl), concat (map (\<lambda>x. map (Pair x) yl') xl')) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel

goal (1 subgoal):
 1. \<And>a a' aa a'a. \<lbrakk>(a, a') \<in> \<langle>Rx\<rangle>list_set_rel; (aa, a'a) \<in> \<langle>Ry\<rangle>list_set_rel\<rbrakk> \<Longrightarrow> (concat (map (\<lambda>x. map (Pair x) aa) a), op_set_cart a' a'a) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
have "([ (x,y). x\<leftarrow>xl', y\<leftarrow>yl' ], xs \<times> ys) \<in> br set distinct"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (concat (map (\<lambda>x. map (Pair x) yl') xl'), xs \<times> ys) \<in> br set distinct
[PROOF STEP]
using XLS YLS
[PROOF STATE]
proof (prove)
using this:
(xl', xs) \<in> br set distinct
(yl', ys) \<in> br set distinct

goal (1 subgoal):
 1. (concat (map (\<lambda>x. map (Pair x) yl') xl'), xs \<times> ys) \<in> br set distinct
[PROOF STEP]
apply (auto simp: br_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>xs = set xl'; distinct xl'; ys = set yl'; distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') xl'))
[PROOF STEP]
apply hypsubst_thin
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct xl'; distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') xl'))
[PROOF STEP]
apply (induction xl')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>distinct []; distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') []))
 2. \<And>a xl'. \<lbrakk>\<lbrakk>distinct xl'; distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') xl')); distinct (a # xl'); distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') (a # xl')))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a xl'. \<lbrakk>\<lbrakk>distinct xl'; distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') xl')); distinct (a # xl'); distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') (a # xl')))
[PROOF STEP]
apply (induction yl')
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a xl'. \<lbrakk>\<lbrakk>distinct xl'; distinct []\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) []) xl')); distinct (a # xl'); distinct []\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) []) (a # xl')))
 2. \<And>a yl' aa xl'. \<lbrakk>\<And>a xl'. \<lbrakk>\<lbrakk>distinct xl'; distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') xl')); distinct (a # xl'); distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') (a # xl'))); \<lbrakk>distinct xl'; distinct (a # yl')\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) (a # yl')) xl')); distinct (aa # xl'); distinct (a # yl')\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) (a # yl')) (aa # xl')))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a yl' aa xl'. \<lbrakk>\<And>a xl'. \<lbrakk>\<lbrakk>distinct xl'; distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') xl')); distinct (a # xl'); distinct yl'\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) yl') (a # xl'))); \<lbrakk>distinct xl'; distinct (a # yl')\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) (a # yl')) xl')); distinct (aa # xl'); distinct (a # yl')\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (Pair x) (a # yl')) (aa # xl')))
[PROOF STEP]
apply auto []
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a yl' aa xl'. \<lbrakk>\<And>a xl'. \<lbrakk>distinct (concat (map (\<lambda>x. map (Pair x) yl') xl')); a \<notin> set xl' \<and> distinct xl'\<rbrakk> \<Longrightarrow> distinct (map (Pair a) yl') \<and> Pair a ` set yl' \<inter> (\<Union>x\<in>set xl'. Pair x ` set yl') = {}; distinct (concat (map (\<lambda>x. (x, a) # map (Pair x) yl') xl')); aa \<notin> set xl'; distinct xl'; a \<notin> set yl'; distinct yl'\<rbrakk> \<Longrightarrow> distinct (map (Pair aa) yl')
[PROOF STEP]
apply (metis (lifting) concat_map_maps distinct.simps(2)
        distinct_singleton maps_simps(2))
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(concat (map (\<lambda>x. map (Pair x) yl') xl'), xs \<times> ys) \<in> br set distinct

goal (1 subgoal):
 1. \<And>a a' aa a'a. \<lbrakk>(a, a') \<in> \<langle>Rx\<rangle>list_set_rel; (aa, a'a) \<in> \<langle>Ry\<rangle>list_set_rel\<rbrakk> \<Longrightarrow> (concat (map (\<lambda>x. map (Pair x) aa) a), op_set_cart a' a'a) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
finally (relcompI)
[PROOF STATE]
proof (chain)
picking this:
(concat (map (\<lambda>x. map (Pair x) yl) xl), xs \<times> ys) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel O br set distinct
[PROOF STEP]
show "([ (x,y). x\<leftarrow>xl, y\<leftarrow>yl ], op_set_cart xs ys) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel"
[PROOF STATE]
proof (prove)
using this:
(concat (map (\<lambda>x. map (Pair x) yl) xl), xs \<times> ys) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel O br set distinct

goal (1 subgoal):
 1. (concat (map (\<lambda>x. map (Pair x) yl) xl), op_set_cart xs ys) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel
[PROOF STEP]
unfolding list_set_rel_def
[PROOF STATE]
proof (prove)
using this:
(concat (map (\<lambda>x. map (Pair x) yl) xl), xs \<times> ys) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel O br set distinct

goal (1 subgoal):
 1. (concat (map (\<lambda>x. map (Pair x) yl) xl), op_set_cart xs ys) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_rel O br set distinct
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(concat (map (\<lambda>x. map (Pair x) yl) xl), op_set_cart xs ys) \<in> \<langle>Rx \<times>\<^sub>r Ry\<rangle>list_set_rel

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dense_lattice_char_1:
  "(\<forall>x y . x \<sqinter> y = bot \<longrightarrow> x = bot \<or> y = bot) \<longleftrightarrow> (\<forall>x . x \<noteq> bot \<longrightarrow> dense x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x y. x \<sqinter> y = bot \<longrightarrow> x = bot \<or> y = bot) = (\<forall>x. x \<noteq> bot \<longrightarrow> dense x)
[PROOF STEP]
by (metis inf_top.left_neutral p_bot p_inf pp_inf_bot_iff)


[STATEMENT]
lemma irrefl_tranclI': "r\<inverse> \<inter> r\<^sup>+ = {} \<Longrightarrow> \<forall>x. (x, x) \<notin> r\<^sup>+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r\<inverse> \<inter> r\<^sup>+ = {} \<Longrightarrow> \<forall>x. (x, x) \<notin> r\<^sup>+
[PROOF STEP]
by (blast elim: tranclE dest: trancl_into_rtrancl)


[STATEMENT]
lemma prefix_le_fininf_transp[intro, trans]:
      assumes "w\<^sub>1 \<le> w\<^sub>2" "w\<^sub>2 \<preceq>\<^sub>F\<^sub>I w\<^sub>3"
      shows "w\<^sub>1 \<preceq>\<^sub>F\<^sub>I w\<^sub>3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w\<^sub>1 \<preceq>\<^sub>F\<^sub>I w\<^sub>3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
w\<^sub>1 \<le> w\<^sub>2
w\<^sub>2 \<preceq>\<^sub>F\<^sub>I w\<^sub>3

goal (1 subgoal):
 1. w\<^sub>1 \<preceq>\<^sub>F\<^sub>I w\<^sub>3
[PROOF STEP]
by auto


[STATEMENT]
lemma sublist_primrec:
  "sublist = (\<lambda>xs ys. rec_list (\<lambda>xs. xs = []) (\<lambda>y ys ysa xs. prefix xs (y # ys) \<or> ysa xs) ys xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sublist = (\<lambda>xs ys. rec_list (\<lambda>xs. xs = []) (\<lambda>y ys ysa xs. prefix xs (y # ys) \<or> ysa xs) ys xs)
[PROOF STEP]
proof (intro ext, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs ys. sublist xs ys = rec_list (\<lambda>xs. xs = []) (\<lambda>y ys ysa xs. prefix xs (y # ys) \<or> ysa xs) ys xs
[PROOF STEP]
case (1 xs ys)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>xs ys. sublist xs ys = rec_list (\<lambda>xs. xs = []) (\<lambda>y ys ysa xs. prefix xs (y # ys) \<or> ysa xs) ys xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sublist xs ys = rec_list (\<lambda>xs. xs = []) (\<lambda>y ys ysa xs. prefix xs (y # ys) \<or> ysa xs) ys xs
[PROOF STEP]
by (induction ys) (auto simp: sublist_Cons_right)
[PROOF STATE]
proof (state)
this:
sublist xs ys = rec_list (\<lambda>xs. xs = []) (\<lambda>y ys ysa xs. prefix xs (y # ys) \<or> ysa xs) ys xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inversion_unit_disc [simp]:
  shows "inversion ` unit_disc = unit_disc_compl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversion ` unit_disc = unit_disc_compl
[PROOF STEP]
unfolding unit_disc_def unit_disc_compl_def disc_def disc_compl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversion ` Collect (in_ocircline ounit_circle) = Collect (out_ocircline ounit_circle)
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. in_ocircline ounit_circle xa \<Longrightarrow> out_ocircline ounit_circle (inversion xa)
 2. \<And>x. out_ocircline ounit_circle x \<Longrightarrow> x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x xa. in_ocircline ounit_circle xa \<Longrightarrow> out_ocircline ounit_circle (inversion xa)
 2. \<And>x. out_ocircline ounit_circle x \<Longrightarrow> x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
assume "in_ocircline ounit_circle x"
[PROOF STATE]
proof (state)
this:
in_ocircline ounit_circle x

goal (2 subgoals):
 1. \<And>x xa. in_ocircline ounit_circle xa \<Longrightarrow> out_ocircline ounit_circle (inversion xa)
 2. \<And>x. out_ocircline ounit_circle x \<Longrightarrow> x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
thus "out_ocircline ounit_circle (inversion x)"
[PROOF STATE]
proof (prove)
using this:
in_ocircline ounit_circle x

goal (1 subgoal):
 1. out_ocircline ounit_circle (inversion x)
[PROOF STEP]
unfolding inversion_def
[PROOF STATE]
proof (prove)
using this:
in_ocircline ounit_circle x

goal (1 subgoal):
 1. out_ocircline ounit_circle ((conjugate \<circ> reciprocal) x)
[PROOF STEP]
by (transfer, transfer, auto simp add: vec_cnj_def)
[PROOF STATE]
proof (state)
this:
out_ocircline ounit_circle (inversion x)

goal (1 subgoal):
 1. \<And>x. out_ocircline ounit_circle x \<Longrightarrow> x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. out_ocircline ounit_circle x \<Longrightarrow> x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. out_ocircline ounit_circle x \<Longrightarrow> x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
assume *: "out_ocircline ounit_circle x"
[PROOF STATE]
proof (state)
this:
out_ocircline ounit_circle x

goal (1 subgoal):
 1. \<And>x. out_ocircline ounit_circle x \<Longrightarrow> x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
show "x \<in> inversion ` Collect (in_ocircline ounit_circle)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> inversion ` Collect (in_ocircline ounit_circle)
[PROOF STEP]
proof (rule image_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = inversion ?x
 2. ?x \<in> Collect (in_ocircline ounit_circle)
[PROOF STEP]
show "x = inversion (inversion x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = inversion (inversion x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = inversion (inversion x)

goal (1 subgoal):
 1. inversion x \<in> Collect (in_ocircline ounit_circle)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inversion x \<in> Collect (in_ocircline ounit_circle)
[PROOF STEP]
show "inversion x \<in> Collect (in_ocircline ounit_circle)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inversion x \<in> Collect (in_ocircline ounit_circle)
[PROOF STEP]
using *
[PROOF STATE]
proof (prove)
using this:
out_ocircline ounit_circle x

goal (1 subgoal):
 1. inversion x \<in> Collect (in_ocircline ounit_circle)
[PROOF STEP]
unfolding inversion_def
[PROOF STATE]
proof (prove)
using this:
out_ocircline ounit_circle x

goal (1 subgoal):
 1. (conjugate \<circ> reciprocal) x \<in> Collect (in_ocircline ounit_circle)
[PROOF STEP]
by (simp, transfer, transfer, auto simp add: vec_cnj_def)
[PROOF STATE]
proof (state)
this:
inversion x \<in> Collect (in_ocircline ounit_circle)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x \<in> inversion ` Collect (in_ocircline ounit_circle)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_lemma_var:
  fixes l:: "real list"
  fixes x:: "real"
  assumes "length l > 1"
  assumes strict_sort: "sorted_wrt (<) l"
  assumes x_not_in: "\<not> (List.member l x)"
  assumes lt_a: "x > (l ! 0)"
  assumes b_lt: "x < (l ! (length l - 1))"
  shows "(\<exists>n. n < length l - 1 \<and> x > l ! n \<and> x < l !(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 < length l
sorted_wrt (<) l
\<not> List.member l x
l ! 0 < x
x < l ! (length l - 1)

goal (1 subgoal):
 1. \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>1 < length []; sorted_wrt (<) []; \<not> List.member [] x; [] ! 0 < x; x < [] ! (length [] - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length [] - 1. [] ! n < x \<and> x < [] ! (n + 1)
 2. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
1 < length []
sorted_wrt (<) []
\<not> List.member [] x
[] ! 0 < x
x < [] ! (length [] - 1)

goal (2 subgoals):
 1. \<lbrakk>1 < length []; sorted_wrt (<) []; \<not> List.member [] x; [] ! 0 < x; x < [] ! (length [] - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length [] - 1. [] ! n < x \<and> x < [] ! (n + 1)
 2. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < length []
sorted_wrt (<) []
\<not> List.member [] x
[] ! 0 < x
x < [] ! (length [] - 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
1 < length []
sorted_wrt (<) []
\<not> List.member [] x
[] ! 0 < x
x < [] ! (length [] - 1)

goal (1 subgoal):
 1. \<exists>n<length [] - 1. [] ! n < x \<and> x < [] ! (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>n<length [] - 1. [] ! n < x \<and> x < [] ! (n + 1)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
case (Cons a l)
[PROOF STATE]
proof (state)
this:
\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)
1 < length (a # l)
sorted_wrt (<) (a # l)
\<not> List.member (a # l) x
(a # l) ! 0 < x
x < (a # l) ! (length (a # l) - 1)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have len_gteq: "length l \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> length l
[PROOF STEP]
using Cons.prems(1)
[PROOF STATE]
proof (prove)
using this:
1 < length (a # l)

goal (1 subgoal):
 1. 1 \<le> length l
[PROOF STEP]
by (metis One_nat_def Suc_eq_plus1 list.size(4) not_le not_less_eq)
[PROOF STATE]
proof (state)
this:
1 \<le> length l

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have len_one: "length l = 1 \<Longrightarrow> (\<exists>n. n < length (a#l) - 1 \<and> x > (a#l) ! n \<and> x < (a#l) !(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length l = 1 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. length l = 1 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
assume len_is: "length l = 1"
[PROOF STATE]
proof (state)
this:
length l = 1

goal (1 subgoal):
 1. length l = 1 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length l = 1
[PROOF STEP]
have "x > (a#l) ! 0 \<and> x < (a#l) !1 "
[PROOF STATE]
proof (prove)
using this:
length l = 1

goal (1 subgoal):
 1. (a # l) ! 0 < x \<and> x < (a # l) ! 1
[PROOF STEP]
using Cons.prems(4) Cons.prems(5)
[PROOF STATE]
proof (prove)
using this:
length l = 1
(a # l) ! 0 < x
x < (a # l) ! (length (a # l) - 1)

goal (1 subgoal):
 1. (a # l) ! 0 < x \<and> x < (a # l) ! 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(a # l) ! 0 < x \<and> x < (a # l) ! 1

goal (1 subgoal):
 1. length l = 1 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a # l) ! 0 < x \<and> x < (a # l) ! 1
[PROOF STEP]
show "(\<exists>n. n < length (a#l) - 1 \<and> x > (a#l) ! n \<and> x < (a#l) !(n+1))"
[PROOF STATE]
proof (prove)
using this:
(a # l) ! 0 < x \<and> x < (a # l) ! 1

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
using len_is
[PROOF STATE]
proof (prove)
using this:
(a # l) ! 0 < x \<and> x < (a # l) ! 1
length l = 1

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length l = 1 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have len_gt: "length l > 1 \<Longrightarrow> (\<exists>n. n < length (a#l) - 1 \<and> x > (a#l) ! n \<and> x < (a#l) !(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
assume len_gt_one: "length l > 1"
[PROOF STATE]
proof (state)
this:
1 < length l

goal (1 subgoal):
 1. 1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have eo: "x \<noteq> l ! 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> l ! 0
[PROOF STEP]
using Cons.prems(3)
[PROOF STATE]
proof (prove)
using this:
\<not> List.member (a # l) x

goal (1 subgoal):
 1. x \<noteq> l ! 0
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> List.member (a # l) (l ! 0); x = l ! 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis One_nat_def Suc_lessD in_set_member len_gt_one member_rec(1) nth_mem)
[PROOF STATE]
proof (state)
this:
x \<noteq> l ! 0

goal (1 subgoal):
 1. 1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have c1: "x < l ! 0 \<Longrightarrow> (\<exists>n. n < length (a#l) - 1 \<and> x > (a#l) ! n \<and> x < (a#l) !(n+1)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < l ! 0 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x < l ! 0 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
assume xlt: "x < l !0"
[PROOF STATE]
proof (state)
this:
x < l ! 0

goal (1 subgoal):
 1. x < l ! 0 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x < l ! 0
[PROOF STEP]
have "x < (a#l) ! 1 "
[PROOF STATE]
proof (prove)
using this:
x < l ! 0

goal (1 subgoal):
 1. x < (a # l) ! 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x < (a # l) ! 1

goal (1 subgoal):
 1. x < l ! 0 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x < (a # l) ! 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x < (a # l) ! 1

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
using  Cons.prems(4) len_gt_one
[PROOF STATE]
proof (prove)
using this:
x < (a # l) ! 1
(a # l) ! 0 < x
1 < length l

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x < l ! 0; a < x; Suc 0 < length l\<rbrakk> \<Longrightarrow> \<exists>n<length l. (a # l) ! n < x \<and> x < l ! n
[PROOF STEP]
using Cons.prems(4) Suc_lessD
[PROOF STATE]
proof (prove)
using this:
(a # l) ! 0 < x
Suc ?m < ?n \<Longrightarrow> ?m < ?n

goal (1 subgoal):
 1. \<lbrakk>x < l ! 0; a < x; Suc 0 < length l\<rbrakk> \<Longrightarrow> \<exists>n<length l. (a # l) ! n < x \<and> x < l ! n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x < l ! 0 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal (1 subgoal):
 1. 1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have c2: "x > l ! 0 \<Longrightarrow> (\<exists>n. n < length (a#l) - 1 \<and> x > (a#l) ! n \<and> x < (a#l) !(n+1)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
assume asm: "x > l ! 0"
[PROOF STATE]
proof (state)
this:
l ! 0 < x

goal (1 subgoal):
 1. l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have xlt_1: " x < l ! (length l - 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x < l ! (length l - 1)
[PROOF STEP]
using Cons.prems(5)
[PROOF STATE]
proof (prove)
using this:
x < (a # l) ! (length (a # l) - 1)

goal (1 subgoal):
 1. x < l ! (length l - 1)
[PROOF STEP]
by (metis Cons.prems(1) One_nat_def add_diff_cancel_right' list.size(4) nth_Cons_pos zero_less_diff)
[PROOF STATE]
proof (state)
this:
x < l ! (length l - 1)

goal (1 subgoal):
 1. l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have ssl: "sorted_wrt (<) l "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (<) l
[PROOF STEP]
using Cons.prems(2)
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (<) (a # l)

goal (1 subgoal):
 1. sorted_wrt (<) l
[PROOF STEP]
using sorted_wrt.simps(2)
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (<) (a # l)
sorted_wrt ?P (?x # ?ys) = (Ball (set ?ys) (?P ?x) \<and> sorted_wrt ?P ?ys)

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

goal (1 subgoal):
 1. l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
have " \<not> List.member l x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> List.member l x
[PROOF STEP]
using Cons.prems(3)
[PROOF STATE]
proof (prove)
using this:
\<not> List.member (a # l) x

goal (1 subgoal):
 1. \<not> List.member l x
[PROOF STEP]
by (meson member_rec(1))
[PROOF STATE]
proof (state)
this:
\<not> List.member l x

goal (1 subgoal):
 1. l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> List.member l x
[PROOF STEP]
have " \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)"
[PROOF STATE]
proof (prove)
using this:
\<not> List.member l x

goal (1 subgoal):
 1. \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)
[PROOF STEP]
using asm xlt_1 len_gt_one ssl Cons.hyps
[PROOF STATE]
proof (prove)
using this:
\<not> List.member l x
l ! 0 < x
x < l ! (length l - 1)
1 < length l
sorted_wrt (<) l
\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)

goal (1 subgoal):
 1. \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)

goal (1 subgoal):
 1. l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1)

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
by (metis One_nat_def Suc_eq_plus1 diff_Suc_1 less_diff_conv list.size(4) nth_Cons_Suc)
[PROOF STATE]
proof (state)
this:
\<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal (1 subgoal):
 1. 1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
show "(\<exists>n. n < length (a#l) - 1 \<and> x > (a#l) ! n \<and> x < (a#l) !(n+1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
using eo c1 c2
[PROOF STATE]
proof (prove)
using this:
x \<noteq> l ! 0
x < l ! 0 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
l ! 0 < x \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
by (meson linorder_neqE_linordered_idom)
[PROOF STATE]
proof (state)
this:
\<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal (1 subgoal):
 1. \<And>a l. \<lbrakk>\<lbrakk>1 < length l; sorted_wrt (<) l; \<not> List.member l x; l ! 0 < x; x < l ! (length l - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length l - 1. l ! n < x \<and> x < l ! (n + 1); 1 < length (a # l); sorted_wrt (<) (a # l); \<not> List.member (a # l) x; (a # l) ! 0 < x; x < (a # l) ! (length (a # l) - 1)\<rbrakk> \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
using len_gteq len_one len_gt
[PROOF STATE]
proof (prove)
using this:
1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
1 \<le> length l
length l = 1 \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
1 < length l \<Longrightarrow> \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal (1 subgoal):
 1. \<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 < length l \<Longrightarrow> \<exists>n<length l. (a # l) ! n < x \<and> x < l ! n; Suc 0 \<le> length l; length l = Suc 0 \<Longrightarrow> a < x \<and> x < l ! 0\<rbrakk> \<Longrightarrow> \<exists>n<length l. (a # l) ! n < x \<and> x < l ! n
[PROOF STEP]
by (metis One_nat_def less_numeral_extra(1) linorder_neqE_nat not_less nth_Cons_0)
[PROOF STATE]
proof (state)
this:
\<exists>n<length (a # l) - 1. (a # l) ! n < x \<and> x < (a # l) ! (n + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma INF_ereal_add_directed:
  fixes f g :: "'a \<Rightarrow> ereal"
  assumes nonneg: "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> f i" "\<And>i. i \<in> I \<Longrightarrow> 0 \<le> g i"
  assumes directed: "\<And>i j. i \<in> I \<Longrightarrow> j \<in> I \<Longrightarrow> \<exists>k\<in>I. f i + g j \<ge> f k + g k"
  shows "(INF i\<in>I. f i + g i) = (INF i\<in>I. f i) + (INF i\<in>I. g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
 2. \<not> ?P \<Longrightarrow> (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
assume "I = {}"
[PROOF STATE]
proof (state)
this:
I = {}

goal (2 subgoals):
 1. ?P \<Longrightarrow> (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
 2. \<not> ?P \<Longrightarrow> (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
I = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
I = {}

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
by (simp add: top_ereal_def)
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)

goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
assume "I \<noteq> {}"
[PROOF STATE]
proof (state)
this:
I \<noteq> {}

goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
 2. Inf (f ` I) + Inf (g ` I) \<le> (INF i\<in>I. f i + g i)
[PROOF STEP]
show "(INF i\<in>I. f i) + (INF i\<in>I. g i) \<le> (INF i\<in>I. f i + g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf (f ` I) + Inf (g ` I) \<le> (INF i\<in>I. f i + g i)
[PROOF STEP]
by (rule INF_greatest; intro add_mono INF_lower)
[PROOF STATE]
proof (state)
this:
Inf (f ` I) + Inf (g ` I) \<le> (INF i\<in>I. f i + g i)

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
have "(INF i\<in>I. f i + g i) \<le> (INF i\<in>I. (INF j\<in>I. f i + g j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> (INF i\<in>I. INF j\<in>I. f i + g j)
[PROOF STEP]
using directed
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i \<in> I; ?j \<in> I\<rbrakk> \<Longrightarrow> \<exists>k\<in>I. f k + g k \<le> f ?i + g ?j

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> (INF i\<in>I. INF j\<in>I. f i + g j)
[PROOF STEP]
by (intro INF_greatest) (blast intro: INF_lower2)
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. f i + g i) \<le> (INF i\<in>I. INF j\<in>I. f i + g j)

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. f i + g i) \<le> (INF i\<in>I. INF j\<in>I. f i + g j)

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
have "\<dots> = (INF i\<in>I. f i + (INF i\<in>I. g i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>I. INF j\<in>I. f i + g j) = (INF i\<in>I. f i + Inf (g ` I))
[PROOF STEP]
using nonneg \<open>I \<noteq> {}\<close>
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> 0 \<le> f ?i
?i \<in> I \<Longrightarrow> 0 \<le> g ?i
I \<noteq> {}

goal (1 subgoal):
 1. (INF i\<in>I. INF j\<in>I. f i + g j) = (INF i\<in>I. f i + Inf (g ` I))
[PROOF STEP]
by (auto simp: INF_ereal_add_right)
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. INF j\<in>I. f i + g j) = (INF i\<in>I. f i + Inf (g ` I))

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. INF j\<in>I. f i + g j) = (INF i\<in>I. f i + Inf (g ` I))

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
have "\<dots> = (INF i\<in>I. f i) + (INF i\<in>I. g i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF i\<in>I. f i + Inf (g ` I)) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
using nonneg
[PROOF STATE]
proof (prove)
using this:
?i \<in> I \<Longrightarrow> 0 \<le> f ?i
?i \<in> I \<Longrightarrow> 0 \<le> g ?i

goal (1 subgoal):
 1. (INF i\<in>I. f i + Inf (g ` I)) = Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
by (intro INF_ereal_add_left \<open>I \<noteq> {}\<close>) (auto simp: INF_eq_minf intro!: exI[of _ 0])
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. f i + Inf (g ` I)) = Inf (f ` I) + Inf (g ` I)

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
show "(INF i\<in>I. f i + g i) \<le> (INF i\<in>I. f i) + (INF i\<in>I. g i)"
[PROOF STATE]
proof (prove)
using this:
(INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)

goal (1 subgoal):
 1. (INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. f i + g i) \<le> Inf (f ` I) + Inf (g ` I)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(INF i\<in>I. f i + g i) = Inf (f ` I) + Inf (g ` I)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma primepow_even_imp_primepow:
  assumes "primepow_even n"
  shows   "primepow n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primepow n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. primepow n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
primepow_even n
[PROOF STEP]
obtain p k where "1 \<le> k" "prime p" "n = p ^ (2 * k)"
[PROOF STATE]
proof (prove)
using this:
primepow_even n

goal (1 subgoal):
 1. (\<And>k p. \<lbrakk>1 \<le> k; prime p; n = p ^ (2 * k)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding primepow_even_def
[PROOF STATE]
proof (prove)
using this:
\<exists>p k. 1 \<le> k \<and> prime p \<and> n = p ^ (2 * k)

goal (1 subgoal):
 1. (\<And>k p. \<lbrakk>1 \<le> k; prime p; n = p ^ (2 * k)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
1 \<le> k
prime p
n = p ^ (2 * k)

goal (1 subgoal):
 1. primepow n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1 \<le> k
prime p
n = p ^ (2 * k)

goal (1 subgoal):
 1. primepow n
[PROOF STEP]
from \<open>1 \<le> k\<close>
[PROOF STATE]
proof (chain)
picking this:
1 \<le> k
[PROOF STEP]
have "2 * k > 0"
[PROOF STATE]
proof (prove)
using this:
1 \<le> k

goal (1 subgoal):
 1. 0 < 2 * k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < 2 * k

goal (1 subgoal):
 1. primepow n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1 \<le> k
prime p
n = p ^ (2 * k)
0 < 2 * k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 \<le> k
prime p
n = p ^ (2 * k)
0 < 2 * k

goal (1 subgoal):
 1. primepow n
[PROOF STEP]
unfolding primepow_def
[PROOF STATE]
proof (prove)
using this:
1 \<le> k
prime p
n = p ^ (2 * k)
0 < 2 * k

goal (1 subgoal):
 1. \<exists>p k. prime p \<and> 0 < k \<and> n = p ^ k
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
primepow n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma big_small_mult:
  "f1 \<in> L F (g1) \<Longrightarrow> f2 \<in> l F (g2) \<Longrightarrow> (\<lambda>x. f1 x * f2 x) \<in> l F (\<lambda>x. g1 x * g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f1 \<in> L F g1; f2 \<in> l F g2\<rbrakk> \<Longrightarrow> (\<lambda>x. f1 x * f2 x) \<in> l F (\<lambda>x. g1 x * g2 x)
[PROOF STEP]
by (subst (1 2) mult.commute) (rule small_big_mult)


[STATEMENT]
lemma sbintrunc_n_0: "(signed_take_bit :: nat \<Rightarrow> int \<Rightarrow> int) n 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. signed_take_bit n 0 = 0
[PROOF STEP]
by (fact signed_take_bit_of_0)


[STATEMENT]
lemma map_of_concat:
  "k \<in> dom (map_of(concat l))
  \<Longrightarrow> \<exists>i. k \<in> dom (map_of(l!i)) \<and> i < length l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l
[PROOF STEP]
apply (induct l)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. k \<in> dom (map_of (concat [])) \<Longrightarrow> \<exists>i. k \<in> dom (map_of ([] ! i)) \<and> i < length []
 2. \<And>a l. \<lbrakk>k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l; k \<in> dom (map_of (concat (a # l)))\<rbrakk> \<Longrightarrow> \<exists>i. k \<in> dom (map_of ((a # l) ! i)) \<and> i < length (a # l)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l. \<lbrakk>k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l; k \<in> dom (map_of (concat (a # l)))\<rbrakk> \<Longrightarrow> \<exists>i. k \<in> dom (map_of ((a # l) ! i)) \<and> i < length (a # l)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a l y. \<lbrakk>k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l; map_of a k = Some y\<rbrakk> \<Longrightarrow> \<exists>i. k \<in> dom (map_of ((a # l) ! i)) \<and> i < Suc (length l)
 2. \<And>a l y. \<lbrakk>k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l; map_of (concat l) k = Some y\<rbrakk> \<Longrightarrow> \<exists>i. k \<in> dom (map_of ((a # l) ! i)) \<and> i < Suc (length l)
[PROOF STEP]
apply (rule_tac x = 0 in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a l y. \<lbrakk>k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l; map_of a k = Some y\<rbrakk> \<Longrightarrow> k \<in> dom (map_of ((a # l) ! 0)) \<and> 0 < Suc (length l)
 2. \<And>a l y. \<lbrakk>k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l; map_of (concat l) k = Some y\<rbrakk> \<Longrightarrow> \<exists>i. k \<in> dom (map_of ((a # l) ! i)) \<and> i < Suc (length l)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a l y. \<lbrakk>k \<in> dom (map_of (concat l)) \<Longrightarrow> \<exists>i. k \<in> dom (map_of (l ! i)) \<and> i < length l; map_of (concat l) k = Some y\<rbrakk> \<Longrightarrow> \<exists>i. k \<in> dom (map_of ((a # l) ! i)) \<and> i < Suc (length l)
[PROOF STEP]
by (metis Suc_mono domI nth_Cons_Suc)


[STATEMENT]
lemma Prefixes_subset_\<P>:
  assumes "p \<in> \<P> k u"
  shows "Prefixes p \<subseteq> \<P> k u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Prefixes p \<subseteq> \<P> k u
[PROOF STEP]
using Prefixes_is_prefix assms prefixes_are_paths
[PROOF STATE]
proof (prove)
using this:
(?q \<in> Prefixes ?p) = is_prefix ?q ?p
p \<in> \<P> k u
\<lbrakk>?p \<in> \<P> ?k ?u; is_prefix ?x ?p\<rbrakk> \<Longrightarrow> ?x \<in> \<P> ?k ?u

goal (1 subgoal):
 1. Prefixes p \<subseteq> \<P> k u
[PROOF STEP]
by blast


[STATEMENT]
lemma append_fusion [code]:
  "append_fusion g1 g2 s1 s2 =
  (if list.has_next g1 s1 then
     let (x, s1') = list.next g1 s1
     in x # append_fusion g1 g2 s1' s2
   else list.unfoldr g2 s2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. append_fusion g1 g2 s1 s2 = (if list.has_next g1 s1 then let (x, s1') = list.next g1 s1 in x # append_fusion g1 g2 s1' s2 else list.unfoldr g2 s2)
[PROOF STEP]
unfolding append_fusion_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list.unfoldr g1 s1 @ list.unfoldr g2 s2 = (if list.has_next g1 s1 then let (x, s1') = list.next g1 s1 in x # list.unfoldr g1 s1' @ list.unfoldr g2 s2 else list.unfoldr g2 s2)
[PROOF STEP]
by(subst list.unfoldr.simps)(simp add: split_beta)


[STATEMENT]
lemma block_subtractivity:
  assumes "c > 0"
  defines "b \<equiv> 2 ^ Suc c"
  assumes block_wise_lt: "\<forall>t'. nth_digit y t' b \<le> nth_digit x t' b"
  shows "nth_digit (x-y) t b = nth_digit x t b - nth_digit y t b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
have "k\<le>c \<longrightarrow> nth_digit (x-y) t b \<exclamdown> k = (x - y) \<exclamdown> (Suc c * t + k)" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> k = (x - y) \<exclamdown> (Suc c * t + k)
[PROOF STEP]
using digit_gen_pow2_reduct[of "k" "Suc c" "x-y" "t"] b_def
[PROOF STATE]
proof (prove)
using this:
k < Suc c \<Longrightarrow> nth_digit (x - y) t (2 ^ Suc c) \<exclamdown> k = (x - y) \<exclamdown> (Suc c * t + k)
b \<equiv> 2 ^ Suc c

goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> k = (x - y) \<exclamdown> (Suc c * t + k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = (x - y) \<exclamdown> (Suc c * t + ?k)

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
have "k\<le>c \<longrightarrow> nth_digit x t b \<exclamdown> k = x \<exclamdown> (Suc c * t + k)" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit x t b \<exclamdown> k = x \<exclamdown> (Suc c * t + k)
[PROOF STEP]
using digit_gen_pow2_reduct[of "k" "Suc c" "x" "t"] b_def
[PROOF STATE]
proof (prove)
using this:
k < Suc c \<Longrightarrow> nth_digit x t (2 ^ Suc c) \<exclamdown> k = x \<exclamdown> (Suc c * t + k)
b \<equiv> 2 ^ Suc c

goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit x t b \<exclamdown> k = x \<exclamdown> (Suc c * t + k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<le> c \<longrightarrow> nth_digit x t b \<exclamdown> ?k = x \<exclamdown> (Suc c * t + ?k)

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
have "k\<le>c \<longrightarrow> nth_digit y t b \<exclamdown> k = y \<exclamdown> (Suc c * t + k)" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit y t b \<exclamdown> k = y \<exclamdown> (Suc c * t + k)
[PROOF STEP]
using digit_gen_pow2_reduct[of "k" "Suc c" "y" "t"] b_def
[PROOF STATE]
proof (prove)
using this:
k < Suc c \<Longrightarrow> nth_digit y t (2 ^ Suc c) \<exclamdown> k = y \<exclamdown> (Suc c * t + k)
b \<equiv> 2 ^ Suc c

goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit y t b \<exclamdown> k = y \<exclamdown> (Suc c * t + k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<le> c \<longrightarrow> nth_digit y t b \<exclamdown> ?k = y \<exclamdown> (Suc c * t + ?k)

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
have k_le: "k \<le> c \<longrightarrow> nth_digit (x-y) t b \<exclamdown> k
               = (nth_digit x t b - nth_digit y t b) \<exclamdown> k" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> k = (nth_digit x t b - nth_digit y t b) \<exclamdown> k
[PROOF STEP]
using assms digit_wise_block_subtractivity
[PROOF STATE]
proof (prove)
using this:
0 < c
b \<equiv> 2 ^ Suc c
\<forall>t'. nth_digit y t' b \<le> nth_digit x t' b
\<lbrakk>\<forall>t'. nth_digit ?y t' (2 ^ Suc ?c) \<le> nth_digit ?x t' (2 ^ Suc ?c); ?k \<le> ?c; 0 < ?c\<rbrakk> \<Longrightarrow> nth_digit (?x - ?y) ?t (2 ^ Suc ?c) \<exclamdown> ?k = (nth_digit ?x ?t (2 ^ Suc ?c) - nth_digit ?y ?t (2 ^ Suc ?c)) \<exclamdown> ?k

goal (1 subgoal):
 1. k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> k = (nth_digit x t b - nth_digit y t b) \<exclamdown> k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
have "nth_digit x t b - nth_digit y t b < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit x t b - nth_digit y t b < b
[PROOF STEP]
using
      nth_digit_bound b_def
[PROOF STATE]
proof (prove)
using this:
nth_digit ?x ?t (2 ^ Suc ?c) < 2 ^ Suc ?c
b \<equiv> 2 ^ Suc c

goal (1 subgoal):
 1. nth_digit x t b - nth_digit y t b < b
[PROOF STEP]
by (simp add: less_imp_diff_less)
[PROOF STATE]
proof (state)
this:
nth_digit x t b - nth_digit y t b < b

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
hence diff: "k\<ge>Suc c \<longrightarrow> (nth_digit x t b - nth_digit y t b) \<exclamdown> k = 0" for k
[PROOF STATE]
proof (prove)
using this:
nth_digit x t b - nth_digit y t b < b

goal (1 subgoal):
 1. Suc c \<le> k \<longrightarrow> (nth_digit x t b - nth_digit y t b) \<exclamdown> k = 0
[PROOF STEP]
using nth_bit_def b_def aux_lt_implies_mask b_def
[PROOF STATE]
proof (prove)
using this:
nth_digit x t b - nth_digit y t b < b
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2
b \<equiv> 2 ^ Suc c
?a < 2 ^ ?k \<Longrightarrow> \<forall>r\<ge>?k. ?a \<exclamdown> r = 0
b \<equiv> 2 ^ Suc c

goal (1 subgoal):
 1. Suc c \<le> k \<longrightarrow> (nth_digit x t b - nth_digit y t b) \<exclamdown> k = 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
Suc c \<le> ?k \<longrightarrow> (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k = 0

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
have "nth_digit (x-y) t b < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit (x - y) t b < b
[PROOF STEP]
using nth_digit_bound b_def
[PROOF STATE]
proof (prove)
using this:
nth_digit ?x ?t (2 ^ Suc ?c) < 2 ^ Suc ?c
b \<equiv> 2 ^ Suc c

goal (1 subgoal):
 1. nth_digit (x - y) t b < b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nth_digit (x - y) t b < b

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
hence "k\<ge>Suc c \<longrightarrow> nth_digit (x-y) t b \<exclamdown> k = 0" for k
[PROOF STATE]
proof (prove)
using this:
nth_digit (x - y) t b < b

goal (1 subgoal):
 1. Suc c \<le> k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> k = 0
[PROOF STEP]
using nth_bit_def b_def aux_lt_implies_mask b_def
[PROOF STATE]
proof (prove)
using this:
nth_digit (x - y) t b < b
?num \<exclamdown> ?k = ?num div 2 ^ ?k mod 2
b \<equiv> 2 ^ Suc c
?a < 2 ^ ?k \<Longrightarrow> \<forall>r\<ge>?k. ?a \<exclamdown> r = 0
b \<equiv> 2 ^ Suc c

goal (1 subgoal):
 1. Suc c \<le> k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> k = 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
Suc c \<le> ?k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = 0

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
with diff
[PROOF STATE]
proof (chain)
picking this:
Suc c \<le> ?k \<longrightarrow> (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k = 0
Suc c \<le> ?k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = 0
[PROOF STEP]
have k_gt: "k > c \<longrightarrow> nth_digit (x-y) t b \<exclamdown> k
               = (nth_digit x t b - nth_digit y t b) \<exclamdown> k" for k
[PROOF STATE]
proof (prove)
using this:
Suc c \<le> ?k \<longrightarrow> (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k = 0
Suc c \<le> ?k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = 0

goal (1 subgoal):
 1. c < k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> k = (nth_digit x t b - nth_digit y t b) \<exclamdown> k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
c < ?k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
from k_le k_gt
[PROOF STATE]
proof (chain)
picking this:
?k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k
c < ?k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k
[PROOF STEP]
have "nth_digit (x-y) t b \<exclamdown> k
              = (nth_digit x t b - nth_digit y t b) \<exclamdown> k" for k
[PROOF STATE]
proof (prove)
using this:
?k \<le> c \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k
c < ?k \<longrightarrow> nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k

goal (1 subgoal):
 1. nth_digit (x - y) t b \<exclamdown> k = (nth_digit x t b - nth_digit y t b) \<exclamdown> k
[PROOF STEP]
by(cases "k>c"; auto)
[PROOF STATE]
proof (state)
this:
nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k

goal (1 subgoal):
 1. nth_digit (x - y) t b = nth_digit x t b - nth_digit y t b
[PROOF STEP]
using digit_wise_equiv[of "nth_digit x t b - nth_digit y t b"
                                         "nth_digit (x-y) t b"]
[PROOF STATE]
proof (prove)
using this:
nth_digit (x - y) t b \<exclamdown> ?k = (nth_digit x t b - nth_digit y t b) \<exclamdown> ?k
(nth_digit x t b - nth_digit y t b = nth_digit (x - y) t b) = (\<forall>k. (nth_digit x t b - nth_digit y t b) \<exclamdown> k = nth_digit (x - y) t b \<exclamdown> k)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_derivative_cosh [derivative_intros]:
  fixes g :: "'a \<Rightarrow> ('a :: {banach, real_normed_field})"
  assumes "(g has_derivative (\<lambda>y. Db * y)) (at x within s)"
  shows   "((\<lambda>x. cosh (g x)) has_derivative (\<lambda>y. (sinh (g x) * Db) * y)) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
have "((\<lambda>x. - g x) has_derivative (\<lambda>y. -(Db * y))) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. - g x) has_derivative (\<lambda>y. - (Db * y))) (at x within s)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(g has_derivative (*) Db) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. - g x) has_derivative (\<lambda>y. - (Db * y))) (at x within s)
[PROOF STEP]
by (intro derivative_intros)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - g x) has_derivative (\<lambda>y. - (Db * y))) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. - g x) has_derivative (\<lambda>y. - (Db * y))) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
have "(\<lambda>y. -(Db * y)) = (\<lambda>y. (-Db) * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. - (Db * y)) = (*) (- Db)
[PROOF STEP]
by (simp add: fun_eq_iff)
[PROOF STATE]
proof (state)
this:
(\<lambda>y. - (Db * y)) = (*) (- Db)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. - g x) has_derivative (*) (- Db)) (at x within s)
[PROOF STEP]
have "((\<lambda>x. cosh (g x)) has_derivative
    (\<lambda>y. (exp (g x) * Db * y + exp (-g x) * (-Db) * y) /\<^sub>R 2)) (at x within s)"
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. - g x) has_derivative (*) (- Db)) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (\<lambda>y. (exp (g x) * Db * y + exp (- g x) * - Db * y) /\<^sub>R 2)) (at x within s)
[PROOF STEP]
unfolding cosh_def
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. - g x) has_derivative (*) (- Db)) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. (exp (g x) + exp (- g x)) /\<^sub>R 2) has_derivative (\<lambda>y. (exp (g x) * Db * y + exp (- g x) * - Db * y) /\<^sub>R 2)) (at x within s)
[PROOF STEP]
by (intro derivative_intros assms)
[PROOF STATE]
proof (state)
this:
((\<lambda>x. cosh (g x)) has_derivative (\<lambda>y. (exp (g x) * Db * y + exp (- g x) * - Db * y) /\<^sub>R 2)) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. cosh (g x)) has_derivative (\<lambda>y. (exp (g x) * Db * y + exp (- g x) * - Db * y) /\<^sub>R 2)) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
have "(\<lambda>y. (exp (g x) * Db * y + exp (-g x) * (-Db) * y) /\<^sub>R 2) = (\<lambda>y. (sinh (g x) * Db) * y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>y. (exp (g x) * Db * y + exp (- g x) * - Db * y) /\<^sub>R 2) = (*) (sinh (g x) * Db)
[PROOF STEP]
by (simp add: fun_eq_iff sinh_def algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>y. (exp (g x) * Db * y + exp (- g x) * - Db * y) /\<^sub>R 2) = (*) (sinh (g x) * Db)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)

goal (1 subgoal):
 1. ((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
((\<lambda>x. cosh (g x)) has_derivative (*) (sinh (g x) * Db)) (at x within s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_list_card: "count_list xs x = card {k. k < length xs \<and> xs ! k = x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list xs x = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count_list xs x = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
have "count_list xs x = length (filter ((=) x) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list xs x = length (filter ((=) x) xs)
[PROOF STEP]
by (induction xs, simp, simp)
[PROOF STATE]
proof (state)
this:
count_list xs x = length (filter ((=) x) xs)

goal (1 subgoal):
 1. count_list xs x = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_list xs x = length (filter ((=) x) xs)

goal (1 subgoal):
 1. count_list xs x = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
have "... = card {k. k < length xs \<and> xs ! k = x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter ((=) x) xs) = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
by (subst length_filter_conv_card, metis)
[PROOF STATE]
proof (state)
this:
length (filter ((=) x) xs) = card {k. k < length xs \<and> xs ! k = x}

goal (1 subgoal):
 1. count_list xs x = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_list xs x = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_list xs x = card {k. k < length xs \<and> xs ! k = x}

goal (1 subgoal):
 1. count_list xs x = card {k. k < length xs \<and> xs ! k = x}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count_list xs x = card {k. k < length xs \<and> xs ! k = x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mpi_val_eq: "mpi_val (Suc n) =
  mpi_val n + (\<Sum>i \<le> m n (mpi_val n). (l *\<^sub>R \<P>\<^sub>1 (mk_dec_det (mpi_pol n))) ^^ i) (B\<^sub>b (mpi_val n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpi_val (Suc n) = mpi_val n + blinfun_apply (sum ((^^) (l *\<^sub>R \<P>\<^sub>1 (mk_dec_det (mpi_pol n)))) {..m n (mpi_val n)}) (B\<^sub>b (mpi_val n))
[PROOF STEP]
using L_pow_eq[OF \<nu>_improving_mpi_pol] mpi_val_Suc
[PROOF STATE]
proof (prove)
using this:
L_pow (mpi_val ?n1) (mpi_pol ?n1) ?m = mpi_val ?n1 + blinfun_apply (sum ((^^) (l *\<^sub>R \<P>\<^sub>1 (mk_dec_det (mpi_pol ?n1)))) {..?m}) (B\<^sub>b (mpi_val ?n1))
mpi_val (Suc ?n) = L_pow (mpi_val ?n) (mpi_pol ?n) (m ?n (mpi_val ?n))

goal (1 subgoal):
 1. mpi_val (Suc n) = mpi_val n + blinfun_apply (sum ((^^) (l *\<^sub>R \<P>\<^sub>1 (mk_dec_det (mpi_pol n)))) {..m n (mpi_val n)}) (B\<^sub>b (mpi_val n))
[PROOF STEP]
by auto


[STATEMENT]
lemma singleton_list: "(length l = 1) = (\<exists>e. l = [e])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length l = 1) = (\<exists>e. l = [e])
[PROOF STEP]
by (induct l, auto)


[STATEMENT]
lemma A_merge: assumes "is_root h1" "is_root h2"
shows "T_merge h1 h2 + \<Phi>(merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (size h1 + size h2 + 1) + 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
proof (cases h1)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. h1 = \<langle>\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
 2. \<And>x21 x22 x23. h1 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:
h1 = \<langle>\<rangle>

goal (2 subgoals):
 1. h1 = \<langle>\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
 2. \<And>x21 x22 x23. h1 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
h1 = \<langle>\<rangle>

goal (1 subgoal):
 1. real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
by (cases h2) auto
[PROOF STATE]
proof (state)
this:
real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2

goal (1 subgoal):
 1. \<And>x21 x22 x23. h1 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x21 x22 x23. h1 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
case h1: Node
[PROOF STATE]
proof (state)
this:
h1 = \<langle>x21_, x22_, x23_\<rangle>

goal (1 subgoal):
 1. \<And>x21 x22 x23. h1 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
proof (cases h2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. h2 = \<langle>\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
 2. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:
h2 = \<langle>\<rangle>

goal (2 subgoals):
 1. h2 = \<langle>\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
 2. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
h2 = \<langle>\<rangle>

goal (1 subgoal):
 1. real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
using h1
[PROOF STATE]
proof (prove)
using this:
h2 = \<langle>\<rangle>
h1 = \<langle>x21_, x22_, x23_\<rangle>

goal (1 subgoal):
 1. real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2

goal (1 subgoal):
 1. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
case h2: Node
[PROOF STATE]
proof (state)
this:
h2 = \<langle>x21_, x22_, x23_\<rangle>

goal (1 subgoal):
 1. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
have "\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1
[PROOF STEP]
apply(rule \<Delta>\<Phi>_merge)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. h1 = \<langle>?hs1.0, ?x1.0, \<langle>\<rangle>\<rangle>
 2. h2 = \<langle>?hs2.0, ?x2.0, \<langle>\<rangle>\<rangle>
[PROOF STEP]
using h1 h2 assms
[PROOF STATE]
proof (prove)
using this:
h1 = \<langle>x21___, x22___, x23___\<rangle>
h2 = \<langle>x21_, x22_, x23_\<rangle>
is_root h1
is_root h2

goal (2 subgoals):
 1. h1 = \<langle>?hs1.0, ?x1.0, \<langle>\<rangle>\<rangle>
 2. h2 = \<langle>?hs2.0, ?x2.0, \<langle>\<rangle>\<rangle>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1

goal (1 subgoal):
 1. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2)) + 1

goal (1 subgoal):
 1. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
have "\<dots> \<le> log 2 (size h1 + size h2 + 1) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. log 2 (real (size h1 + size h2)) + 1 \<le> log 2 (real (size h1 + size h2 + 1)) + 1
[PROOF STEP]
by (simp add: h1)
[PROOF STATE]
proof (state)
this:
log 2 (real (size h1 + size h2)) + 1 \<le> log 2 (real (size h1 + size h2 + 1)) + 1

goal (1 subgoal):
 1. \<And>x21 x22 x23. h2 = \<langle>x21, x22, x23\<rangle> \<Longrightarrow> real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 1

goal (1 subgoal):
 1. real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2
[PROOF STEP]
by(simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
real (T_merge h1 h2) + \<Phi> (merge h1 h2) - \<Phi> h1 - \<Phi> h2 \<le> log 2 (real (size h1 + size h2 + 1)) + 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_Sup_supdistl:
  fixes f :: "'a \<Rightarrow> 'b::complete_lattice"
  shows "mono f \<Longrightarrow> Sup \<circ> (`) f \<le> f \<circ> Sup"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> Sup \<circ> (`) f \<le> f \<circ> Sup
[PROOF STEP]
by (simp add: complete_lattice_class.Sup_le_iff le_funI Sup_upper monoD)


[STATEMENT]
lemma trans_order_nest: "trans (nest r R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans (nest r R)
[PROOF STEP]
using trans_mult
[PROOF STATE]
proof (prove)
using this:
trans (mult ?R)

goal (1 subgoal):
 1. trans (nest r R)
[PROOF STEP]
unfolding nest_def trans_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y z. (x, y) \<in> mult ?R \<longrightarrow> (y, z) \<in> mult ?R \<longrightarrow> (x, z) \<in> mult ?R

goal (1 subgoal):
 1. \<forall>x y z. (x, y) \<in> {(a, b). (ms_of_greek a, ms_of_greek b) \<in> mult (letter_less r <*lex*> R)} \<longrightarrow> (y, z) \<in> {(a, b). (ms_of_greek a, ms_of_greek b) \<in> mult (letter_less r <*lex*> R)} \<longrightarrow> (x, z) \<in> {(a, b). (ms_of_greek a, ms_of_greek b) \<in> mult (letter_less r <*lex*> R)}
[PROOF STEP]
by fast


[STATEMENT]
lemma supdistl_iso:
  fixes f :: "'a \<Rightarrow> 'b::complete_lattice"
  shows "(Sup \<circ> (`) f \<le> f \<circ> Sup) = mono f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Sup \<circ> (`) f \<le> f \<circ> Sup) = mono f
[PROOF STEP]
using Sup_supdistl_iso iso_Sup_supdistl
[PROOF STATE]
proof (prove)
using this:
Sup \<circ> (`) ?f \<le> ?f \<circ> Sup \<Longrightarrow> mono ?f
mono ?f \<Longrightarrow> Sup \<circ> (`) ?f \<le> ?f \<circ> Sup

goal (1 subgoal):
 1. (Sup \<circ> (`) f \<le> f \<circ> Sup) = mono f
[PROOF STEP]
by force


[STATEMENT]
lemma Ints_sum:
  assumes "\<And>x. x \<in> A \<Longrightarrow> f x \<in> \<int>"
  shows   "sum f A \<in> \<int>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f A \<in> \<int>
[PROOF STEP]
by (cases "finite A", insert assms, induction A rule: finite_induct)
     (auto intro!: Ints_add)


[STATEMENT]
lemma vec_of_scal_dim_1: "(v \<in> carrier_vec 1) = (v = vec_of_scal (v $ 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (v \<in> carrier_vec 1) = (v = vec_of_scal (v $ 0))
[PROOF STEP]
by(standard, auto simp del: One_nat_def, metis vec_of_scal_dim(2))


[STATEMENT]
lemma to_fract_uminus [simp]: "to_fract (-x) = -to_fract x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fract (- x) = - to_fract x
[PROOF STEP]
by (simp add: to_fract_def)


[STATEMENT]
lemma emeasure_compact_finite: "compact A \<Longrightarrow> emeasure lborel A < \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact A \<Longrightarrow> emeasure lborel A < \<infinity>
[PROOF STEP]
using emeasure_bounded_finite[of A]
[PROOF STATE]
proof (prove)
using this:
bounded A \<Longrightarrow> emeasure lborel A < \<infinity>

goal (1 subgoal):
 1. compact A \<Longrightarrow> emeasure lborel A < \<infinity>
[PROOF STEP]
by (auto intro: compact_imp_bounded)


[STATEMENT]
lemma ortho_imp_angle_pi_half: "u \<bullet> v = 0 \<Longrightarrow> vangle u v = pi / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<bullet> v = 0 \<Longrightarrow> vangle u v = pi / 2
[PROOF STEP]
using orthogonal_iff_vangle[of u v]
[PROOF STATE]
proof (prove)
using this:
orthogonal u v = (vangle u v = pi / 2)

goal (1 subgoal):
 1. u \<bullet> v = 0 \<Longrightarrow> vangle u v = pi / 2
[PROOF STEP]
by (auto simp: orthogonal_def)


[STATEMENT]
lemma mono_ccSup:
  "countable A \<Longrightarrow> (SUP x\<in>A. f x) \<le> f (Sup A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable A \<Longrightarrow> Sup (f ` A) \<le> f (Sup A)
[PROOF STEP]
using \<open>mono f\<close>
[PROOF STATE]
proof (prove)
using this:
mono f

goal (1 subgoal):
 1. countable A \<Longrightarrow> Sup (f ` A) \<le> f (Sup A)
[PROOF STEP]
by (auto intro: countable_complete_lattice_class.ccSUP_least ccSup_upper dest: monoD)


[STATEMENT]
lemma Healthy_subset_member: "\<lbrakk> A \<subseteq> \<lbrakk>H\<rbrakk>\<^sub>H; P \<in> A \<rbrakk> \<Longrightarrow> H(P) = P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> \<lbrakk>H\<rbrakk>\<^sub>H; P \<in> A\<rbrakk> \<Longrightarrow> H P = P
[PROOF STEP]
by (meson Ball_Collect Healthy_if)


[STATEMENT]
lemma bind_apply_cong [fundef_cong]:
  "\<lbrakk> f s = f' s'; \<And>rv st. (rv, st) \<in> fst (f' s') \<Longrightarrow> g rv st = g' rv st \<rbrakk>
       \<Longrightarrow> (f >>= g) s = (f' >>= g') s'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f s = f' s'; \<And>rv st. (rv, st) \<in> fst (f' s') \<Longrightarrow> g rv st = g' rv st\<rbrakk> \<Longrightarrow> (f >>= g) s = (f' >>= g') s'
[PROOF STEP]
apply (simp add: bind_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f s = f' s'; \<And>rv st. (rv, st) \<in> fst (f' s') \<Longrightarrow> g rv st = g' rv st\<rbrakk> \<Longrightarrow> (\<Union>x\<in>fst (f' s'). fst (case x of (x, xa) \<Rightarrow> g x xa)) = (\<Union>a\<in>fst (f' s'). fst (case a of (x, xa) \<Rightarrow> g' x xa)) \<and> ((\<exists>x\<in>fst (f' s'). snd (case x of (x, xa) \<Rightarrow> g x xa)) \<or> snd (f' s')) = ((\<exists>x\<in>fst (f' s'). snd (case x of (x, xa) \<Rightarrow> g' x xa)) \<or> snd (f' s'))
[PROOF STEP]
apply (auto simp: split_def intro: SUP_cong [OF refl] intro: rev_image_eqI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sorted_rev_iff_nth_Suc:
  "sorted (rev xs) \<longleftrightarrow> (\<forall>i.  Suc i < length xs \<longrightarrow> xs!(Suc i) \<le> xs!i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (rev xs) = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! Suc i \<le> xs ! i)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted (rev xs) = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! Suc i \<le> xs ! i)
[PROOF STEP]
interpret dual: linorder "(\<lambda>x y. y \<le> x)" "(\<lambda>x y. y < x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.linorder (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)
[PROOF STEP]
using dual_linorder
[PROOF STATE]
proof (prove)
using this:
class.linorder (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)

goal (1 subgoal):
 1. class.linorder (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted (rev xs) = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! Suc i \<le> xs ! i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (rev xs) = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! Suc i \<le> xs ! i)
[PROOF STEP]
using dual_linorder dual.sorted_iff_nth_Suc dual.sorted_iff_nth_mono
[PROOF STATE]
proof (prove)
using this:
class.linorder (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)
sorted_wrt (\<lambda>x y. y \<le> x) ?xs = (\<forall>i. Suc i < length ?xs \<longrightarrow> ?xs ! Suc i \<le> ?xs ! i)
sorted_wrt (\<lambda>x y. y \<le> x) ?xs = (\<forall>i j. i \<le> j \<longrightarrow> j < length ?xs \<longrightarrow> ?xs ! j \<le> ?xs ! i)

goal (1 subgoal):
 1. sorted (rev xs) = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! Suc i \<le> xs ! i)
[PROOF STEP]
unfolding sorted_rev_iff_nth_mono
[PROOF STATE]
proof (prove)
using this:
class.linorder (\<lambda>x y. y \<le> x) (\<lambda>x y. y < x)
sorted_wrt (\<lambda>x y. y \<le> x) ?xs = (\<forall>i. Suc i < length ?xs \<longrightarrow> ?xs ! Suc i \<le> ?xs ! i)
sorted_wrt (\<lambda>x y. y \<le> x) ?xs = (\<forall>i j. i \<le> j \<longrightarrow> j < length ?xs \<longrightarrow> ?xs ! j \<le> ?xs ! i)

goal (1 subgoal):
 1. (\<forall>i j. i \<le> j \<longrightarrow> j < length xs \<longrightarrow> xs ! j \<le> xs ! i) = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! Suc i \<le> xs ! i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted (rev xs) = (\<forall>i. Suc i < length xs \<longrightarrow> xs ! Suc i \<le> xs ! i)

goal:
No subgoals!
[PROOF STEP]
qed