[STATEMENT]
lemma merge_strict_subtree_nocontr_sucs:
  assumes "\<And>t2 r1 t1 e1. \<lbrakk>t2 \<in> fst ` fset (sucs t0); is_subtree (Node r1 {|(t1,e1)|}) t2\<rbrakk>
            \<Longrightarrow> rank (rev r1) \<le> rank (rev (root t1))"
      and "strict_subtree (Node r1 {|(t1,e1)|}) (merge t0)"
    shows "rank (rev r1) \<le> rank (rev (root t1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (rev r1) \<le> rank (rev (dtree.root t1))
[PROOF STEP]
using merge_strict_subtree_nocontr[of "sucs t0" r1 t1 e1 "root t0"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>t2 r1 t1 e1. \<lbrakk>t2 \<in> fst ` fset (sucs t0); is_subtree (Node r1 {|(t1, e1)|}) t2\<rbrakk> \<Longrightarrow> rank (rev r1) \<le> rank (rev (dtree.root t1)); strict_subtree (Node r1 {|(t1, e1)|}) (merge (Node (dtree.root t0) (sucs t0)))\<rbrakk> \<Longrightarrow> rank (rev r1) \<le> rank (rev (dtree.root t1))
\<lbrakk>?t2.0 \<in> fst ` fset (sucs t0); is_subtree (Node ?r1.0 {|(?t1.0, ?e1.0)|}) ?t2.0\<rbrakk> \<Longrightarrow> rank (rev ?r1.0) \<le> rank (rev (dtree.root ?t1.0))
strict_subtree (Node r1 {|(t1, e1)|}) (merge t0)

goal (1 subgoal):
 1. rank (rev r1) \<le> rank (rev (dtree.root t1))
[PROOF STEP]
by simp


[STATEMENT]
lemma Un_dir_image:
"dir_image (r1 \<union> r2) f = (dir_image r1 f) \<union> (dir_image r2 f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dir_image (r1 \<union> r2) f = dir_image r1 f \<union> dir_image r2 f
[PROOF STEP]
unfolding dir_image_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(f a, f b) |a b. (a, b) \<in> r1 \<union> r2} = {(f a, f b) |a b. (a, b) \<in> r1} \<union> {(f a, f b) |a b. (a, b) \<in> r2}
[PROOF STEP]
by auto


[STATEMENT]
lemma split_maxD:
  "\<lbrakk> split_max t = (t',x); t \<noteq> Leaf; invar t \<rbrakk> \<Longrightarrow> inorder t' @ [x] = inorder t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>split_max t = (t', x); t \<noteq> \<langle>\<rangle>; invar t\<rbrakk> \<Longrightarrow> Tree2.inorder t' @ [x] = Tree2.inorder t
[PROOF STEP]
by(induction t arbitrary: t' rule: split_max.induct)
  (auto simp: sorted_lems inorder_adjust pre_adj_if_postR post_split_max split: prod.splits)


[STATEMENT]
lemma r_distinguishable_state_pairs_with_separators_sym :
  assumes "(q1,q2) \<in> fst ` r_distinguishable_state_pairs_with_separators M"
  shows "(q2,q1) \<in> fst ` r_distinguishable_state_pairs_with_separators M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (q2, q1) \<in> fst ` r_distinguishable_state_pairs_with_separators M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(q1, q2) \<in> fst ` r_distinguishable_state_pairs_with_separators M

goal (1 subgoal):
 1. (q2, q1) \<in> fst ` r_distinguishable_state_pairs_with_separators M
[PROOF STEP]
unfolding r_distinguishable_state_pairs_with_separators_def
[PROOF STATE]
proof (prove)
using this:
(q1, q2) \<in> fst ` {((q1, q2), Sep) |q1 q2 Sep. q1 \<in> FSM.states M \<and> q2 \<in> FSM.states M \<and> (q1 < q2 \<and> state_separator_from_s_states M q1 q2 = Some Sep \<or> q2 < q1 \<and> state_separator_from_s_states M q2 q1 = Some Sep)}

goal (1 subgoal):
 1. (q2, q1) \<in> fst ` {((q1, q2), Sep) |q1 q2 Sep. q1 \<in> FSM.states M \<and> q2 \<in> FSM.states M \<and> (q1 < q2 \<and> state_separator_from_s_states M q1 q2 = Some Sep \<or> q2 < q1 \<and> state_separator_from_s_states M q2 q1 = Some Sep)}
[PROOF STEP]
by force


[STATEMENT]
lemma matching_sel1_if_no_arc: "matching_sel sf \<Longrightarrow> \<not>(x \<rightarrow>\<^bsub>G\<^esub> y \<or> y \<rightarrow>\<^bsub>G\<^esub> x) \<Longrightarrow> sf x y = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>matching_sel sf; \<not> (x \<rightarrow> y \<or> y \<rightarrow> x)\<rbrakk> \<Longrightarrow> sf x y = 1
[PROOF STEP]
using not_arc_sel_1
[PROOF STATE]
proof (prove)
using this:
?e \<notin> arcs G \<Longrightarrow> sel ?e = 1

goal (1 subgoal):
 1. \<lbrakk>matching_sel sf; \<not> (x \<rightarrow> y \<or> y \<rightarrow> x)\<rbrakk> \<Longrightarrow> sf x y = 1
[PROOF STEP]
unfolding arcs_ends_def arc_to_ends_def matching_sel_def image_iff
[PROOF STATE]
proof (prove)
using this:
?e \<notin> arcs G \<Longrightarrow> sel ?e = 1

goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. (\<exists>e. tail G e = x \<and> head G e = y \<and> sf x y = sel e) \<or> (\<nexists>e. tail G e = x \<and> head G e = y) \<and> sf x y = 1; \<not> ((\<exists>xa\<in>arcs G. (x, y) = (tail G xa, head G xa)) \<or> (\<exists>xa\<in>arcs G. (y, x) = (tail G xa, head G xa)))\<rbrakk> \<Longrightarrow> sf x y = 1
[PROOF STEP]
by metis


[STATEMENT]
lemma (in PolynRg) polyn_deg_add4:"\<lbrakk>p \<in> carrier R; q \<in> carrier R;
      (deg R S X p) \<le> (an n); (deg R S X q) \<le> (an n)\<rbrakk>  \<Longrightarrow>
                    deg R S X (p \<plusminus> q) \<le> (an n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p \<le> an n; deg R S X q \<le> an n\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) \<le> an n
[PROOF STEP]
apply (cut_tac ring_is_ag)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p \<le> an n; deg R S X q \<le> an n; aGroup R\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) \<le> an n
[PROOF STEP]
apply (case_tac "p = \<zero>\<^bsub>R\<^esub>", simp add:aGroup.ag_l_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p \<le> an n; deg R S X q \<le> an n; aGroup R; p \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) \<le> an n
[PROOF STEP]
apply (case_tac "q =  \<zero>\<^bsub>R\<^esub>", simp add:aGroup.ag_r_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p \<le> an n; deg R S X q \<le> an n; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) \<le> an n
[PROOF STEP]
apply (case_tac "p \<plusminus>\<^bsub>R\<^esub> q = \<zero>\<^bsub>R\<^esub>", simp add:deg_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p \<le> an n; deg R S X q \<le> an n; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>; p \<plusminus> q \<noteq> \<zero>\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) \<le> an n
[PROOF STEP]
apply (frule aGroup.ag_pOp_closed[of R p q], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg R S X p \<le> an n; deg R S X q \<le> an n; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>; p \<plusminus> q \<noteq> \<zero>; p \<plusminus> q \<in> carrier R\<rbrakk> \<Longrightarrow> deg R S X (p \<plusminus> q) \<le> an n
[PROOF STEP]
apply (simp add:deg_an)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; an (deg_n R S X p) \<le> an n; an (deg_n R S X q) \<le> an n; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>; p \<plusminus> q \<noteq> \<zero>; p \<plusminus> q \<in> carrier R\<rbrakk> \<Longrightarrow> an (deg_n R S X (p \<plusminus> q)) \<le> an n
[PROOF STEP]
apply (simp only:ale_natle)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<in> carrier R; q \<in> carrier R; deg_n R S X p \<le> n; deg_n R S X q \<le> n; aGroup R; p \<noteq> \<zero>; q \<noteq> \<zero>; p \<plusminus> q \<noteq> \<zero>; p \<plusminus> q \<in> carrier R\<rbrakk> \<Longrightarrow> deg_n R S X (p \<plusminus> q) \<le> n
[PROOF STEP]
apply (simp add:polyn_deg_add3)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in Module) finitesum_pOp_closed:
 "\<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; a \<in> finitesum M I f;  b \<in> finitesum M I f\<rbrakk>
           \<Longrightarrow>  a \<plusminus> b \<in> finitesum M I f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; a \<in> finitesum M I f; b \<in> finitesum M I f\<rbrakk> \<Longrightarrow> a \<plusminus> b \<in> finitesum M I f
[PROOF STEP]
apply (simp add:finitesum_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; \<exists>n g. g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f \<and> a = \<Sigma>\<^sub>e M g n; \<exists>n g. g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f \<and> b = \<Sigma>\<^sub>e M g n\<rbrakk> \<Longrightarrow> \<exists>n g. g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f \<and> a \<plusminus> b = \<Sigma>\<^sub>e M g n
[PROOF STEP]
apply ((erule exE)+, (erule conjE)+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na g ga. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f; a = \<Sigma>\<^sub>e M g n; ga \<in> {j. j \<le> na} \<rightarrow> finitesum_base M I f; b = \<Sigma>\<^sub>e M ga na\<rbrakk> \<Longrightarrow> \<exists>n g. g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f \<and> a \<plusminus> b = \<Sigma>\<^sub>e M g n
[PROOF STEP]
apply (frule_tac f = g and n = n and A = "finitesum_base M I f" and
       g = ga and m = na and B = "finitesum_base M I f" in jointfun_hom0,
       assumption+, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na g ga. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f; a = \<Sigma>\<^sub>e M g n; ga \<in> {j. j \<le> na} \<rightarrow> finitesum_base M I f; b = \<Sigma>\<^sub>e M ga na; jointfun n g na ga \<in> {l. l \<le> Suc (n + na)} \<rightarrow> finitesum_base M I f\<rbrakk> \<Longrightarrow> \<exists>nb gb. gb \<in> {j. j \<le> nb} \<rightarrow> finitesum_base M I f \<and> \<Sigma>\<^sub>e M g n \<plusminus> \<Sigma>\<^sub>e M ga na = \<Sigma>\<^sub>e M gb nb
[PROOF STEP]
apply (cut_tac finitesumbase_sub_carrier[of f I],
       cut_tac n1 = n and f1 = g and m1 = na and g1 = ga in
                 nsum_add_nm[THEN sym], rule allI, rule impI,
       frule_tac x = j and f = g and A = "{j. j \<le> n}" and
        B = "finitesum_base M I f" in funcset_mem, simp,
       simp add:subsetD,
       rule allI, rule impI,
       frule_tac x = j and f = ga and A = "{j. j \<le> na}" and
        B = "finitesum_base M I f" in funcset_mem, simp,
       simp add:subsetD)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n na g ga. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f; a = \<Sigma>\<^sub>e M g n; ga \<in> {j. j \<le> na} \<rightarrow> finitesum_base M I f; b = \<Sigma>\<^sub>e M ga na; jointfun n g na ga \<in> {l. l \<le> Suc (n + na)} \<rightarrow> finitesum_base M I f; finitesum_base M I f \<subseteq> carrier M; \<Sigma>\<^sub>e M g n \<plusminus> \<Sigma>\<^sub>e M ga na = \<Sigma>\<^sub>e M jointfun n g na ga Suc (n + na)\<rbrakk> \<Longrightarrow> \<exists>nb gb. gb \<in> {j. j \<le> nb} \<rightarrow> finitesum_base M I f \<and> \<Sigma>\<^sub>e M g n \<plusminus> \<Sigma>\<^sub>e M ga na = \<Sigma>\<^sub>e M gb nb
 2. \<And>n na g ga. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f; a = \<Sigma>\<^sub>e M g n; ga \<in> {j. j \<le> na} \<rightarrow> finitesum_base M I f; b = \<Sigma>\<^sub>e M ga na; jointfun n g na ga \<in> {l. l \<le> Suc (n + na)} \<rightarrow> finitesum_base M I f\<rbrakk> \<Longrightarrow> f \<in> I \<rightarrow> {X. submodule R M X}
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n na g ga. \<lbrakk>f \<in> I \<rightarrow> {X. submodule R M X}; g \<in> {j. j \<le> n} \<rightarrow> finitesum_base M I f; a = \<Sigma>\<^sub>e M g n; ga \<in> {j. j \<le> na} \<rightarrow> finitesum_base M I f; b = \<Sigma>\<^sub>e M ga na; jointfun n g na ga \<in> {l. l \<le> Suc (n + na)} \<rightarrow> finitesum_base M I f\<rbrakk> \<Longrightarrow> f \<in> I \<rightarrow> {X. submodule R M X}
[PROOF STEP]
apply assumption
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma suminf_pos: "summable f \<Longrightarrow> (\<And>n. 0 < f n) \<Longrightarrow> 0 < suminf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>n. (0::'a) < f n\<rbrakk> \<Longrightarrow> (0::'a) < suminf f
[PROOF STEP]
by (intro suminf_pos2[where i=0]) (auto intro: less_imp_le)


[STATEMENT]
theorem dual_star_comp_fix: "x^\<otimes> * y = (x * (x^\<otimes>) * y) \<squnion> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^ \<otimes> * y = x * x ^ \<otimes> * y \<squnion> y
[PROOF STEP]
apply (subst dual_star_fix)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x * x ^ \<otimes> \<squnion> (1::'a)) * y = x * x ^ \<otimes> * y \<squnion> y
[PROOF STEP]
by (simp add: sup_comp)


[STATEMENT]
lemma Im_complex_of_real [simp]: "Im (complex_of_real z) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Im (complex_of_real z) = 0
[PROOF STEP]
by (simp add: of_real_def)


[STATEMENT]
lemma Hermite_reduce_above_works:
  assumes n: "n \<le> to_nat i" and a: "to_nat a < n"
  shows "(Hermite_reduce_above A n i j res) $ a $ b
         = row_add A a i ((res (A$i$j) (A$a$j) - (A$a$j)) div (A$i$j)) $ a $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
using n a
[PROOF STATE]
proof (prove)
using this:
n \<le> mod_type_class.to_nat i
mod_type_class.to_nat a < n

goal (1 subgoal):
 1. Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
proof (induct n arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < 0\<rbrakk> \<Longrightarrow> Hermite_reduce_above A 0 i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b; Suc n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < Suc n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 \<le> mod_type_class.to_nat i
mod_type_class.to_nat a < 0

goal (2 subgoals):
 1. \<And>A. \<lbrakk>0 \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < 0\<rbrakk> \<Longrightarrow> Hermite_reduce_above A 0 i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b; Suc n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < Suc n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 \<le> mod_type_class.to_nat i
mod_type_class.to_nat a < 0

goal (1 subgoal):
 1. Hermite_reduce_above A 0 i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
by (simp add: row_add_def)
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A 0 i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b; Suc n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < Suc n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b; Suc n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < Suc n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above ?A n i j res $ a $ b = row_add ?A a i ((res (?A $ i $ j) (?A $ a $ j) - ?A $ a $ j) div ?A $ i $ j) $ a $ b
Suc n \<le> mod_type_class.to_nat i
mod_type_class.to_nat a < Suc n

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b; Suc n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < Suc n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
define A' where "A' = row_add A (from_nat n) i
    ((res (A $ i $ j) (A $ from_nat n $ j) - A $ from_nat n $ j) div A $ i $ j)"
[PROOF STATE]
proof (state)
this:
A' = row_add A (mod_type_class.from_nat n) i ((res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j)

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b; Suc n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < Suc n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
have n: "n < nrows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < nrows A
[PROOF STEP]
unfolding nrows_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < CARD('a)
[PROOF STEP]
by (metis Suc.prems(1) Suc_le_eq less_trans to_nat_less_card)
[PROOF STATE]
proof (state)
this:
n < nrows A

goal (1 subgoal):
 1. \<And>n A. \<lbrakk>\<And>A. \<lbrakk>n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A n i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b; Suc n \<le> mod_type_class.to_nat i; mod_type_class.to_nat a < Suc n\<rbrakk> \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
proof (cases "to_nat a = n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat a \<noteq> n

goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
have a_less_n: "to_nat a < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.to_nat a < n
[PROOF STEP]
by (metis False Suc.prems(2) less_antisym)
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat a < n

goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
have "Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b
[PROOF STEP]
by (simp add: Let_def A'_def)
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b

goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b

goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
have "... = row_add A' a i ((res (A' $ i $ j) (A' $ a $ j) - A' $ a $ j) div A' $ i $ j) $ a $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_reduce_above A' n i j res $ a $ b = row_add A' a i ((res (A' $ i $ j) (A' $ a $ j) - A' $ a $ j) div A' $ i $ j) $ a $ b
[PROOF STEP]
by (rule Suc.hyps[OF _  a_less_n], simp add: Suc.prems(1) Suc_leD)
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A' n i j res $ a $ b = row_add A' a i ((res (A' $ i $ j) (A' $ a $ j) - A' $ a $ j) div A' $ i $ j) $ a $ b

goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A' n i j res $ a $ b = row_add A' a i ((res (A' $ i $ j) (A' $ a $ j) - A' $ a $ j) div A' $ i $ j) $ a $ b

goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
have "... = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_add A' a i ((res (A' $ i $ j) (A' $ a $ j) - A' $ a $ j) div A' $ i $ j) $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
unfolding row_add_def A'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<chi>ia ja. if ia = a then (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ ja + (res ((\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ i $ j) ((\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ j) - (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ j) div (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ i $ j * (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ i $ ja else (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ ia $ ja) $ a $ b = (\<chi>ia ja. if ia = a then A $ a $ ja + (res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ b
[PROOF STEP]
using a_less_n Suc.prems n to_nat_from_nat_id[OF n[unfolded nrows_def]]
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat a < n
Suc n \<le> mod_type_class.to_nat i
mod_type_class.to_nat a < Suc n
n < nrows A
mod_type_class.to_nat (mod_type_class.from_nat n) = n

goal (1 subgoal):
 1. (\<chi>ia ja. if ia = a then (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ ja + (res ((\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ i $ j) ((\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ j) - (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ j) div (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ i $ j * (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ i $ ja else (\<chi>ia ja. if ia = mod_type_class.from_nat n then A $ mod_type_class.from_nat n $ ja + (res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ ia $ ja) $ a $ b = (\<chi>ia ja. if ia = a then A $ a $ ja + (res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j * A $ i $ ja else A $ ia $ ja) $ a $ b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_add A' a i ((res (A' $ i $ j) (A' $ a $ j) - A' $ a $ j) div A' $ i $ j) $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b

goal (2 subgoals):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
 2. mod_type_class.to_nat a \<noteq> n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b

goal (1 subgoal):
 1. Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b

goal (1 subgoal):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat a = n

goal (1 subgoal):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
hence a_eq_fn_n: "a = from_nat n"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat a = n

goal (1 subgoal):
 1. a = mod_type_class.from_nat n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = mod_type_class.from_nat n

goal (1 subgoal):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
have "Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b
[PROOF STEP]
by (simp add: Let_def A'_def)
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b

goal (1 subgoal):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = Hermite_reduce_above A' n i j res $ a $ b

goal (1 subgoal):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
have "... = A' $ a $ b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_reduce_above A' n i j res $ a $ b = A' $ a $ b
[PROOF STEP]
by (rule Hermite_reduce_above_preserves, simp add: True)
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A' n i j res $ a $ b = A' $ a $ b

goal (1 subgoal):
 1. mod_type_class.to_nat a = n \<Longrightarrow> Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = A' $ a $ b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = A' $ a $ b

goal (1 subgoal):
 1. Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b
[PROOF STEP]
unfolding A'_def a_eq_fn_n
[PROOF STATE]
proof (prove)
using this:
Hermite_reduce_above A (Suc n) i j res $ mod_type_class.from_nat n $ b = row_add A (mod_type_class.from_nat n) i ((res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j) $ mod_type_class.from_nat n $ b

goal (1 subgoal):
 1. Hermite_reduce_above A (Suc n) i j res $ mod_type_class.from_nat n $ b = row_add A (mod_type_class.from_nat n) i ((res (A $ i $ j) (A $ mod_type_class.from_nat n $ j) - A $ mod_type_class.from_nat n $ j) div A $ i $ j) $ mod_type_class.from_nat n $ b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Hermite_reduce_above A (Suc n) i j res $ a $ b = row_add A a i ((res (A $ i $ j) (A $ a $ j) - A $ a $ j) div A $ i $ j) $ a $ b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aHom_compos:"\<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N \<rbrakk>
  \<Longrightarrow> compos L g f \<in> aHom L N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> aHom L N
[PROOF STEP]
apply (simp add:aHom_def [of "L" "N"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> carrier L \<rightarrow> carrier N \<and> compos L g f \<in> extensional (carrier L) \<and> (\<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> carrier L \<rightarrow> carrier N
 2. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> extensional (carrier L) \<and> (\<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b)
[PROOF STEP]
apply (rule Pi_I)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; x \<in> carrier L\<rbrakk> \<Longrightarrow> compos L g f x \<in> carrier N
 2. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> extensional (carrier L) \<and> (\<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b)
[PROOF STEP]
apply (simp add:compos_def compose_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; x \<in> carrier L\<rbrakk> \<Longrightarrow> g (f x) \<in> carrier N
 2. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> extensional (carrier L) \<and> (\<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b)
[PROOF STEP]
apply (rule aHom_mem [of "M" "N" "g"], assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; x \<in> carrier L\<rbrakk> \<Longrightarrow> f x \<in> carrier M
 2. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> extensional (carrier L) \<and> (\<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b)
[PROOF STEP]
apply (simp add:aHom_mem [of "L" "M" "f"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> extensional (carrier L) \<and> (\<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b)
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> compos L g f \<in> extensional (carrier L)
 2. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b
[PROOF STEP]
apply (simp add:compos_def compose_def extensional_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N\<rbrakk> \<Longrightarrow> \<forall>a\<in>carrier L. \<forall>b\<in>carrier L. compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b
[PROOF STEP]
apply (rule ballI)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; a \<in> carrier L; b \<in> carrier L\<rbrakk> \<Longrightarrow> compos L g f (a \<plusminus>\<^bsub>L\<^esub> b) = compos L g f a \<plusminus>\<^bsub>N\<^esub> compos L g f b
[PROOF STEP]
apply (simp add:compos_def compose_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; a \<in> carrier L; b \<in> carrier L\<rbrakk> \<Longrightarrow> (a \<plusminus>\<^bsub>L\<^esub> b \<in> carrier L \<longrightarrow> g (f (a \<plusminus>\<^bsub>L\<^esub> b)) = g (f a) \<plusminus>\<^bsub>N\<^esub> g (f b)) \<and> (a \<plusminus>\<^bsub>L\<^esub> b \<notin> carrier L \<longrightarrow> undefined = g (f a) \<plusminus>\<^bsub>N\<^esub> g (f b))
[PROOF STEP]
apply (simp add:aGroup.ag_pOp_closed)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; a \<in> carrier L; b \<in> carrier L\<rbrakk> \<Longrightarrow> g (f (a \<plusminus>\<^bsub>L\<^esub> b)) = g (f a) \<plusminus>\<^bsub>N\<^esub> g (f b)
[PROOF STEP]
apply (simp add:aHom_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; a \<in> carrier L; b \<in> carrier L\<rbrakk> \<Longrightarrow> g (f a \<plusminus>\<^bsub>M\<^esub> f b) = g (f a) \<plusminus>\<^bsub>N\<^esub> g (f b)
[PROOF STEP]
apply (rule aHom_add, assumption+)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; a \<in> carrier L; b \<in> carrier L\<rbrakk> \<Longrightarrow> f a \<in> carrier M
 2. \<And>a b. \<lbrakk>aGroup L; aGroup M; aGroup N; f \<in> aHom L M; g \<in> aHom M N; a \<in> carrier L; b \<in> carrier L\<rbrakk> \<Longrightarrow> f b \<in> carrier M
[PROOF STEP]
apply (simp add:aHom_mem)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma f_Streams_Connected_nth_conv: "
  f_Streams_Connected outS inS =
  (length inS = Suc (length outS) \<and>
  (\<forall>i<length inS. inS ! i = (case i of 0 \<Rightarrow> \<NoMsg> | Suc k \<Rightarrow> outS ! k)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f_Streams_Connected outS inS = (length inS = Suc (length outS) \<and> (\<forall>i<length inS. inS ! i = (case i of 0 \<Rightarrow> NoMsg | Suc k \<Rightarrow> outS ! k)))
[PROOF STEP]
by (simp add: f_Streams_Connected_def list_eq_iff nth_Cons)


[STATEMENT]
lemma is_constant_seqE:
  assumes "is_constant_seq R s"
  assumes "s k = a"
  shows "s n = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s n = a
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_constant_seq R s
s k = a

goal (1 subgoal):
 1. s n = a
[PROOF STEP]
unfolding is_constant_seq_def
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>carrier R. s = constant_function UNIV x
s k = a

goal (1 subgoal):
 1. s n = a
[PROOF STEP]
by (metis constant_function_def restrict_UNIV)


[STATEMENT]
lemma cbox_max_dist:
  assumes "p\<^sub>0 = (x, y)" "p\<^sub>1 = (x + \<delta>, y + \<delta>)"
  assumes "(x\<^sub>0, y\<^sub>0) \<in> cbox p\<^sub>0 p\<^sub>1" "(x\<^sub>1, y\<^sub>1) \<in> cbox p\<^sub>0 p\<^sub>1" "0 \<le> \<delta>"
  shows "dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
have X: "dist x\<^sub>0 x\<^sub>1 \<le> \<delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x\<^sub>0 x\<^sub>1 \<le> \<delta>
[PROOF STEP]
using assms dist_real_def
[PROOF STATE]
proof (prove)
using this:
p\<^sub>0 = (x, y)
p\<^sub>1 = (x + \<delta>, y + \<delta>)
(x\<^sub>0, y\<^sub>0) \<in> cbox p\<^sub>0 p\<^sub>1
(x\<^sub>1, y\<^sub>1) \<in> cbox p\<^sub>0 p\<^sub>1
0 \<le> \<delta>
dist ?x ?y = \<bar>?x - ?y\<bar>

goal (1 subgoal):
 1. dist x\<^sub>0 x\<^sub>1 \<le> \<delta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist x\<^sub>0 x\<^sub>1 \<le> \<delta>

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
have Y: "dist y\<^sub>0 y\<^sub>1 \<le> \<delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist y\<^sub>0 y\<^sub>1 \<le> \<delta>
[PROOF STEP]
using assms dist_real_def
[PROOF STATE]
proof (prove)
using this:
p\<^sub>0 = (x, y)
p\<^sub>1 = (x + \<delta>, y + \<delta>)
(x\<^sub>0, y\<^sub>0) \<in> cbox p\<^sub>0 p\<^sub>1
(x\<^sub>1, y\<^sub>1) \<in> cbox p\<^sub>0 p\<^sub>1
0 \<le> \<delta>
dist ?x ?y = \<bar>?x - ?y\<bar>

goal (1 subgoal):
 1. dist y\<^sub>0 y\<^sub>1 \<le> \<delta>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist y\<^sub>0 y\<^sub>1 \<le> \<delta>

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
have "dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) = sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) = sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)
[PROOF STEP]
using dist_Pair_Pair
[PROOF STATE]
proof (prove)
using this:
dist (?a, ?b) (?c, ?d) = sqrt ((dist ?a ?c)\<^sup>2 + (dist ?b ?d)\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) = sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) = sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) = sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
have "... \<le> sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)
[PROOF STEP]
using X power_mono
[PROOF STATE]
proof (prove)
using this:
dist x\<^sub>0 x\<^sub>1 \<le> \<delta>
\<lbrakk>?a \<le> ?b; (0::?'a) \<le> ?a\<rbrakk> \<Longrightarrow> ?a ^ ?n \<le> ?b ^ ?n

goal (1 subgoal):
 1. sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt ((dist x\<^sub>0 x\<^sub>1)\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
have "... \<le> sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2)
[PROOF STEP]
using Y power_mono
[PROOF STATE]
proof (prove)
using this:
dist y\<^sub>0 y\<^sub>1 \<le> \<delta>
\<lbrakk>?a \<le> ?b; (0::?'a) \<le> ?a\<rbrakk> \<Longrightarrow> ?a ^ ?n \<le> ?b ^ ?n

goal (1 subgoal):
 1. sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (\<delta>\<^sup>2 + (dist y\<^sub>0 y\<^sub>1)\<^sup>2) \<le> sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
have "... = sqrt 2 * sqrt (\<delta>\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2) = sqrt 2 * sqrt (\<delta>\<^sup>2)
[PROOF STEP]
using real_sqrt_mult
[PROOF STATE]
proof (prove)
using this:
sqrt (?x * ?y) = sqrt ?x * sqrt ?y

goal (1 subgoal):
 1. sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2) = sqrt 2 * sqrt (\<delta>\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2) = sqrt 2 * sqrt (\<delta>\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt (\<delta>\<^sup>2 + \<delta>\<^sup>2) = sqrt 2 * sqrt (\<delta>\<^sup>2)

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
have "... = sqrt 2 * \<delta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt 2 * sqrt (\<delta>\<^sup>2) = sqrt 2 * \<delta>
[PROOF STEP]
using assms(5)
[PROOF STATE]
proof (prove)
using this:
0 \<le> \<delta>

goal (1 subgoal):
 1. sqrt 2 * sqrt (\<delta>\<^sup>2) = sqrt 2 * \<delta>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sqrt 2 * sqrt (\<delta>\<^sup>2) = sqrt 2 * \<delta>

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>

goal (1 subgoal):
 1. dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist (x\<^sub>0, y\<^sub>0) (x\<^sub>1, y\<^sub>1) \<le> sqrt 2 * \<delta>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma line_left_inter_1:
  assumes "P \<in> line_ext l" and "P \<notin> line_ext m"
  shows "line (inter l m) P = l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. line (local.inter l m) P = l
[PROOF STEP]
by (metis CollectD CollectI assms(1) assms(2) incidA_lAB incidB_lAB incid_inter_left
      incid_inter_right line_ext_def uniq_inter)


[STATEMENT]
lemma set_times_rearrange3: "(a *o B) * C = a *o (B * C)"
  for a :: "'a::semigroup_mult"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a *o B * C = a *o (B * C)
[PROOF STEP]
by (auto simp add: elt_set_times_def set_times_def; metis mult.assoc)


[STATEMENT]
lemma real_linear:
  assumes "is_real a" and "is_real b" shows "a < b \<or> a = b \<or> b < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < b \<or> a = b \<or> b < a
[PROOF STEP]
using pos_pos_linear neg_neg_linear assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(0::'a) < ?a; (0::'a) < ?b\<rbrakk> \<Longrightarrow> ?a < ?b \<or> ?a = ?b \<or> ?b < ?a
\<lbrakk>?a < (0::'a); ?b < (0::'a)\<rbrakk> \<Longrightarrow> ?a < ?b \<or> ?a = ?b \<or> ?b < ?a
is_real a
is_real b

goal (1 subgoal):
 1. a < b \<or> a = b \<or> b < a
[PROOF STEP]
by (auto dest: less_trans[of _ 0])


[STATEMENT]
lemma (in semiring_hom) matrix_vector_mult_hom:
  "(map_matrix hom A) *v (map_vector hom v) = map_vector hom (A *v v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. HMA_Connect.map_matrix hom A *v map_vector hom v = map_vector hom (A *v v)
[PROOF STEP]
by (transfer fixing: hom, auto simp: mult_mat_vec_hom)


[STATEMENT]
lemma mat_cols_hom_lim_distinct_iff:
  assumes "elements_mat M \<subseteq> A"
  shows "distinct (cols M) \<longleftrightarrow> distinct (map (map_vec f) (cols M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (cols M) = distinct (map (map_vec f) (cols M))
[PROOF STEP]
apply (intro vec_hom_lim_set_distinct_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. v \<in> set (cols M) \<Longrightarrow> set\<^sub>v v \<subseteq> A
[PROOF STEP]
using setv_col_subset_mat_elems assms
[PROOF STATE]
proof (prove)
using this:
?v \<in> set (cols ?M) \<Longrightarrow> set\<^sub>v ?v \<subseteq> elements_mat ?M
elements_mat M \<subseteq> A

goal (1 subgoal):
 1. \<And>v. v \<in> set (cols M) \<Longrightarrow> set\<^sub>v v \<subseteq> A
[PROOF STEP]
by blast


[STATEMENT]
lemma lsided_def3: "(\<nu> (x::'a::unital_quantale) = x) = (\<nu>\<^sup>\<natural> x = x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nu> x = x) = (\<nu>\<^sup>\<natural> x = x)
[PROOF STEP]
unfolding lsl_def lsu_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<top> \<cdot> x = x) = (\<top> \<rightarrow> x = x)
[PROOF STEP]
by (metis lsided_eq lsided_eq_var2 slsd_def)


[STATEMENT]
lemma (in encoding) indRelRST_to_TRel:
  fixes SRel  :: "('procS \<times> 'procS) set"
    and TRel  :: "('procT \<times> 'procT) set"
    and TP TQ :: "'procT"
  assumes rel: "TargetTerm TP \<R>\<lbrakk>\<cdot>\<rbrakk>R<SRel,TRel> TargetTerm TQ"
  shows "(TP, TQ) \<in> TRel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (TP, TQ) \<in> TRel
[PROOF STEP]
using rel
[PROOF STATE]
proof (prove)
using this:
TargetTerm TP \<R>\<lbrakk>\<cdot>\<rbrakk>R<SRel,TRel> TargetTerm TQ

goal (1 subgoal):
 1. (TP, TQ) \<in> TRel
[PROOF STEP]
by (simp add: indRelRST.simps)


[STATEMENT]
lemma mult_eSuc': "((m::eint) + 1) * n = n + m * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (m + 1) * n = n + m * n
[PROOF STEP]
using mult_eSuc add.commute
[PROOF STATE]
proof (prove)
using this:
(?m + 1) * ?n = ?m * ?n + ?n
?a + ?b = ?b + ?a

goal (1 subgoal):
 1. (m + 1) * n = n + m * n
[PROOF STEP]
by simp


[STATEMENT]
lemma validity_implies_entailment:
  assumes "\<forall>I. validate_formula I S1 \<longrightarrow> validate_formula I S2"
  shows "entails_formula S1 S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. entails_formula S1 S2
[PROOF STEP]
by (meson assms entails_def entails_formula_def validate_formula.elims(2))


[STATEMENT]
lemma helpypredd:"invar_vebt t n \<Longrightarrow> vebt_pred t x = Some y \<Longrightarrow> y < 2^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; vebt_pred t x = Some y\<rbrakk> \<Longrightarrow> y < 2 ^ n
[PROOF STEP]
using member_bound pred_corr pred_member
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>vebt_member ?tree ?x; invar_vebt ?tree ?n\<rbrakk> \<Longrightarrow> ?x < 2 ^ ?n
invar_vebt ?t ?n \<Longrightarrow> vebt_pred ?t ?x = Some ?px \<equiv> is_pred_in_set (set_vebt' ?t) ?x ?px
is_pred_in_set (set_vebt' ?t) ?x ?y = (vebt_member ?t ?y \<and> ?y < ?x \<and> (\<forall>z. vebt_member ?t z \<and> z < ?x \<longrightarrow> z \<le> ?y))

goal (1 subgoal):
 1. \<lbrakk>invar_vebt t n; vebt_pred t x = Some y\<rbrakk> \<Longrightarrow> y < 2 ^ n
[PROOF STEP]
by blast


[STATEMENT]
lemma decode_instr_result_4 :
"\<not> (\<exists>e. ((decode_instruction v1)::(Exception list + instruction)) = Inl e) \<Longrightarrow>
  (\<exists>v2. ((decode_instruction v1)::(Exception list + instruction)) = Inr v2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>e. decode_instruction v1 = Inl e \<Longrightarrow> \<exists>v2. decode_instruction v1 = Inr v2
[PROOF STEP]
by (meson sumE)


[STATEMENT]
lemma grd_demonic: "grd [:Q:] = {s . \<exists> s' . s' \<in> (Q s) }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. grd [: Q :] = {s. \<exists>s'. s' \<in> Q s}
[PROOF STEP]
apply (simp add: grd_def demonic_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - {s. Q s = {}} = {s. \<exists>s'. s' \<in> Q s}
[PROOF STEP]
by blast


[STATEMENT]
lemma NSLIM_isContc_iff: "f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S f a \<longleftrightarrow> (\<lambda>h. f (a + h)) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S f a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>a\<rightarrow>\<^sub>N\<^sub>S f a = (\<lambda>h. f (a + h)) \<midarrow>0::'a\<rightarrow>\<^sub>N\<^sub>S f a
[PROOF STEP]
by (rule NSLIM_at0_iff)


[STATEMENT]
lemma keys_homogenize:
  "x \<notin> indets p \<Longrightarrow> keys (homogenize x p) = (\<lambda>t. Poly_Mapping.single x (poly_deg p - deg_pm t) + t) ` keys p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<notin> indets p \<Longrightarrow> keys (homogenize x p) = (\<lambda>t. monomial (poly_deg p - deg_pm t) x + t) ` keys p
[PROOF STEP]
by (auto intro: keys_homogenizeI elim: keys_homogenizeE)


[STATEMENT]
lemma geq_imp_mix_geq_right:
  assumes "x \<succeq>[\<R>] y"
  assumes rpr: "rational_preference (lotteries_on outcomes) \<R>"
  assumes ind: "independent_vnm (lotteries_on outcomes) \<R>"
  assumes "\<alpha> \<in> {0..(1::real)}"
  shows "(mix_pmf \<alpha> x y) \<succeq>[\<R>] y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<succeq>[\<R>] y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<succeq>[\<R>] y
[PROOF STEP]
have xy_p: "x \<in> (lotteries_on outcomes)" "y \<in> (lotteries_on outcomes)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> lotteries_on outcomes &&& y \<in> lotteries_on outcomes
[PROOF STEP]
by (meson assms(1) preference.not_outside rational_preference_def rpr)
      (meson assms(1) preference_def rational_preference_def rpr)
[PROOF STATE]
proof (state)
this:
x \<in> lotteries_on outcomes
y \<in> lotteries_on outcomes

goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<succeq>[\<R>] y
[PROOF STEP]
have "(mix_pmf \<alpha> x y) \<in> (lotteries_on outcomes)" (is "?mpf \<in> ?lot")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<in> lotteries_on outcomes
[PROOF STEP]
using mix_pmf_in_lotteries [of x outcomes y \<alpha>] xy_p assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in> lotteries_on outcomes; y \<in> lotteries_on outcomes; \<alpha> \<in> {0<..<1}\<rbrakk> \<Longrightarrow> mix_pmf \<alpha> x y \<in> lotteries_on outcomes
x \<in> lotteries_on outcomes
y \<in> lotteries_on outcomes
rational_preference (lotteries_on outcomes) \<R>

goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<in> lotteries_on outcomes
[PROOF STEP]
by (meson approx_indep_ge assms(4) ind preference.not_outside
        rational_preference.compl rational_preference_def)
[PROOF STATE]
proof (state)
this:
mix_pmf \<alpha> x y \<in> lotteries_on outcomes

goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<succeq>[\<R>] y
[PROOF STEP]
have all: "\<forall>r \<in> ?lot. (mix_pmf \<alpha> x r) \<succeq>[\<R>] (mix_pmf \<alpha> y r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>r\<in>lotteries_on outcomes. mix_pmf \<alpha> x r \<succeq>[\<R>] mix_pmf \<alpha> y r
[PROOF STEP]
by (metis assms assms(2) atLeastAtMost_iff greaterThanAtMost_iff independece_dest_alt
        less_eq_real_def pmf_mix_0 rational_preference.compl rpr ind xy_p)
[PROOF STATE]
proof (state)
this:
\<forall>r\<in>lotteries_on outcomes. mix_pmf \<alpha> x r \<succeq>[\<R>] mix_pmf \<alpha> y r

goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<succeq>[\<R>] y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>r\<in>lotteries_on outcomes. mix_pmf \<alpha> x r \<succeq>[\<R>] mix_pmf \<alpha> y r

goal (1 subgoal):
 1. mix_pmf \<alpha> x y \<succeq>[\<R>] y
[PROOF STEP]
by (metis all assms(4) set_pmf_mix_eq xy_p(2))
[PROOF STATE]
proof (state)
this:
mix_pmf \<alpha> x y \<succeq>[\<R>] y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma M5_modular_def: "M5_lattice a b c = (a \<sqinter> b = b \<sqinter> c \<and> c \<sqinter> a = b \<sqinter> c \<and> a \<squnion> b = b \<squnion> c \<and> c \<squnion> a = b \<squnion> c \<and> a \<sqinter> b < a \<squnion> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M5_lattice a b c = (a \<sqinter> b = b \<sqinter> c \<and> c \<sqinter> a = b \<sqinter> c \<and> a \<squnion> b = b \<squnion> c \<and> c \<squnion> a = b \<squnion> c \<and> a \<sqinter> b < a \<squnion> b)
[PROOF STEP]
by (simp add: M5_lattice_def)


[STATEMENT]
lemma seq_semD':"\<And>P. \<nu> \<in> seq_sem I (\<Gamma>,\<Delta>) \<Longrightarrow> ((\<nu> \<in> fml_sem I (foldr And \<Gamma> TT) \<Longrightarrow> \<nu> \<in> fml_sem I (foldr Or \<Delta> FF)) \<Longrightarrow> P) \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>P. \<lbrakk>\<nu> \<in> seq_sem I (\<Gamma>, \<Delta>); (\<nu> \<in> fml_sem I (foldr (&&) \<Gamma> TT) \<Longrightarrow> \<nu> \<in> fml_sem I (foldr (||) \<Delta> FF)) \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P
[PROOF STEP]
by simp


[STATEMENT]
lemma NR\<^sub>N_bounds:
  fixes u l::nat
  shows "NR\<^sub>N n u l \<le> l * n + u * NH\<^sub>N n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
have "NR\<^sub>N n u l = \<integral>\<^sup>+ x. x \<partial>measure_pmf (R\<^sub>N n u l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NR\<^sub>N n u l = integral\<^sup>N (measure_pmf (R\<^sub>N n u l)) of_nat
[PROOF STEP]
unfolding NR\<^sub>N_def R\<^sub>N_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (real x) \<partial>measure_pmf (map_pmf (\<lambda>f. steps {..<n} f 0 u l) (SL\<^sub>N n)) = integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. steps {..<n} f 0 u l) (SL\<^sub>N n))) of_nat
[PROOF STEP]
by (simp add: ennreal_of_nat_eq_real_of_nat)
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = integral\<^sup>N (measure_pmf (R\<^sub>N n u l)) of_nat

goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l = integral\<^sup>N (measure_pmf (R\<^sub>N n u l)) of_nat

goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
have "\<dots> \<le> \<integral>\<^sup>+ x. x \<partial>(measure_pmf (map_pmf (\<lambda>f. l * n + u * Max\<^sub>0 (f ` {..<n})) (SL\<^sub>N n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (R\<^sub>N n u l)) of_nat \<le> integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL\<^sub>N n))) of_nat
[PROOF STEP]
using of_nat_mono[OF steps_smaller_card_Max_fun'[of "{..<n}" 0 _ u l]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {..<n}; \<exists>x\<in>{..<n}. 0 \<le> ?f1 x\<rbrakk> \<Longrightarrow> of_nat (steps {..<n} ?f1 0 u l + 0 * u) \<le> of_nat (l * card {..<n} + u * Max (?f1 ` {..<n} \<union> {0}))

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (R\<^sub>N n u l)) of_nat \<le> integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL\<^sub>N n))) of_nat
[PROOF STEP]
unfolding R\<^sub>N_alt_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite {..<n}; \<exists>x\<in>{..<n}. 0 \<le> ?f1 x\<rbrakk> \<Longrightarrow> of_nat (steps {..<n} ?f1 0 u l + 0 * u) \<le> of_nat (l * card {..<n} + u * Max (?f1 ` {..<n} \<union> {0}))

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. steps {..<n} f 0 u l) (SL\<^sub>N n))) of_nat \<le> integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL\<^sub>N n))) of_nat
[PROOF STEP]
by (cases "n = 0") (auto intro!: nn_integral_mono)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (R\<^sub>N n u l)) of_nat \<le> integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL\<^sub>N n))) of_nat

goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (R\<^sub>N n u l)) of_nat \<le> integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL\<^sub>N n))) of_nat

goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
have "\<dots> = l * n + u * NH\<^sub>N n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL\<^sub>N n))) of_nat = of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
unfolding NH\<^sub>N_def H\<^sub>N_def H_def SL\<^sub>N_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL {..<n}))) of_nat = of_nat (l * n) + of_nat u * \<integral>\<^sup>+ x. ennreal (real x) \<partial>measure_pmf (map_pmf (\<lambda>f. Max (f ` {..<n} \<union> {0})) (SL {..<n}))
[PROOF STEP]
by (auto simp add: nn_integral_add nn_integral_cmult ennreal_of_nat_eq_real_of_nat ennreal_mult)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (map_pmf (\<lambda>f. l * n + u * Max (f ` {..<n} \<union> {0})) (SL\<^sub>N n))) of_nat = of_nat (l * n) + of_nat u * NH\<^sub>N n

goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
show "NR\<^sub>N n u l \<le> l * n + u * NH\<^sub>N n"
[PROOF STATE]
proof (prove)
using this:
NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n

goal (1 subgoal):
 1. NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
NR\<^sub>N n u l \<le> of_nat (l * n) + of_nat u * NH\<^sub>N n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in monoid) group_l_invI:
  assumes l_inv_ex:
    "!!x. x \<in> carrier G ==> \<exists>y \<in> carrier G. y \<otimes> x = \<one>"
  shows "group G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
by (rule groupI) (auto intro: m_assoc l_inv_ex)


[STATEMENT]
lemma finite_States [simp]:
  "finite (States A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (States A)
[PROOF STEP]
apply (cut_tac Rep_seqauto_select)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (States ?SA1, InitState ?SA1, Labels ?SA1, Delta ?SA1) \<in> seqauto \<Longrightarrow> finite (States A)
[PROOF STEP]
apply (unfold seqauto_def SeqAuto_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (States ?SA1, InitState ?SA1, Labels ?SA1, Delta ?SA1) \<in> {(S, I, L, D) |S I L D. I \<in> S \<and> S \<noteq> {} \<and> finite S \<and> finite D \<and> (\<forall>(s, l, t)\<in>D. s \<in> S \<and> t \<in> S \<and> l \<in> L)} \<Longrightarrow> finite (States A)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eq_cnj_iff_real:
  shows "cnj z = z \<longleftrightarrow> is_real z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cnj z = z) = is_real z
[PROOF STEP]
by (cases z) (simp add: Complex_eq)


[STATEMENT]
lemma sum_goestozero_lemma:
  fixes d::real
  assumes d: "\<bar>\<Sum>i = M..N. a i / i\<bar> < d" and le: "\<And>n. a n + ln n \<le> a (Suc n) + ln (Suc n)"
      and "0 < M" "M < N"
    shows "a M \<le> d * N / (real N - real M) + (real N - real M) / M \<and>
          -a N \<le> d * N / (real N - real M) + (real N - real M) / M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
have "0 \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<bar>\<Sum>i = M..N. a i / real i\<bar> < d
a ?n + ln (real ?n) \<le> a (Suc ?n) + ln (real (Suc ?n))
0 < M
M < N

goal (1 subgoal):
 1. 0 \<le> d
[PROOF STEP]
by linarith+
[PROOF STATE]
proof (state)
this:
0 \<le> d

goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> d
[PROOF STEP]
have "0 \<le> d * N / (N - M + 1)"
[PROOF STATE]
proof (prove)
using this:
0 \<le> d

goal (1 subgoal):
 1. 0 \<le> d * real N / real (N - M + 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> d * real N / real (N - M + 1)

goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> d * real N / real (N - M + 1)
[PROOF STEP]
have le_dN: "\<lbrakk>0 \<le> x \<Longrightarrow> x \<le> d * N / (N - M + 1)\<rbrakk> \<Longrightarrow> x \<le> d * N / (N - M + 1)" for x::real
[PROOF STATE]
proof (prove)
using this:
0 \<le> d * real N / real (N - M + 1)

goal (1 subgoal):
 1. (0 \<le> x \<Longrightarrow> x \<le> d * real N / real (N - M + 1)) \<Longrightarrow> x \<le> d * real N / real (N - M + 1)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
(0 \<le> ?x \<Longrightarrow> ?x \<le> d * real N / real (N - M + 1)) \<Longrightarrow> ?x \<le> d * real N / real (N - M + 1)

goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
have le_a_ln: "a m + ln m \<le> a n + ln n" if "n \<ge> m" for n m
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a m + ln (real m) \<le> a n + ln (real n)
[PROOF STEP]
by (rule transitive_stepwise_le) (use le that in auto)
[PROOF STATE]
proof (state)
this:
?m \<le> ?n \<Longrightarrow> a ?m + ln (real ?m) \<le> a ?n + ln (real ?n)

goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
have *: "x \<le> b \<and> y \<le> b" if "a \<le> b" "x \<le> a" "y \<le> a" for a b x y::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> b \<and> y \<le> b
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
a \<le> b
x \<le> a
y \<le> a

goal (1 subgoal):
 1. x \<le> b \<and> y \<le> b
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<lbrakk>?a \<le> ?b; ?x \<le> ?a; ?y \<le> ?a\<rbrakk> \<Longrightarrow> ?x \<le> ?b \<and> ?y \<le> ?b

goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
proof (rule *)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?a \<le> d * real N / (real N - real M) + (real N - real M) / real M
 2. a M \<le> ?a
 3. - a N \<le> ?a
[PROOF STEP]
show "d * N / (N - M) + ln (N / M) \<le> d * N / (real N - real M) + (real N - real M) / M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d * real N / real (N - M) + ln (real N / real M) \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
using \<open>0 < M\<close> \<open>M < N\<close> ln_le_minus_one [of "N / M"]
[PROOF STATE]
proof (prove)
using this:
0 < M
M < N
0 < real N / real M \<Longrightarrow> ln (real N / real M) \<le> real N / real M - 1

goal (1 subgoal):
 1. d * real N / real (N - M) + ln (real N / real M) \<le> d * real N / (real N - real M) + (real N - real M) / real M
[PROOF STEP]
by (simp add: of_nat_diff) (simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
d * real N / real (N - M) + ln (real N / real M) \<le> d * real N / (real N - real M) + (real N - real M) / real M

goal (2 subgoals):
 1. a M \<le> d * real N / real (N - M) + ln (real N / real M)
 2. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a M \<le> d * real N / real (N - M) + ln (real N / real M)
 2. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
have "a M - ln (N / M) \<le> (d * N) / (N - M + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
proof (rule le_dN)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
assume 0: "0 \<le> a M - ln (N / M)"
[PROOF STATE]
proof (state)
this:
0 \<le> a M - ln (real N / real M)

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
have "(Suc N - M) * (a M - ln (N / M)) / N = (\<Sum>i = M..N. (a M - ln (N / M)) / N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (Suc N - M) * (a M - ln (real N / real M)) / real N = (\<Sum>i = M..N. (a M - ln (real N / real M)) / real N)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N = (\<Sum>i = M..N. (a M - ln (real N / real M)) / real N)

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N = (\<Sum>i = M..N. (a M - ln (real N / real M)) / real N)

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
have "\<dots> \<le> (\<Sum>i = M..N. a i / i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = M..N. (a M - ln (real N / real M)) / real N) \<le> (\<Sum>i = M..N. a i / real i)
[PROOF STEP]
proof (rule sum_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
assume i: "i \<in> {M..N}"
[PROOF STATE]
proof (state)
this:
i \<in> {M..N}

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
with \<open>0 < M\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < M
i \<in> {M..N}
[PROOF STEP]
have "0 < i"
[PROOF STATE]
proof (prove)
using this:
0 < M
i \<in> {M..N}

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

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
have "(a M - ln (N / M)) / N \<le> (a M - ln (N / M)) / i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a M - ln (real N / real M)) / real N \<le> (a M - ln (real N / real M)) / real i
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
0 \<le> a M - ln (real N / real M)

goal (1 subgoal):
 1. (a M - ln (real N / real M)) / real N \<le> (a M - ln (real N / real M)) / real i
[PROOF STEP]
using i \<open>0 < M\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> a M - ln (real N / real M)
i \<in> {M..N}
0 < M

goal (1 subgoal):
 1. (a M - ln (real N / real M)) / real N \<le> (a M - ln (real N / real M)) / real i
[PROOF STEP]
by (simp add: frac_le_eq divide_simps mult_left_mono)
[PROOF STATE]
proof (state)
this:
(a M - ln (real N / real M)) / real N \<le> (a M - ln (real N / real M)) / real i

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(a M - ln (real N / real M)) / real N \<le> (a M - ln (real N / real M)) / real i

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
have "a M + ln (real M) \<le> a i + ln (real N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a M + ln (real M) \<le> a i + ln (real N)
[PROOF STEP]
by (rule order.trans[OF le_a_ln[of M i]]) (use i assms in auto)
[PROOF STATE]
proof (state)
this:
a M + ln (real M) \<le> a i + ln (real N)

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
hence "(a M - ln (N / M)) / i \<le> a i / real i"
[PROOF STATE]
proof (prove)
using this:
a M + ln (real M) \<le> a i + ln (real N)

goal (1 subgoal):
 1. (a M - ln (real N / real M)) / real i \<le> a i / real i
[PROOF STEP]
using assms i
[PROOF STATE]
proof (prove)
using this:
a M + ln (real M) \<le> a i + ln (real N)
\<bar>\<Sum>i = M..N. a i / real i\<bar> < d
a ?n + ln (real ?n) \<le> a (Suc ?n) + ln (real (Suc ?n))
0 < M
M < N
i \<in> {M..N}

goal (1 subgoal):
 1. (a M - ln (real N / real M)) / real i \<le> a i / real i
[PROOF STEP]
by (intro divide_right_mono) (auto simp: ln_div field_simps)
[PROOF STATE]
proof (state)
this:
(a M - ln (real N / real M)) / real i \<le> a i / real i

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
show "(a M - ln (N / M)) / real N \<le> a i / real i"
[PROOF STATE]
proof (prove)
using this:
(a M - ln (real N / real M)) / real N \<le> a i / real i

goal (1 subgoal):
 1. (a M - ln (real N / real M)) / real N \<le> a i / real i
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(a M - ln (real N / real M)) / real N \<le> a i / real i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i = M..N. (a M - ln (real N / real M)) / real N) \<le> (\<Sum>i = M..N. a i / real i)

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> (\<Sum>i = M..N. a i / real i)
[PROOF STEP]
have "((Suc N) - M) * (a M - ln (N / M)) / N \<le> \<bar>\<Sum>i = M..N. a i / i\<bar>"
[PROOF STATE]
proof (prove)
using this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> (\<Sum>i = M..N. a i / real i)

goal (1 subgoal):
 1. real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> \<bar>\<Sum>i = M..N. a i / real i\<bar>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> \<bar>\<Sum>i = M..N. a i / real i\<bar>

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> \<bar>\<Sum>i = M..N. a i / real i\<bar>

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
have "\<dots> \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>i = M..N. a i / real i\<bar> \<le> d
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
\<bar>\<Sum>i = M..N. a i / real i\<bar> < d

goal (1 subgoal):
 1. \<bar>\<Sum>i = M..N. a i / real i\<bar> \<le> d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>\<Sum>i = M..N. a i / real i\<bar> \<le> d

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> d
[PROOF STEP]
have "((Suc N) - M) * (a M - ln (N / M)) / N \<le> d"
[PROOF STATE]
proof (prove)
using this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> d

goal (1 subgoal):
 1. real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> d
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> d

goal (1 subgoal):
 1. 0 \<le> a M - ln (real N / real M) \<Longrightarrow> a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> d

goal (1 subgoal):
 1. a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
using \<open>M < N\<close>
[PROOF STATE]
proof (prove)
using this:
real (Suc N - M) * (a M - ln (real N / real M)) / real N \<le> d
M < N

goal (1 subgoal):
 1. a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
by (simp add: of_nat_diff field_simps)
[PROOF STATE]
proof (state)
this:
a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)

goal (2 subgoals):
 1. a M \<le> d * real N / real (N - M) + ln (real N / real M)
 2. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a M - ln (real N / real M) \<le> d * real N / real (N - M + 1)

goal (2 subgoals):
 1. a M \<le> d * real N / real (N - M) + ln (real N / real M)
 2. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
have "\<dots> \<le> d * N / (N - M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d * real N / real (N - M + 1) \<le> d * real N / real (N - M)
[PROOF STEP]
using assms(1,4)
[PROOF STATE]
proof (prove)
using this:
\<bar>\<Sum>i = M..N. a i / real i\<bar> < d
M < N

goal (1 subgoal):
 1. d * real N / real (N - M + 1) \<le> d * real N / real (N - M)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
d * real N / real (N - M + 1) \<le> d * real N / real (N - M)

goal (2 subgoals):
 1. a M \<le> d * real N / real (N - M) + ln (real N / real M)
 2. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a M - ln (real N / real M) \<le> d * real N / real (N - M)
[PROOF STEP]
show "a M \<le> d * N / (N - M) + ln (N / M)"
[PROOF STATE]
proof (prove)
using this:
a M - ln (real N / real M) \<le> d * real N / real (N - M)

goal (1 subgoal):
 1. a M \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
a M \<le> d * real N / real (N - M) + ln (real N / real M)

goal (1 subgoal):
 1. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
have "- a N - ln (N / M) \<le> (d * N) / (N - M + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
proof (rule le_dN)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
assume 0: "0 \<le> - a N - ln (N / M)"
[PROOF STATE]
proof (state)
this:
0 \<le> - a N - ln (real N / real M)

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
have "(\<Sum>i = M..N. a i / i) \<le> (\<Sum>i = M..N. (a N + ln (N / M)) / N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = M..N. a i / real i) \<le> (\<Sum>i = M..N. (a N + ln (real N / real M)) / real N)
[PROOF STEP]
proof (rule sum_mono)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
assume i: "i \<in> {M..N}"
[PROOF STATE]
proof (state)
this:
i \<in> {M..N}

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
with \<open>0 < M\<close>
[PROOF STATE]
proof (chain)
picking this:
0 < M
i \<in> {M..N}
[PROOF STEP]
have "0 < i"
[PROOF STATE]
proof (prove)
using this:
0 < M
i \<in> {M..N}

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

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
have "a i + ln (real M) \<le> a N + ln (real N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a i + ln (real M) \<le> a N + ln (real N)
[PROOF STEP]
by (rule order.trans[OF _ le_a_ln[of i N]]) (use i assms in auto)
[PROOF STATE]
proof (state)
this:
a i + ln (real M) \<le> a N + ln (real N)

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
hence "a i / i \<le> (a N + ln (N / M)) / i"
[PROOF STATE]
proof (prove)
using this:
a i + ln (real M) \<le> a N + ln (real N)

goal (1 subgoal):
 1. a i / real i \<le> (a N + ln (real N / real M)) / real i
[PROOF STEP]
using assms(3,4)
[PROOF STATE]
proof (prove)
using this:
a i + ln (real M) \<le> a N + ln (real N)
0 < M
M < N

goal (1 subgoal):
 1. a i / real i \<le> (a N + ln (real N / real M)) / real i
[PROOF STEP]
by (intro divide_right_mono) (auto simp: field_simps ln_div)
[PROOF STATE]
proof (state)
this:
a i / real i \<le> (a N + ln (real N / real M)) / real i

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a i / real i \<le> (a N + ln (real N / real M)) / real i

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
have "\<dots> \<le> (a N + ln (N / M)) / N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a N + ln (real N / real M)) / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
using i \<open>i > 0\<close> 0
[PROOF STATE]
proof (prove)
using this:
i \<in> {M..N}
0 < i
0 \<le> - a N - ln (real N / real M)

goal (1 subgoal):
 1. (a N + ln (real N / real M)) / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
by (intro divide_left_mono_neg) auto
[PROOF STATE]
proof (state)
this:
(a N + ln (real N / real M)) / real i \<le> (a N + ln (real N / real M)) / real N

goal (1 subgoal):
 1. \<And>i. i \<in> {M..N} \<Longrightarrow> a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
show "a i / i \<le> (a N + ln (N / M)) / N"
[PROOF STATE]
proof (prove)
using this:
a i / real i \<le> (a N + ln (real N / real M)) / real N

goal (1 subgoal):
 1. a i / real i \<le> (a N + ln (real N / real M)) / real N
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
a i / real i \<le> (a N + ln (real N / real M)) / real N

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i = M..N. a i / real i) \<le> (\<Sum>i = M..N. (a N + ln (real N / real M)) / real N)

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = M..N. a i / real i) \<le> (\<Sum>i = M..N. (a N + ln (real N / real M)) / real N)

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
have "\<dots> = ((Suc N) - M) * (a N + ln (N / M)) / N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = M..N. (a N + ln (real N / real M)) / real N) = real (Suc N - M) * (a N + ln (real N / real M)) / real N
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>i = M..N. (a N + ln (real N / real M)) / real N) = real (Suc N - M) * (a N + ln (real N / real M)) / real N

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = M..N. a i / real i) \<le> real (Suc N - M) * (a N + ln (real N / real M)) / real N
[PROOF STEP]
have "(\<Sum>i = M..N. a i / i) \<le> (real (Suc N) - real M) * (a N + ln (N / M)) / N"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = M..N. a i / real i) \<le> real (Suc N - M) * (a N + ln (real N / real M)) / real N

goal (1 subgoal):
 1. (\<Sum>i = M..N. a i / real i) \<le> (real (Suc N) - real M) * (a N + ln (real N / real M)) / real N
[PROOF STEP]
using \<open>M < N\<close>
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = M..N. a i / real i) \<le> real (Suc N - M) * (a N + ln (real N / real M)) / real N
M < N

goal (1 subgoal):
 1. (\<Sum>i = M..N. a i / real i) \<le> (real (Suc N) - real M) * (a N + ln (real N / real M)) / real N
[PROOF STEP]
by (simp add: of_nat_diff)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = M..N. a i / real i) \<le> (real (Suc N) - real M) * (a N + ln (real N / real M)) / real N

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i = M..N. a i / real i) \<le> (real (Suc N) - real M) * (a N + ln (real N / real M)) / real N
[PROOF STEP]
have "-((real (Suc N) - real M) * (a N + ln (N / M)) / N) \<le> \<bar>\<Sum>i = M..N. a i / i\<bar>"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i = M..N. a i / real i) \<le> (real (Suc N) - real M) * (a N + ln (real N / real M)) / real N

goal (1 subgoal):
 1. - ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> \<bar>\<Sum>i = M..N. a i / real i\<bar>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> \<bar>\<Sum>i = M..N. a i / real i\<bar>

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> \<bar>\<Sum>i = M..N. a i / real i\<bar>

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
have "\<dots> \<le> d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>\<Sum>i = M..N. a i / real i\<bar> \<le> d
[PROOF STEP]
using d
[PROOF STATE]
proof (prove)
using this:
\<bar>\<Sum>i = M..N. a i / real i\<bar> < d

goal (1 subgoal):
 1. \<bar>\<Sum>i = M..N. a i / real i\<bar> \<le> d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>\<Sum>i = M..N. a i / real i\<bar> \<le> d

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> d
[PROOF STEP]
have "- ((real (Suc N) - real M) * (a N + ln (N / M)) / N) \<le> d"
[PROOF STATE]
proof (prove)
using this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> d

goal (1 subgoal):
 1. - ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> d
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> d

goal (1 subgoal):
 1. 0 \<le> - a N - ln (real N / real M) \<Longrightarrow> - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> d

goal (1 subgoal):
 1. - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
using \<open>M < N\<close>
[PROOF STATE]
proof (prove)
using this:
- ((real (Suc N) - real M) * (a N + ln (real N / real M)) / real N) \<le> d
M < N

goal (1 subgoal):
 1. - a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)
[PROOF STEP]
by (simp add: of_nat_diff field_simps)
[PROOF STATE]
proof (state)
this:
- a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)

goal (1 subgoal):
 1. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
- a N - ln (real N / real M) \<le> d * real N / real (N - M + 1)

goal (1 subgoal):
 1. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
have "\<dots> \<le> d * N / real (N - M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d * real N / real (N - M + 1) \<le> d * real N / real (N - M)
[PROOF STEP]
using \<open>0 < M\<close> \<open>M < N\<close> \<open>0 \<le> d\<close>
[PROOF STATE]
proof (prove)
using this:
0 < M
M < N
0 \<le> d

goal (1 subgoal):
 1. d * real N / real (N - M + 1) \<le> d * real N / real (N - M)
[PROOF STEP]
by (simp add: field_simps)
[PROOF STATE]
proof (state)
this:
d * real N / real (N - M + 1) \<le> d * real N / real (N - M)

goal (1 subgoal):
 1. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
- a N - ln (real N / real M) \<le> d * real N / real (N - M)
[PROOF STEP]
show "-a N \<le> d * N / real (N - M) + ln (N / M)"
[PROOF STATE]
proof (prove)
using this:
- a N - ln (real N / real M) \<le> d * real N / real (N - M)

goal (1 subgoal):
 1. - a N \<le> d * real N / real (N - M) + ln (real N / real M)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- a N \<le> d * real N / real (N - M) + ln (real N / real M)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a M \<le> d * real N / (real N - real M) + (real N - real M) / real M \<and> - a N \<le> d * real N / (real N - real M) + (real N - real M) / real M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cfs_add_int_pow:
  assumes "p \<in> carrier P"
  shows "([(n::int)]\<cdot>\<^bsub>P\<^esub>p) k = [n]\<cdot>(p k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([n] \<cdot>\<^bsub>P\<^esub> p) k = [n] \<cdot> p k
[PROOF STEP]
apply(induction n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. ([int n] \<cdot>\<^bsub>P\<^esub> p) k = [int n] \<cdot> p k
 2. \<And>n. ([(- int (Suc n))] \<cdot>\<^bsub>P\<^esub> p) k = [(- int (Suc n))] \<cdot> p k
[PROOF STEP]
by(auto simp: add_pow_int_ge assms cfs_add_nat_pow add_pow_int_lt)


[STATEMENT]
lemma continuous_on_interval_bij: "continuous_on s (interval_bij (a, b) (u, v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (interval_bij (a, b) (u, v))
[PROOF STEP]
apply(rule continuous_at_imp_continuous_on)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>s. isCont (interval_bij (a, b) (u, v)) x
[PROOF STEP]
apply (rule, rule continuous_interval_bij)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exCasePairNotSimp: "(\<exists>x. x \<in> A \<and> \<not> (case x of (e1, e2) \<Rightarrow> P e1 e2)) = (\<exists>(e1, e2) \<in> A. \<not> (P e1 e2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>x. x \<in> A \<and> \<not> (case x of (e1, e2) \<Rightarrow> P e1 e2)) = (\<exists>(e1, e2)\<in>A. \<not> P e1 e2)
[PROOF STEP]
by auto


[STATEMENT]
lemma real_ereal_leq:
  fixes a::ereal and b::real
  assumes "real_of_ereal a \<le> b"
    and "a \<noteq> \<infinity>"
  shows "a \<le> ereal b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> ereal b
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) MInfty_eq_minfinity assms eq_iff ereal_eq_0(2) ereal_le_real_iff
      ereal_less_eq(2) le_cases real_of_ereal.elims real_of_ereal.simps(1) zero_ereal_def)


[STATEMENT]
lemma manifold_eucl_diff_fun_space_iff[simp]:
  "g \<in> manifold_eucl.diff_fun_space k \<longleftrightarrow> k-smooth_on UNIV g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g \<in> manifold_eucl.diff_fun_space k) = k-smooth_on UNIV g
[PROOF STEP]
by (auto simp: manifold_eucl.diff_fun_space_def differentiable_on_def
      diff_fun_charts_euclI diff_fun_charts_euclD)


[STATEMENT]
lemma not_int_code [code]:
  \<open>NOT (0 :: int) = - 1\<close>
  \<open>NOT (Int.Pos n) = Int.Neg (Num.inc n)\<close>
  \<open>NOT (Int.Neg n) = Num.sub n num.One\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NOT 0 = - 1 &&& NOT (Int.Pos n) = Int.Neg (Num.inc n) &&& NOT (Int.Neg n) = neg_numeral_class.sub n num.One
[PROOF STEP]
by (simp_all add: Num.add_One not_int_def)


[STATEMENT]
lemma AxTB4_AxPTB4: \<open>AxTB4 = AxPTB4 o lift\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AxTB4 = AxPTB4 \<circ> lift
[PROOF STEP]
using AxT_AxPT AxB_AxPB Ax4_AxP4
[PROOF STATE]
proof (prove)
using this:
AxT = AxPT \<circ> lift
AxB = AxPB \<circ> lift
Ax4 = AxP4 \<circ> lift

goal (1 subgoal):
 1. AxTB4 = AxPTB4 \<circ> lift
[PROOF STEP]
unfolding comp_apply
[PROOF STATE]
proof (prove)
using this:
AxT = (\<lambda>x. AxPT (lift x))
AxB = (\<lambda>x. AxPB (lift x))
Ax4 = (\<lambda>x. AxP4 (lift x))

goal (1 subgoal):
 1. AxTB4 = (\<lambda>x. AxPTB4 (lift x))
[PROOF STEP]
by metis


[STATEMENT]
lemma Pring_mult_closed:
  assumes "a \<in> carrier (Pring R I)"
  assumes "b \<in> carrier (Pring R I)"
  shows "a \<otimes>\<^bsub>Pring R I\<^esub> b \<in> carrier (Pring R I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> b \<in> carrier (Pring R I)
[PROOF STEP]
using assms  P_ring_mult_closed'[of a I b] Pring_car[of I] Pring_mult[of I a b]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (Pring R I)
b \<in> carrier (Pring R I)
\<lbrakk>a \<in> carrier R [\<X>\<^bsub>I\<^esub>]; b \<in> carrier R [\<X>\<^bsub>I\<^esub>]\<rbrakk> \<Longrightarrow> a \<Otimes>\<^sub>p b \<in> carrier R [\<X>\<^bsub>I\<^esub>]
carrier (Pring R I) = carrier R [\<X>\<^bsub>I\<^esub>]
a \<otimes>\<^bsub>Pring R I\<^esub> b = a \<Otimes>\<^sub>p b

goal (1 subgoal):
 1. a \<otimes>\<^bsub>Pring R I\<^esub> b \<in> carrier (Pring R I)
[PROOF STEP]
by (simp add: \<open>a \<otimes>\<^bsub>Pring R I\<^esub> b = a \<Otimes>\<^sub>p b\<close> \<open>carrier (Pring R I) = Pring_set R I\<close>)