[STATEMENT]
theorem size_build:
  "0 < length ps \<Longrightarrow> \<forall>k. distinct (map (\<lambda>p. p$k) ps) \<Longrightarrow> size_kdt (build ks ps) = length ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < length ps; \<forall>k. distinct (map (\<lambda>p. p $ k) ps)\<rbrakk> \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
proof (induction ps rule: length_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> 0 < length ys \<longrightarrow> (\<forall>k. distinct (map (\<lambda>p. p $ k) ys)) \<longrightarrow> KD_Tree.size_kdt (build ks ys) = length ys; 0 < length xs; \<forall>k. distinct (map (\<lambda>p. p $ k) xs)\<rbrakk> \<Longrightarrow> KD_Tree.size_kdt (build ks xs) = length xs
[PROOF STEP]
case (1 ps)
[PROOF STATE]
proof (state)
this:
\<forall>ys. length ys < length ps \<longrightarrow> 0 < length ys \<longrightarrow> (\<forall>k. distinct (map (\<lambda>p. p $ k) ys)) \<longrightarrow> KD_Tree.size_kdt (build ks ys) = length ys
0 < length ps
\<forall>k. distinct (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. \<And>xs. \<lbrakk>\<forall>ys. length ys < length xs \<longrightarrow> 0 < length ys \<longrightarrow> (\<forall>k. distinct (map (\<lambda>p. p $ k) ys)) \<longrightarrow> KD_Tree.size_kdt (build ks ys) = length ys; 0 < length xs; \<forall>k. distinct (map (\<lambda>p. p $ k) xs)\<rbrakk> \<Longrightarrow> KD_Tree.size_kdt (build ks xs) = length xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
proof (cases "1 < length ps")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
1 < length ps

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
obtain k s where ks_def: "(k, s) = widest_spread ks ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k s. (k, s) = widest_spread ks ps \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis surj_pair)
[PROOF STATE]
proof (state)
this:
(k, s) = widest_spread ks ps

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
obtain l m r where lmr_def: "(l, m, r) = partition_by_median k ps"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>l m r. (l, m, r) = partition_by_median k ps \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis prod_cases3)
[PROOF STATE]
proof (state)
this:
(l, m, r) = partition_by_median k ps

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
have D: "\<forall>k. distinct (map (\<lambda>p. p$k) l)" "\<forall>k. distinct (map (\<lambda>p. p$k) r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>k. distinct (map (\<lambda>p. p $ k) l) &&& \<forall>k. distinct (map (\<lambda>p. p $ k) r)
[PROOF STEP]
using lmr_def
[PROOF STATE]
proof (prove)
using this:
(l, m, r) = partition_by_median k ps

goal (1 subgoal):
 1. \<forall>k. distinct (map (\<lambda>p. p $ k) l) &&& \<forall>k. distinct (map (\<lambda>p. p $ k) r)
[PROOF STEP]
unfolding partition_by_median_def
[PROOF STATE]
proof (prove)
using this:
(l, m, r) = (let m = axis_median k ps; (l, r) = partition (\<lambda>p. p $ k \<le> m) ps in (l, m, r))

goal (1 subgoal):
 1. \<forall>k. distinct (map (\<lambda>p. p $ k) l) &&& \<forall>k. distinct (map (\<lambda>p. p $ k) r)
[PROOF STEP]
by (auto simp: "1.prems"(2) Let_def distinct_map_filter)
[PROOF STATE]
proof (state)
this:
\<forall>k. distinct (map (\<lambda>p. p $ k) l)
\<forall>k. distinct (map (\<lambda>p. p $ k) r)

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>k. distinct (map (\<lambda>p. p $ k) l)
\<forall>k. distinct (map (\<lambda>p. p $ k) r)

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
have "length l < length ps" "0 < length l"
                  "length r < length ps" "0 < length r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length l < length ps &&& 0 < length l) &&& length r < length ps &&& 0 < length r
[PROOF STEP]
using length_partition_by_median(8)[OF True "1.prems"(2)]
            length_partition_by_median(5)[OF "1.prems"(1) "1.prems"(2)]
            length_partition_by_median(6)[OF "1.prems"(1) "1.prems"(2)]
            length_partition_by_median(7)[OF True "1.prems"(2)]
            lmr_def
[PROOF STATE]
proof (prove)
using this:
(?l, ?m, ?r) = partition_by_median ?k ps \<Longrightarrow> length ?l < length ps
(?l, ?m, ?r) = partition_by_median ?k ps \<Longrightarrow> 0 < length ?l
(?l, ?m, ?r) = partition_by_median ?k ps \<Longrightarrow> length ?r < length ps
(?l, ?m, ?r) = partition_by_median ?k ps \<Longrightarrow> 0 < length ?r
(l, m, r) = partition_by_median k ps

goal (1 subgoal):
 1. (length l < length ps &&& 0 < length l) &&& length r < length ps &&& 0 < length r
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
length l < length ps
0 < length l
length r < length ps
0 < length r

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>k. distinct (map (\<lambda>p. p $ k) l)
\<forall>k. distinct (map (\<lambda>p. p $ k) r)
length l < length ps
0 < length l
length r < length ps
0 < length r
[PROOF STEP]
have "size_kdt (build ks l) = length l" "size_kdt (build ks r) = length r"
[PROOF STATE]
proof (prove)
using this:
\<forall>k. distinct (map (\<lambda>p. p $ k) l)
\<forall>k. distinct (map (\<lambda>p. p $ k) r)
length l < length ps
0 < length l
length r < length ps
0 < length r

goal (1 subgoal):
 1. KD_Tree.size_kdt (build ks l) = length l &&& KD_Tree.size_kdt (build ks r) = length r
[PROOF STEP]
using "1.IH"
[PROOF STATE]
proof (prove)
using this:
\<forall>k. distinct (map (\<lambda>p. p $ k) l)
\<forall>k. distinct (map (\<lambda>p. p $ k) r)
length l < length ps
0 < length l
length r < length ps
0 < length r
\<forall>ys. length ys < length ps \<longrightarrow> 0 < length ys \<longrightarrow> (\<forall>k. distinct (map (\<lambda>p. p $ k) ys)) \<longrightarrow> KD_Tree.size_kdt (build ks ys) = length ys

goal (1 subgoal):
 1. KD_Tree.size_kdt (build ks l) = length l &&& KD_Tree.size_kdt (build ks r) = length r
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (build ks l) = length l
KD_Tree.size_kdt (build ks r) = length r

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (build ks l) = length l
KD_Tree.size_kdt (build ks r) = length r

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
have "build ks ps = Node k m (build ks l) (build ks r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. build ks ps = Node k m (build ks l) (build ks r)
[PROOF STEP]
using build_psimp_3[OF True ks_def lmr_def] build_termination D
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>build_dom (ks, l); build_dom (ks, r)\<rbrakk> \<Longrightarrow> build ks ps = Node k m (build ks l) (build ks r)
\<forall>k. distinct (map (\<lambda>p. p $ k) ?ps) \<Longrightarrow> build_dom (?ks, ?ps)
\<forall>k. distinct (map (\<lambda>p. p $ k) l)
\<forall>k. distinct (map (\<lambda>p. p $ k) r)

goal (1 subgoal):
 1. build ks ps = Node k m (build ks l) (build ks r)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
build ks ps = Node k m (build ks l) (build ks r)

goal (2 subgoals):
 1. 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
 2. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
KD_Tree.size_kdt (build ks l) = length l
KD_Tree.size_kdt (build ks r) = length r
build ks ps = Node k m (build ks l) (build ks r)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt (build ks l) = length l
KD_Tree.size_kdt (build ks r) = length r
build ks ps = Node k m (build ks l) (build ks r)

goal (1 subgoal):
 1. KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
using length_partition_by_median(1)[OF lmr_def]
[PROOF STATE]
proof (prove)
using this:
KD_Tree.size_kdt (build ks l) = length l
KD_Tree.size_kdt (build ks r) = length r
build ks ps = Node k m (build ks l) (build ks r)
length ps = length l + length r

goal (1 subgoal):
 1. KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (build ks ps) = length ps

goal (1 subgoal):
 1. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> 1 < length ps

goal (1 subgoal):
 1. \<not> 1 < length ps \<Longrightarrow> KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> 1 < length ps

goal (1 subgoal):
 1. KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
using "1.prems"
[PROOF STATE]
proof (prove)
using this:
\<not> 1 < length ps
0 < length ps
\<forall>k. distinct (map (\<lambda>p. p $ k) ps)

goal (1 subgoal):
 1. KD_Tree.size_kdt (build ks ps) = length ps
[PROOF STEP]
by (cases ps) auto
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (build ks ps) = length ps

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
KD_Tree.size_kdt (build ks ps) = length ps

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Max_le_iMin_conv_singleton: "\<lbrakk> finite I; I \<noteq> {} \<rbrakk> \<Longrightarrow> (Max I \<le> iMin I) = (\<exists>x. I = {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite I; I \<noteq> {}\<rbrakk> \<Longrightarrow> (Max I \<le> iMin I) = (\<exists>x. I = {x})
[PROOF STEP]
by (simp add: iMin_Min_conv Max_le_Min_conv_singleton del: Max_le_iff Min_ge_iff)


[STATEMENT]
lemma construct_lhs_vector_clean_R:
  assumes "p \<noteq> 0"
  assumes "i < length signs"
  shows "(construct_lhs_vector_R p qs signs) $ i =
    card {x. poly p x = 0 \<and> ((consistent_sign_vec qs x) = (nth signs i))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (construct_lhs_vector_R p qs signs $ i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. of_rat (construct_lhs_vector_R p qs signs $ i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
from poly_roots_finite[OF assms(1)]
[PROOF STATE]
proof (chain)
picking this:
finite {x. poly p x = 0}
[PROOF STEP]
have "finite {x. poly p x = 0}"
[PROOF STATE]
proof (prove)
using this:
finite {x. poly p x = 0}

goal (1 subgoal):
 1. finite {x. poly p x = 0}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
finite {x. poly p x = 0}

goal (1 subgoal):
 1. of_rat (construct_lhs_vector_R p qs signs $ i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite {x. poly p x = 0}
[PROOF STEP]
have eq: "(Collect
       ((\<lambda>v. v = signs ! i) \<circ>
        consistent_sign_vec qs) \<inter>
      set (sorted_list_of_set
            {x. poly p x = 0})) =
    {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}"
[PROOF STATE]
proof (prove)
using this:
finite {x. poly p x = 0}

goal (1 subgoal):
 1. Collect ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) \<inter> set (sorted_list_of_set {x. poly p x = 0}) = {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Collect ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) \<inter> set (sorted_list_of_set {x. poly p x = 0}) = {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}

goal (1 subgoal):
 1. of_rat (construct_lhs_vector_R p qs signs $ i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (construct_lhs_vector_R p qs signs $ i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
unfolding construct_lhs_vector_R_def vec_of_list_index characterize_root_list_p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (map (\<lambda>w. rat_of_int (int (length (filter (\<lambda>v. v = w) (map (consistent_sign_vec qs) (sorted_list_of_set {x. poly p x = 0})))))) signs ! i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (map (\<lambda>w. rat_of_nat (length (filter ((\<lambda>v. v = w) \<circ> consistent_sign_vec qs) (sorted_list_of_set {x. poly p x = 0})))) signs ! i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
apply (subst nth_map[OF assms(2)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_rat (rat_of_nat (length (filter ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) (sorted_list_of_set {x. poly p x = 0})))) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (filter ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) (sorted_list_of_set {x. poly p x = 0})) = card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}
[PROOF STEP]
apply (subst distinct_length_filter)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. distinct (sorted_list_of_set {x. poly p x = 0})
 2. card (Collect ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) \<inter> set (sorted_list_of_set {x. poly p x = 0})) = card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (Collect ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) \<inter> set (sorted_list_of_set {x. poly p x = 0})) = card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
Collect ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) \<inter> set (sorted_list_of_set {x. poly p x = 0}) = {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}

goal (1 subgoal):
 1. card (Collect ((\<lambda>v. v = signs ! i) \<circ> consistent_sign_vec qs) \<inter> set (sorted_list_of_set {x. poly p x = 0})) = card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_rat (construct_lhs_vector_R p qs signs $ i) = of_nat (card {x. poly p x = 0 \<and> consistent_sign_vec qs x = signs ! i})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hlog_le_cancel_iff [simp]: "1 < a \<Longrightarrow> 0 < x \<Longrightarrow> 0 < y \<Longrightarrow> hlog a x \<le> hlog a y \<longleftrightarrow> x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 < a; 0 < x; 0 < y\<rbrakk> \<Longrightarrow> (hlog a x \<le> hlog a y) = (x \<le> y)
[PROOF STEP]
by (simp add: linorder_not_less [symmetric])


[STATEMENT]
lemma sgn_rat [simp, code]: "sgn (Fract a b) = of_int (sgn a * sgn b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (Fract a b) = of_int (sgn a * sgn b)
[PROOF STEP]
unfolding Fract_of_int_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sgn (Fract a b) = of_int (sgn a * sgn b)
[PROOF STEP]
by (auto simp: zsgn_def sgn_rat_def Zero_rat_def eq_rat)
    (auto simp: rat_number_collapse not_less le_less zero_less_mult_iff)


[STATEMENT]
lemma ltake_ldropn: "ltake n (ldropn m xs) = ldropn m (ltake (n + enat m) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ltake n (ldropn m xs) = ldropn m (ltake (n + enat m) xs)
[PROOF STEP]
by(induct m arbitrary: n xs)(auto simp add: zero_enat_def[symmetric] ldropn_Suc eSuc_enat[symmetric] iadd_Suc_right split: llist.split)


[STATEMENT]
theorem gfp_f_hospital_pessimal:
  assumes "stable_pair_on ds XD_XH"
  assumes "x \<in> Ch h (match XD_XH)"
  shows "x \<in> Ch h (match (gfp_F ds) \<union> match XD_XH)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> Ch h (match (gfp_F ds) \<union> match XD_XH)
[PROOF STEP]
proof %invisible -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> Ch h (match (gfp_F ds) \<union> match XD_XH)
[PROOF STEP]
from \<open>stable_pair_on ds XD_XH\<close>
[PROOF STATE]
proof (chain)
picking this:
stable_pair_on ds XD_XH
[PROOF STEP]
have "match (gfp_F ds) \<union> match XD_XH \<subseteq> snd XD_XH"
[PROOF STATE]
proof (prove)
using this:
stable_pair_on ds XD_XH

goal (1 subgoal):
 1. match (gfp_F ds) \<union> match XD_XH \<subseteq> snd XD_XH
[PROOF STEP]
by (simp add: XD_XH_gfp_F(2) le_infI2)
[PROOF STATE]
proof (state)
this:
match (gfp_F ds) \<union> match XD_XH \<subseteq> snd XD_XH

goal (1 subgoal):
 1. x \<in> Ch h (match (gfp_F ds) \<union> match XD_XH)
[PROOF STEP]
with assms lfp_F_stable_pair_on stable_pair_on_Ch Ch_range
[PROOF STATE]
proof (chain)
picking this:
stable_pair_on ds XD_XH
x \<in> Ch h (match XD_XH)
stable_pair_on ?ds (lfp_F ?ds)
stable_pair_on ?ds ?XD_XH \<Longrightarrow> Ch ?h (snd ?XD_XH) = match ?XD_XH \<inter> {x. Xh x = ?h}
\<forall>h X. Ch h X \<subseteq> {x \<in> X. Xh x = h}
match (gfp_F ds) \<union> match XD_XH \<subseteq> snd XD_XH
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
stable_pair_on ds XD_XH
x \<in> Ch h (match XD_XH)
stable_pair_on ?ds (lfp_F ?ds)
stable_pair_on ?ds ?XD_XH \<Longrightarrow> Ch ?h (snd ?XD_XH) = match ?XD_XH \<inter> {x. Xh x = ?h}
\<forall>h X. Ch h X \<subseteq> {x \<in> X. Xh x = h}
match (gfp_F ds) \<union> match XD_XH \<subseteq> snd XD_XH

goal (1 subgoal):
 1. x \<in> Ch h (match (gfp_F ds) \<union> match XD_XH)
[PROOF STEP]
by - (rule iia_onD[OF Ch_iia[where h=h], where B="snd XD_XH", simplified]; blast+)
[PROOF STATE]
proof (state)
this:
x \<in> Ch h (match (gfp_F ds) \<union> match XD_XH)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proj_onto_sum_rw:
  "sum (\<lambda>x. (x \<bullet> v / (x \<bullet> x)) *\<^sub>R x) A = sum (\<lambda>x. (v \<bullet> x / (x \<bullet> x)) *\<^sub>R x) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>A. (x \<bullet> v / (x \<bullet> x)) *\<^sub>R x) = (\<Sum>x\<in>A. (v \<bullet> x / (x \<bullet> x)) *\<^sub>R x)
[PROOF STEP]
by (rule sum.cong, auto simp add: inner_commute)


[STATEMENT]
lemma csorted_list_of_set_split:
  fixes A :: "'a :: ccompare set" shows
  "P (csorted_list_of_set A) \<longleftrightarrow>
  (\<forall>xs. ID CCOMPARE('a) \<noteq> None \<longrightarrow> finite A \<longrightarrow> A = set xs \<longrightarrow> distinct xs \<longrightarrow> linorder.sorted cless_eq xs \<longrightarrow> P xs) \<and>
  (ID CCOMPARE('a) = None \<or> \<not> finite A \<longrightarrow> P undefined)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (csorted_list_of_set A) = ((\<forall>xs. ID ccompare \<noteq> None \<longrightarrow> finite A \<longrightarrow> A = set xs \<longrightarrow> distinct xs \<longrightarrow> sorted_wrt cless_eq xs \<longrightarrow> P xs) \<and> (ID ccompare = None \<or> infinite A \<longrightarrow> P undefined))
[PROOF STEP]
by(auto simp add: csorted_list_of_set_def linorder.sorted_list_of_set[OF ID_ccompare])


[STATEMENT]
lemma count_of_join_raw:
  "distinct (map fst ys) \<Longrightarrow>
    count_of xs x + count_of ys x = count_of (join_raw (\<lambda>x (x, y). x + y) xs ys) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map fst ys) \<Longrightarrow> count_of xs x + count_of ys x = count_of (join_raw (\<lambda>x (x, y). x + y) xs ys) x
[PROOF STEP]
unfolding count_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map fst ys) \<Longrightarrow> (case map_of xs x of None \<Rightarrow> 0 | Some n \<Rightarrow> n) + (case map_of ys x of None \<Rightarrow> 0 | Some n \<Rightarrow> n) = (case map_of (join_raw (\<lambda>x (x, y). x + y) xs ys) x of None \<Rightarrow> 0 | Some n \<Rightarrow> n)
[PROOF STEP]
by (simp add: map_of_join_raw split: option.split)


[STATEMENT]
lemma icard_finite_conv: "(icard A = enat (card A)) = finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (icard A = enat (card A)) = finite A
[PROOF STEP]
by (case_tac "finite A", simp_all add: icard_def)


[STATEMENT]
lemma set_plus_rearrange: "(a +o C) + (b +o D) = (a + b) +o (C + D)"
  for a b :: "'a::comm_monoid_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a +o C + b +o D = (a + b) +o (C + D)
[PROOF STEP]
by (auto simp: elt_set_plus_def set_plus_def; metis group_cancel.add1 group_cancel.add2)


[STATEMENT]
lemma ADD[import_const "+" : plus]:
  "(\<forall>n :: nat. (id 0) + n = n) \<and> (\<forall>m n. (Suc m) + n = Suc (m + n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>n. id 0 + n = n) \<and> (\<forall>m n. Suc m + n = Suc (m + n))
[PROOF STEP]
by simp


[STATEMENT]
lemma affine_alg_set_not_memE:
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  assumes "a \<notin> (affine_alg_set R n B)"
  shows "\<exists>b \<in> B. eval_at_poly R b a \<noteq> \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>b\<in>B. eval_at_point R a b \<noteq> \<zero>
[PROOF STEP]
using assms affine_alg_set_memI
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
a \<notin> affine_alg_set R n B
\<lbrakk>?a \<in> carrier (R\<^bsup>?n\<^esup>); \<And>p. p \<in> ?B \<Longrightarrow> eval_at_point R ?a p = \<zero>\<rbrakk> \<Longrightarrow> ?a \<in> affine_alg_set R ?n ?B

goal (1 subgoal):
 1. \<exists>b\<in>B. eval_at_point R a b \<noteq> \<zero>
[PROOF STEP]
by blast


[STATEMENT]
lemma log_root: "n > 0 \<Longrightarrow> a > 0 \<Longrightarrow> log b (root n a) =  log b a / n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 < a\<rbrakk> \<Longrightarrow> log b (root n a) = log b a / real n
[PROOF STEP]
by (simp add: log_def ln_root)


[STATEMENT]
lemma ereal_open_mono_set:
  fixes S :: "ereal set"
  shows "open S \<and> mono_set S \<longleftrightarrow> S = UNIV \<or> S = {Inf S <..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (open S \<and> mono_set S) = (S = UNIV \<or> S = {Inf S<..})
[PROOF STEP]
by (metis Inf_UNIV atLeast_eq_UNIV_iff ereal_open_atLeast
    ereal_open_closed mono_set_iff open_ereal_greaterThan)


[STATEMENT]
lemma prv_neg_exi_eqv_all_neg:
  assumes x: "x \<in> var" and \<phi>: "\<phi> \<in> fmla"
  shows "prv (eqv (neg (exi x \<phi>)) (all x (neg \<phi>)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (eqv (neg (exi x \<phi>)) (all x (neg \<phi>)))
[PROOF STEP]
by (simp add: \<phi> prv_all_neg_imp_neg_exi prv_eqvI prv_neg_exi_imp_all_neg x)


[STATEMENT]
lemma suitable_prime_bz: assumes sf: "square_free f" and p: "p = suitable_prime_bz f"
  shows "prime p" "coprime (lead_coeff f) p" "poly_mod.square_free_m p f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p &&& comm_monoid_mult_class.coprime (lead_coeff f) p &&& poly_mod.square_free_m p f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. prime p
 2. comm_monoid_mult_class.coprime (lead_coeff f) p
 3. poly_mod.square_free_m p f
[PROOF STEP]
let ?lc = "lead_coeff f"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. prime p
 2. comm_monoid_mult_class.coprime (lead_coeff f) p
 3. poly_mod.square_free_m p f
[PROOF STEP]
from prime_for_berlekamp_zassenhaus_exists[OF sf, unfolded Let_def]
[PROOF STATE]
proof (chain)
picking this:
\<exists>p. prime p \<and> comm_monoid_mult_class.coprime (lead_coeff f) p \<and> separable_impl p f
[PROOF STEP]
obtain P where *: "prime P \<and> coprime ?lc P \<and> separable_impl P f"
[PROOF STATE]
proof (prove)
using this:
\<exists>p. prime p \<and> comm_monoid_mult_class.coprime (lead_coeff f) p \<and> separable_impl p f

goal (1 subgoal):
 1. (\<And>P. prime P \<and> comm_monoid_mult_class.coprime (lead_coeff f) P \<and> separable_impl P f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime P \<and> comm_monoid_mult_class.coprime (lead_coeff f) P \<and> separable_impl P f

goal (3 subgoals):
 1. prime p
 2. comm_monoid_mult_class.coprime (lead_coeff f) p
 3. poly_mod.square_free_m p f
[PROOF STEP]
hence "prime (nat P)"
[PROOF STATE]
proof (prove)
using this:
prime P \<and> comm_monoid_mult_class.coprime (lead_coeff f) P \<and> separable_impl P f

goal (1 subgoal):
 1. prime (nat P)
[PROOF STEP]
using prime_int_nat_transfer
[PROOF STATE]
proof (prove)
using this:
prime P \<and> comm_monoid_mult_class.coprime (lead_coeff f) P \<and> separable_impl P f
prime ?k = (0 \<le> ?k \<and> prime (nat ?k))

goal (1 subgoal):
 1. prime (nat P)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
prime (nat P)

goal (3 subgoals):
 1. prime p
 2. comm_monoid_mult_class.coprime (lead_coeff f) p
 3. poly_mod.square_free_m p f
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
prime P \<and> comm_monoid_mult_class.coprime (lead_coeff f) P \<and> separable_impl P f
prime (nat P)
[PROOF STEP]
have "\<exists> p. prime p \<and> coprime ?lc (int p) \<and> separable_impl p f"
[PROOF STATE]
proof (prove)
using this:
prime P \<and> comm_monoid_mult_class.coprime (lead_coeff f) P \<and> separable_impl P f
prime (nat P)

goal (1 subgoal):
 1. \<exists>p. prime p \<and> comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f
[PROOF STEP]
by (intro exI [of _ "nat P"]) (auto dest: prime_gt_0_int)
[PROOF STATE]
proof (state)
this:
\<exists>p. prime p \<and> comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f

goal (3 subgoals):
 1. prime p
 2. comm_monoid_mult_class.coprime (lead_coeff f) p
 3. poly_mod.square_free_m p f
[PROOF STEP]
from find_prime[OF this]
[PROOF STATE]
proof (chain)
picking this:
prime (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f)) \<and> comm_monoid_mult_class.coprime (lead_coeff f) (int (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f))) \<and> separable_impl (int (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f))) f
[PROOF STEP]
have prime: "prime p" and cop: "coprime ?lc p" and sf: "separable_impl p f"
[PROOF STATE]
proof (prove)
using this:
prime (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f)) \<and> comm_monoid_mult_class.coprime (lead_coeff f) (int (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f))) \<and> separable_impl (int (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f))) f

goal (1 subgoal):
 1. prime p &&& comm_monoid_mult_class.coprime (lead_coeff f) p &&& separable_impl p f
[PROOF STEP]
unfolding p suitable_prime_bz_def Let_def
[PROOF STATE]
proof (prove)
using this:
prime (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f)) \<and> comm_monoid_mult_class.coprime (lead_coeff f) (int (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f))) \<and> separable_impl (int (find_prime (\<lambda>p. comm_monoid_mult_class.coprime (lead_coeff f) (int p) \<and> separable_impl (int p) f))) f

goal (1 subgoal):
 1. prime (int (find_prime (\<lambda>n. comm_monoid_mult_class.coprime (lead_coeff f) (int n) \<and> separable_impl (int n) f))) &&& comm_monoid_mult_class.coprime (lead_coeff f) (int (find_prime (\<lambda>n. comm_monoid_mult_class.coprime (lead_coeff f) (int n) \<and> separable_impl (int n) f))) &&& separable_impl (int (find_prime (\<lambda>n. comm_monoid_mult_class.coprime (lead_coeff f) (int n) \<and> separable_impl (int n) f))) f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
comm_monoid_mult_class.coprime (lead_coeff f) p
separable_impl p f

goal (3 subgoals):
 1. prime p
 2. comm_monoid_mult_class.coprime (lead_coeff f) p
 3. poly_mod.square_free_m p f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prime p
comm_monoid_mult_class.coprime (lead_coeff f) p
separable_impl p f
[PROOF STEP]
interpret poly_mod_prime p
[PROOF STATE]
proof (prove)
using this:
prime p
comm_monoid_mult_class.coprime (lead_coeff f) p
separable_impl p f

goal (1 subgoal):
 1. poly_mod_prime p
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. prime p
 2. comm_monoid_mult_class.coprime (lead_coeff f) p
 3. square_free_m f
[PROOF STEP]
from prime cop separable_impl(1)[OF sf]
[PROOF STATE]
proof (chain)
picking this:
prime p
comm_monoid_mult_class.coprime (lead_coeff f) p
square_free_m f
[PROOF STEP]
show "prime p" "coprime ?lc p" "square_free_m f"
[PROOF STATE]
proof (prove)
using this:
prime p
comm_monoid_mult_class.coprime (lead_coeff f) p
square_free_m f

goal (1 subgoal):
 1. prime p &&& comm_monoid_mult_class.coprime (lead_coeff f) p &&& square_free_m f
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prime p
comm_monoid_mult_class.coprime (lead_coeff f) p
square_free_m f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mangoldt_primepow:
   "prime p \<Longrightarrow> mangoldt (p ^ k) = (if k > 0 then of_real (ln (real p)) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> mangoldt (p ^ k) = (if 0 < k then of_real (ln (real p)) else (0::'a))
[PROOF STEP]
by (simp add: mangoldt_def aprimedivisor_prime_power)


[STATEMENT]
lemma complex_is_Int_iff: "z \<in> \<int> \<longleftrightarrow> Im z = 0 \<and> (\<exists>i. Re z = of_int i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (z \<in> \<int>) = (Im z = 0 \<and> (\<exists>i. Re z = real_of_int i))
[PROOF STEP]
by (auto simp: Ints_def complex_eq_iff)


[STATEMENT]
lemma represents_mult_rat:
  assumes r: "r \<noteq> 0" and "p represents x" shows "(poly_mult_rat r p) represents (of_rat r * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mult_rat r p represents of_rat r * x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r \<noteq> 0
p represents x

goal (1 subgoal):
 1. poly_mult_rat r p represents of_rat r * x
[PROOF STEP]
unfolding represents_def ipoly_mult_rat[OF r]
[PROOF STATE]
proof (prove)
using this:
r \<noteq> 0
ipoly p x = (0::'a) \<and> p \<noteq> 0

goal (1 subgoal):
 1. of_int (fst (quotient_of r)) ^ degree p * ipoly p (of_rat r * x * inverse (of_rat r)) = (0::'a) \<and> poly_mult_rat r p \<noteq> 0
[PROOF STEP]
by (simp add: field_simps)


[STATEMENT]
lemma homotopy_eqv_homotopic_triviality_null:
  fixes S :: "'a::real_normed_vector set"
    and T :: "'b::real_normed_vector set"
    and U :: "'c::real_normed_vector set"
  assumes "S homotopy_eqv T"
    shows "(\<forall>f. continuous_on U f \<and> f ` U \<subseteq> S
                  \<longrightarrow> (\<exists>c. homotopic_with_canon (\<lambda>x. True) U S f (\<lambda>x. c))) \<longleftrightarrow>
           (\<forall>f. continuous_on U f \<and> f ` U \<subseteq> T
                  \<longrightarrow> (\<exists>c. homotopic_with_canon (\<lambda>x. True) U T f (\<lambda>x. c)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>f. continuous_on U f \<and> f ` U \<subseteq> S \<longrightarrow> (\<exists>c. homotopic_with_canon (\<lambda>x. True) U S f (\<lambda>x. c))) = (\<forall>f. continuous_on U f \<and> f ` U \<subseteq> T \<longrightarrow> (\<exists>c. homotopic_with_canon (\<lambda>x. True) U T f (\<lambda>x. c)))
[PROOF STEP]
by (rule iffI; metis assms homotopy_eqv_homotopic_triviality_null_imp homotopy_equivalent_space_sym)


[STATEMENT]
lemma size_pf_formula14: "sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
have "sum_list (map size_pf (pf_formula14 n m)) = m * (1 + (16 * n - 21)) + n * (3 + (16 * m - 21))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_list (map size_pf (pf_formula14 n m)) = m * (1 + (16 * n - 21)) + n * (3 + (16 * m - 21))
[PROOF STEP]
unfolding pf_encoder.formula14_def Let_def sum_list_append map_append map_concat List.maps_def sum_list_concat map_map o_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<m]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>i. (Gamma i x, AuxZeroJI i x, AuxOneJI i x)) [0..<n]) of (x, xa) \<Rightarrow> x # xa))) + (\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = m * (1 + (16 * n - 21)) + n * (3 + (16 * m - 21))
[PROOF STEP]
proof (intro arg_cong2[of _ _ _ _ "(+)"], goal_cases)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<Sum>x\<leftarrow>[0..<m]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>i. (Gamma i x, AuxZeroJI i x, AuxOneJI i x)) [0..<n]) of (x, xa) \<Rightarrow> x # xa))) = m * (1 + (16 * n - 21))
 2. (\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = n * (3 + (16 * m - 21))
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (\<Sum>x\<leftarrow>[0..<m]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>i. (Gamma i x, AuxZeroJI i x, AuxOneJI i x)) [0..<n]) of (x, xa) \<Rightarrow> x # xa))) = m * (1 + (16 * n - 21))
 2. (\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = n * (3 + (16 * m - 21))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<m]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>i. (Gamma i x, AuxZeroJI i x, AuxOneJI i x)) [0..<n]) of (x, xa) \<Rightarrow> x # xa))) = m * (1 + (16 * n - 21))
[PROOF STEP]
apply (rule sum_list_triv_cong, force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set [0..<m] \<Longrightarrow> sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>i. (Gamma i x, AuxZeroJI i x, AuxOneJI i x)) [0..<n]) of (x, xa) \<Rightarrow> x # xa)) = 1 + (16 * n - 21)
[PROOF STEP]
subgoal for j
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<in> set [0..<m] \<Longrightarrow> sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>i. (Gamma i j, AuxZeroJI i j, AuxOneJI i j)) [0..<n]) of (x, xa) \<Rightarrow> x # xa)) = 1 + (16 * n - 21)
[PROOF STEP]
by (cases "pf_encode_exactly_one (map (\<lambda>i. (Gamma i j, AuxZeroJI i j, AuxOneJI i j)) [0..<n])",
            auto simp: size_pf_encode_exactly_one)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>[0..<m]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>i. (Gamma i x, AuxZeroJI i x, AuxOneJI i x)) [0..<n]) of (x, xa) \<Rightarrow> x # xa))) = m * (1 + (16 * n - 21))

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = n * (3 + (16 * m - 21))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = n * (3 + (16 * m - 21))
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = n * (3 + (16 * m - 21))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = n * (3 + (16 * m - 21))
[PROOF STEP]
apply (rule sum_list_triv_cong, force)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> set [0..<n] \<Longrightarrow> sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa)) = 3 + (16 * m - 21)
[PROOF STEP]
subgoal for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> set [0..<n] \<Longrightarrow> sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma i j, AuxZeroIJ i j, AuxOneIJ i j)) [0..<m]) of (one, x) \<Rightarrow> Impl (Prop (Epsilon i)) one # x)) = 3 + (16 * m - 21)
[PROOF STEP]
by (cases "pf_encode_exactly_one (map (\<lambda>j. (Gamma i j, AuxZeroIJ i j, AuxOneIJ i j)) [0..<m])",
            auto simp: size_pf_encode_exactly_one)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<leftarrow>[0..<n]. sum_list (map size_pf (case pf_encode_exactly_one (map (\<lambda>j. (Gamma x j, AuxZeroIJ x j, AuxOneIJ x j)) [0..<m]) of (one, xa) \<Rightarrow> Impl (Prop (Epsilon x)) one # xa))) = n * (3 + (16 * m - 21))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sum_list (map size_pf (pf_formula14 n m)) = m * (1 + (16 * n - 21)) + n * (3 + (16 * m - 21))

goal (1 subgoal):
 1. sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_list (map size_pf (pf_formula14 n m)) = m * (1 + (16 * n - 21)) + n * (3 + (16 * m - 21))

goal (1 subgoal):
 1. sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
have "\<dots> = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * (1 + (16 * n - 21)) + n * (3 + (16 * m - 21)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
m * (1 + (16 * n - 21)) + n * (3 + (16 * m - 21)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)

goal (1 subgoal):
 1. sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)

goal (1 subgoal):
 1. sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_list (map size_pf (pf_formula14 n m)) = m + 3 * n + m * (n * 16 - 21) + n * (m * 16 - 21)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_sum:
  "(\<And>i. i \<in> P \<Longrightarrow> f i \<in> borel_measurable M) \<Longrightarrow> (\<integral>\<^sup>+ x. (\<Sum>i\<in>P. f i x) \<partial>M) = (\<Sum>i\<in>P. integral\<^sup>N M (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> P \<Longrightarrow> f i \<in> borel_measurable M) \<Longrightarrow> \<integral>\<^sup>+ x. (\<Sum>i\<in>P. f i x) \<partial>M = (\<Sum>i\<in>P. integral\<^sup>N M (f i))
[PROOF STEP]
by (induction P rule: infinite_finite_induct) (auto simp: nn_integral_add)


[STATEMENT]
lemma powr_gt_zero [simp]: "0 < x powr a \<longleftrightarrow> x \<noteq> 0"
  for a x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < x powr a) = (x \<noteq> 0)
[PROOF STEP]
by (simp add: powr_def)


[STATEMENT]
theorem STL5_21:
  assumes h1: "stutinv F" and h2: "stutinv G"
  shows "\<turnstile> \<box>(F \<and> G) = (\<box>F \<and> \<box>G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<box>(F \<and> G) = (\<box>F \<and> \<box>G)
[PROOF STEP]
using h1[THEN pre_id_unch] h2[THEN pre_id_unch]
[PROOF STATE]
proof (prove)
using this:
|~ F \<and> Unchanged id \<longrightarrow> \<circle>F
|~ G \<and> Unchanged id \<longrightarrow> \<circle>G

goal (1 subgoal):
 1. \<turnstile> \<box>(F \<and> G) = (\<box>F \<and> \<box>G)
[PROOF STEP]
by (rule STL5_2)


[STATEMENT]
lemma map_list_R1_list_to_list_R1: "map_list_R1 f (list_to_list_R1 xs) = list_to_list_R1 (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_list_R1 f (list_to_list_R1 xs) = list_to_list_R1 (map f xs)
[PROOF STEP]
by(induction xs) auto


[STATEMENT]
lemma mtx_vec_mult_add_rdistr: "(A + B) *\<^sub>V x = A *\<^sub>V x + B *\<^sub>V x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) *\<^sub>V x = A *\<^sub>V x + B *\<^sub>V x
[PROOF STEP]
unfolding plus_sq_mtx_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_fun to_vec (map_fun to_vec to_mtx) (+) A B *\<^sub>V x = A *\<^sub>V x + B *\<^sub>V x
[PROOF STEP]
apply(transfer)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>A B x. map_fun (\<lambda>x. x) (map_fun (\<lambda>x. x) (\<lambda>x. x)) (+) A B *v x = A *v x + B *v x
[PROOF STEP]
by (simp add: matrix_vector_mult_add_rdistrib)


[STATEMENT]
lemma join_least [intro?]: "x \<sqsubseteq> z \<Longrightarrow> y \<sqsubseteq> z \<Longrightarrow> x \<squnion> y \<sqsubseteq> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<sqsubseteq> z; y \<sqsubseteq> z\<rbrakk> \<Longrightarrow> x \<squnion> y \<sqsubseteq> z
[PROOF STEP]
by (rule is_sup_least) (rule is_sup_join)


[STATEMENT]
lemma sort_edges_correct: "sorted_wrt edges_less_eq (quicksort_by_rel edges_less_eq [] l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt edges_less_eq (quicksort_by_rel edges_less_eq [] l)
[PROOF STEP]
by (metis (no_types, opaque_lifting) edges_less_eq_linorder is_linorder_rel_def sorted_wrt_quicksort_by_rel)


[STATEMENT]
lemma pp_surjective_linorder_matrix_1:
  fixes f :: "('a::finite,'b::non_trivial_linorder_stone_relation_algebra_expansion) square"
  shows "\<ominus>(mtop \<odot> f) = mbot \<longleftrightarrow> (\<forall>j . \<exists>i . f (i,j) \<noteq> bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
have "\<ominus>(mtop \<odot> f) = mbot \<longleftrightarrow> (\<ominus>(mtop \<odot> f))\<^sup>t = mbot\<^sup>t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = ((\<ominus> (mtop \<odot> f))\<^sup>t = mbot\<^sup>t)
[PROOF STEP]
by (metis matrix_stone_relation_algebra.conv_involutive)
[PROOF STATE]
proof (state)
this:
matrix_p_algebra.dense (mtop \<odot> f) = ((\<ominus> (mtop \<odot> f))\<^sup>t = mbot\<^sup>t)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_p_algebra.dense (mtop \<odot> f) = ((\<ominus> (mtop \<odot> f))\<^sup>t = mbot\<^sup>t)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
have "... \<longleftrightarrow> \<ominus>(f\<^sup>t \<odot> mtop) = mbot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<ominus> (mtop \<odot> f))\<^sup>t = mbot\<^sup>t) = matrix_p_algebra.dense (f\<^sup>t \<odot> mtop)
[PROOF STEP]
by (simp add: matrix_stone_relation_algebra.conv_complement matrix_stone_relation_algebra.conv_dist_comp)
[PROOF STATE]
proof (state)
this:
((\<ominus> (mtop \<odot> f))\<^sup>t = mbot\<^sup>t) = matrix_p_algebra.dense (f\<^sup>t \<odot> mtop)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<ominus> (mtop \<odot> f))\<^sup>t = mbot\<^sup>t) = matrix_p_algebra.dense (f\<^sup>t \<odot> mtop)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
have "... \<longleftrightarrow> (\<forall>i . \<exists>j . (f\<^sup>t) (i,j) \<noteq> bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_p_algebra.dense (f\<^sup>t \<odot> mtop) = (\<forall>i. \<exists>j. (f\<^sup>t) (i, j) \<noteq> bot)
[PROOF STEP]
using pp_total_linorder_matrix_3
[PROOF STATE]
proof (prove)
using this:
matrix_p_algebra.dense (?f \<odot> mtop) = (\<forall>i. \<exists>j. ?f (i, j) \<noteq> bot)

goal (1 subgoal):
 1. matrix_p_algebra.dense (f\<^sup>t \<odot> mtop) = (\<forall>i. \<exists>j. (f\<^sup>t) (i, j) \<noteq> bot)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
matrix_p_algebra.dense (f\<^sup>t \<odot> mtop) = (\<forall>i. \<exists>j. (f\<^sup>t) (i, j) \<noteq> bot)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
matrix_p_algebra.dense (f\<^sup>t \<odot> mtop) = (\<forall>i. \<exists>j. (f\<^sup>t) (i, j) \<noteq> bot)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
have "... \<longleftrightarrow> (\<forall>j . \<exists>i . f (i,j) \<noteq> bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i. \<exists>j. (f\<^sup>t) (i, j) \<noteq> bot) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
by (simp add: conv_matrix_def)
[PROOF STATE]
proof (state)
this:
(\<forall>i. \<exists>j. (f\<^sup>t) (i, j) \<noteq> bot) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)

goal (1 subgoal):
 1. matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
matrix_p_algebra.dense (mtop \<odot> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_add: "x * y - y * x = 0 \<Longrightarrow> exp (x + y) = exp x * exp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y - y * x = (0::'a) \<Longrightarrow> exp (x + y) = exp x * exp y
[PROOF STEP]
by (rule exp_add_commuting) (simp add: ac_simps)


[STATEMENT]
lemma llist_all2_lsetD1: "\<lbrakk> llist_all2 P xs ys; x \<in> lset xs \<rbrakk> \<Longrightarrow> \<exists>y\<in>lset ys. P x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>llist_all2 P xs ys; x \<in> lset xs\<rbrakk> \<Longrightarrow> \<exists>y\<in>lset ys. P x y
[PROOF STEP]
by(auto 4 4 simp add: llist_all2_conv_lzip lset_lzip lset_conv_lnth split_beta lnth_lzip simp del: split_paired_All)


[STATEMENT]
lemma inverse_mk_dimvec [code, si_def]:
  "(inverse (mk_dimvec xs) :: ('n::ring_1, 'a::enum) dimvec) =
   (if (length xs = CARD('a)) then mk_dimvec (map uminus xs) else 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (mk_dimvec xs) = (if length xs = CARD('a) then mk_dimvec (map uminus xs) else 1)
[PROOF STEP]
by (auto simp add: inverse_dimvec_def one_dimvec_def mk_dimvec_def fun_eq_iff)


[STATEMENT]
lemma carrier_singleton_group [simp]: "carrier (singleton_group a) = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (singleton_group a) = {a}
[PROOF STEP]
by (auto simp: singleton_group_def)


[STATEMENT]
lemma not_eq_icard_imp_inj_on: "\<exists>(f::nat\<Rightarrow>nat) (A::nat set). icard (f ` A) = icard A \<and> \<not> inj_on f A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f A. icard (f ` A) = icard A \<and> \<not> inj_on f A
[PROOF STEP]
apply (rule_tac x="\<lambda>n. (if n = 0 then Suc 0 else n)" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A. icard ((\<lambda>n. if n = 0 then Suc 0 else n) ` A) = icard A \<and> \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) A
[PROOF STEP]
apply (rule_tac x="{0..}" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. icard ((\<lambda>n. if n = 0 then Suc 0 else n) ` {0..}) = icard {0..} \<and> \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply (rule conjI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. icard ((\<lambda>n. if n = 0 then Suc 0 else n) ` {0..}) = icard {0..}
 2. \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply (rule subst[of "{1..}" "((\<lambda>n. if n = 0 then Suc 0 else n) ` {0..})"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. {1..} = (\<lambda>n. if n = 0 then Suc 0 else n) ` {0..}
 2. icard {1..} = icard {0..}
 3. \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply (simp add: set_eq_iff)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>x. (Suc 0 \<le> x) = (x = Suc 0 \<or> 0 < x)
 2. icard {1..} = icard {0..}
 3. \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply (rule allI, rename_tac n)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. (Suc 0 \<le> n) = (n = Suc 0 \<or> 0 < n)
 2. icard {1..} = icard {0..}
 3. \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply (case_tac "n = 0", simp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>n. n \<noteq> 0 \<Longrightarrow> (Suc 0 \<le> n) = (n = Suc 0 \<or> 0 < n)
 2. icard {1..} = icard {0..}
 3. \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. icard {1..} = icard {0..}
 2. \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply (simp only: icard_infinite[OF infinite_atLeast])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> inj_on (\<lambda>n. if n = 0 then Suc 0 else n) {0..}
[PROOF STEP]
apply (simp add: inj_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (x = 0 \<longrightarrow> (\<exists>y>0. 0 < y \<longrightarrow> Suc 0 = y)) \<and> (0 < x \<longrightarrow> x = Suc 0)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma line_points_collinear:
  assumes "z1 \<in> line z z'" and "z2 \<in> line z z'" and "z3 \<in> line z z'" and "z \<noteq> z'"
  shows "collinear z1 z2 z3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear z1 z2 z3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z1 \<in> line z z'
z2 \<in> line z z'
z3 \<in> line z z'
z \<noteq> z'

goal (1 subgoal):
 1. collinear z1 z2 z3
[PROOF STEP]
unfolding line_def
[PROOF STATE]
proof (prove)
using this:
z1 \<in> Collect (collinear z z')
z2 \<in> Collect (collinear z z')
z3 \<in> Collect (collinear z z')
z \<noteq> z'

goal (1 subgoal):
 1. collinear z1 z2 z3
[PROOF STEP]
by (smt collinear_sym1 collinear_sym2' collinear_trans1 mem_Collect_eq)


[STATEMENT]
lemma to_poly_mult_simp:
  assumes "b \<in> carrier R"
  assumes "f \<in> carrier (UP R)"
  shows "(to_polynomial R b) \<otimes>\<^bsub>UP R\<^esub> f = b \<odot>\<^bsub>UP R\<^esub> f"
        "f  \<otimes>\<^bsub>UP R\<^esub> (to_polynomial R b) = b \<odot>\<^bsub>UP R\<^esub> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_polynomial R b \<otimes>\<^bsub>UP R\<^esub> f = b \<odot>\<^bsub>UP R\<^esub> f &&& f \<otimes>\<^bsub>UP R\<^esub> to_polynomial R b = b \<odot>\<^bsub>UP R\<^esub> f
[PROOF STEP]
unfolding to_polynomial_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom (UP R) b 0 \<otimes>\<^bsub>UP R\<^esub> f = b \<odot>\<^bsub>UP R\<^esub> f &&& f \<otimes>\<^bsub>UP R\<^esub> monom (UP R) b 0 = b \<odot>\<^bsub>UP R\<^esub> f
[PROOF STEP]
using assms  P_def monom_mult_is_smult
[PROOF STATE]
proof (prove)
using this:
b \<in> carrier R
f \<in> carrier (UP R)
P \<equiv> UP R
\<lbrakk>?a \<in> carrier R; ?p \<in> carrier P\<rbrakk> \<Longrightarrow> monom P ?a 0 \<otimes>\<^bsub>P\<^esub> ?p = ?a \<odot>\<^bsub>P\<^esub> ?p

goal (1 subgoal):
 1. monom (UP R) b 0 \<otimes>\<^bsub>UP R\<^esub> f = b \<odot>\<^bsub>UP R\<^esub> f &&& f \<otimes>\<^bsub>UP R\<^esub> monom (UP R) b 0 = b \<odot>\<^bsub>UP R\<^esub> f
[PROOF STEP]
apply auto[1]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^bsub>UP R\<^esub> monom (UP R) b 0 = b \<odot>\<^bsub>UP R\<^esub> f
[PROOF STEP]
using UP_cring.UP_m_comm UP_cring_axioms UP_ring.monom_closed
        UP_ring.monom_mult_is_smult UP_ring_axioms assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>UP_cring ?R; ?p \<in> carrier (UP ?R); ?q \<in> carrier (UP ?R)\<rbrakk> \<Longrightarrow> ?p \<otimes>\<^bsub>UP ?R\<^esub> ?q = ?q \<otimes>\<^bsub>UP ?R\<^esub> ?p
UP_cring R
\<lbrakk>UP_ring ?R; ?a \<in> carrier ?R\<rbrakk> \<Longrightarrow> monom (UP ?R) ?a ?n \<in> carrier (UP ?R)
\<lbrakk>UP_ring ?R; ?a \<in> carrier ?R; ?p \<in> carrier (UP ?R)\<rbrakk> \<Longrightarrow> monom (UP ?R) ?a 0 \<otimes>\<^bsub>UP ?R\<^esub> ?p = ?a \<odot>\<^bsub>UP ?R\<^esub> ?p
UP_ring R
b \<in> carrier R
f \<in> carrier (UP R)

goal (1 subgoal):
 1. f \<otimes>\<^bsub>UP R\<^esub> monom (UP R) b 0 = b \<odot>\<^bsub>UP R\<^esub> f
[PROOF STEP]
by fastforce


[STATEMENT]
lemma f_minus [simp]: "\<lbrakk>v\<in>carrier M; w\<in>carrier M\<rbrakk>\<Longrightarrow>f (v\<ominus>\<^bsub>M\<^esub>w) = f v \<ominus>\<^bsub>N\<^esub> f w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>v \<in> carrier M; w \<in> carrier M\<rbrakk> \<Longrightarrow> f (v \<ominus>\<^bsub>M\<^esub> w) = f v \<ominus>\<^bsub>N\<^esub> f w
[PROOF STEP]
by (simp add: a_minus_def)


[STATEMENT]
lemma closedin_compact_eq:
  fixes S :: "'a::t2_space set"
  shows
   "compact S
         \<Longrightarrow> (closedin (top_of_set S) T \<longleftrightarrow>
              compact T \<and> T \<subseteq> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact S \<Longrightarrow> closedin (top_of_set S) T = (compact T \<and> T \<subseteq> S)
[PROOF STEP]
by (metis closedin_imp_subset closedin_compact closed_subset compact_imp_closed)


[STATEMENT]
lemma permutations_of_set_empty_iff [simp]:
  "permutations_of_set A = {} \<longleftrightarrow> \<not>finite A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (permutations_of_set A = {}) = infinite A
[PROOF STEP]
unfolding permutations_of_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({xs. set xs = A \<and> distinct xs} = {}) = infinite A
[PROOF STEP]
using finite_distinct_list[of A]
[PROOF STATE]
proof (prove)
using this:
finite A \<Longrightarrow> \<exists>xs. set xs = A \<and> distinct xs

goal (1 subgoal):
 1. ({xs. set xs = A \<and> distinct xs} = {}) = infinite A
[PROOF STEP]
by auto


[STATEMENT]
lemma closed_scaleC:
  fixes S::\<open>'a::complex_normed_vector set\<close> and a :: complex
  assumes \<open>closed S\<close>
  shows \<open>closed ((*\<^sub>C) a ` S)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ((*\<^sub>C) a ` S)
[PROOF STEP]
proof (cases \<open>a = 0\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
 2. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = 0

goal (2 subgoals):
 1. a = 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
 2. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = 0

goal (1 subgoal):
 1. closed ((*\<^sub>C) a ` S)
[PROOF STEP]
apply (cases \<open>S = {}\<close>)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a = 0; S = {}\<rbrakk> \<Longrightarrow> closed ((*\<^sub>C) a ` S)
 2. \<lbrakk>a = 0; S \<noteq> {}\<rbrakk> \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
by (auto simp: image_constant)
[PROOF STATE]
proof (state)
this:
closed ((*\<^sub>C) a ` S)

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> 0

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> 0
[PROOF STEP]
have \<open>(*\<^sub>C) a ` S = (*\<^sub>C) (inverse a) -` S\<close>
[PROOF STATE]
proof (prove)
using this:
a \<noteq> 0

goal (1 subgoal):
 1. (*\<^sub>C) a ` S = (*\<^sub>C) (inverse a) -` S
[PROOF STEP]
by (auto simp add: rev_image_eqI)
[PROOF STATE]
proof (state)
this:
(*\<^sub>C) a ` S = (*\<^sub>C) (inverse a) -` S

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(*\<^sub>C) a ` S = (*\<^sub>C) (inverse a) -` S

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
have \<open>closed ((*\<^sub>C) (inverse a) -` S)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ((*\<^sub>C) (inverse a) -` S)
[PROOF STEP]
by (simp add: assms continuous_closed_vimage)
[PROOF STATE]
proof (state)
this:
closed ((*\<^sub>C) (inverse a) -` S)

goal (1 subgoal):
 1. a \<noteq> 0 \<Longrightarrow> closed ((*\<^sub>C) a ` S)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(*\<^sub>C) a ` S = (*\<^sub>C) (inverse a) -` S
closed ((*\<^sub>C) (inverse a) -` S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(*\<^sub>C) a ` S = (*\<^sub>C) (inverse a) -` S
closed ((*\<^sub>C) (inverse a) -` S)

goal (1 subgoal):
 1. closed ((*\<^sub>C) a ` S)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed ((*\<^sub>C) a ` S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_1: "0 < x \<and> 0 < y \<Longrightarrow> take x xs  = take y ys \<Longrightarrow> take 1 xs = take 1 ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < x \<and> 0 < y; take x xs = take y ys\<rbrakk> \<Longrightarrow> take 1 xs = take 1 ys
[PROOF STEP]
by (metis One_nat_def bot_nat_0.not_eq_extremum hd_take take_Suc take_eq_Nil)


[STATEMENT]
lemma field_differentiable_compose_within:
  assumes "f field_differentiable (at a within S)"
          "g field_differentiable (at (f a) within f`S)"
    shows "(g o f) field_differentiable (at a within S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<circ> f field_differentiable at a within S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f field_differentiable at a within S
g field_differentiable at (f a) within f ` S

goal (1 subgoal):
 1. g \<circ> f field_differentiable at a within S
[PROOF STEP]
unfolding field_differentiable_def
[PROOF STATE]
proof (prove)
using this:
\<exists>f'. (f has_field_derivative f') (at a within S)
\<exists>f'. (g has_field_derivative f') (at (f a) within f ` S)

goal (1 subgoal):
 1. \<exists>f'. (g \<circ> f has_field_derivative f') (at a within S)
[PROOF STEP]
by (metis DERIV_image_chain)


[STATEMENT]
lemma complex_of_real_mono:
  "x \<le> y \<Longrightarrow> complex_of_real x \<le> complex_of_real y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> complex_of_real x \<le> complex_of_real y
[PROOF STEP]
unfolding less_eq_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> Re (complex_of_real x) \<le> Re (complex_of_real y) \<and> Im (complex_of_real x) = Im (complex_of_real y)
[PROOF STEP]
by auto


[STATEMENT]
lemma NSLIMSEQ_inverse_real_of_nat: "(\<lambda>n. inverse (real (Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. inverse (real (Suc n))) \<longlonglongrightarrow>\<^sub>N\<^sub>S 0
[PROOF STEP]
by (simp add: LIMSEQ_NSLIMSEQ_iff [symmetric] LIMSEQ_inverse_real_of_nat del: of_nat_Suc)


[STATEMENT]
lemma mult_matrix_zero_closed: "\<lbrakk>fadd 0 0 = 0; zero_closed fmul\<rbrakk> \<Longrightarrow> zero_closed (mult_matrix fmul fadd)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fadd (0::'a) (0::'a) = (0::'a); zero_closed fmul\<rbrakk> \<Longrightarrow> zero_closed (mult_matrix fmul fadd)
[PROOF STEP]
apply (simp add: zero_closed_def mult_matrix_def mult_matrix_n_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>fadd (0::'a) (0::'a) = (0::'a); (\<forall>x. fmul x (0::'c) = (0::'a)) \<and> (\<forall>y. fmul (0::'b) y = (0::'a))\<rbrakk> \<Longrightarrow> (\<forall>x. Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. 0::'a) (ncols x)) = 0) \<and> (\<forall>y. Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. 0::'a) (nrows y)) = 0)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>fadd (0::'a) (0::'a) = (0::'a); \<forall>x. fmul x (0::'c) = (0::'a); \<forall>y. fmul (0::'b) y = (0::'a)\<rbrakk> \<Longrightarrow> Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. 0::'a) (ncols x)) = 0
 2. \<And>y. \<lbrakk>fadd (0::'a) (0::'a) = (0::'a); \<forall>x. fmul x (0::'c) = (0::'a); \<forall>y. fmul (0::'b) y = (0::'a)\<rbrakk> \<Longrightarrow> Abs_matrix (\<lambda>j i. foldseq fadd (\<lambda>k. 0::'a) (nrows y)) = 0
[PROOF STEP]
by (subst foldseq_zero, (simp add: zero_matrix_def)+)+


[STATEMENT]
lemma good_ruleset_append: "good_ruleset (rs\<^sub>1 @ rs\<^sub>2) \<longleftrightarrow> good_ruleset rs\<^sub>1 \<and> good_ruleset rs\<^sub>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. good_ruleset (rs\<^sub>1 @ rs\<^sub>2) = (good_ruleset rs\<^sub>1 \<and> good_ruleset rs\<^sub>2)
[PROOF STEP]
by(simp add: good_ruleset_alt, blast)


[STATEMENT]
lemma Subseqs_star [simp]: "Subseqs (star A) = star (Subseqs A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Subseqs (star A) = star (Subseqs A)
[PROOF STEP]
by (simp add: star_def)


[STATEMENT]
lemma (in pair_sigma_finite) AE_pair_iff:
  "{x\<in>space (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^sub>M M2) \<Longrightarrow>
    (AE x in M1. AE y in M2. P x y) \<longleftrightarrow> (AE x in (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> space (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^sub>M M2) \<Longrightarrow> (AE x in M1. almost_everywhere M2 (P x)) = (AE x in M1 \<Otimes>\<^sub>M M2. P (fst x) (snd x))
[PROOF STEP]
using AE_pair[of "\<lambda>x. P (fst x) (snd x)"] AE_pair_measure[of "\<lambda>x. P (fst x) (snd x)"]
[PROOF STATE]
proof (prove)
using this:
AE x in M1 \<Otimes>\<^sub>M M2. P (fst x) (snd x) \<Longrightarrow> AE x in M1. AE y in M2. P (fst (x, y)) (snd (x, y))
\<lbrakk>{x \<in> space (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^sub>M M2); AE x in M1. AE y in M2. P (fst (x, y)) (snd (x, y))\<rbrakk> \<Longrightarrow> AE x in M1 \<Otimes>\<^sub>M M2. P (fst x) (snd x)

goal (1 subgoal):
 1. {x \<in> space (M1 \<Otimes>\<^sub>M M2). P (fst x) (snd x)} \<in> sets (M1 \<Otimes>\<^sub>M M2) \<Longrightarrow> (AE x in M1. almost_everywhere M2 (P x)) = (AE x in M1 \<Otimes>\<^sub>M M2. P (fst x) (snd x))
[PROOF STEP]
by auto


[STATEMENT]
lemma inf_isotone:
  assumes "-p \<le> -q"
      and "-r \<le> -s"
    shows "-p \<sqinter> -r \<le> -q \<sqinter> -s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - p \<sqinter> - r \<le> - q \<sqinter> - s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - p \<sqinter> - r \<le> - q \<sqinter> - s
[PROOF STEP]
have "\<forall>w x y z. (-w \<le> -x \<sqinter> -y \<or> \<not> -w \<le> -x \<sqinter> -z) \<or> \<not> -z \<le> -y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>w x y z. (- w \<le> - x \<sqinter> - y \<or> \<not> - w \<le> - x \<sqinter> - z) \<or> \<not> - z \<le> - y
[PROOF STEP]
by (metis (no_types) inf_closed sub_inf_right_isotone transitive)
[PROOF STATE]
proof (state)
this:
\<forall>w x y z. (- w \<le> - x \<sqinter> - y \<or> \<not> - w \<le> - x \<sqinter> - z) \<or> \<not> - z \<le> - y

goal (1 subgoal):
 1. - p \<sqinter> - r \<le> - q \<sqinter> - s
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>w x y z. (- w \<le> - x \<sqinter> - y \<or> \<not> - w \<le> - x \<sqinter> - z) \<or> \<not> - z \<le> - y

goal (1 subgoal):
 1. - p \<sqinter> - r \<le> - q \<sqinter> - s
[PROOF STEP]
by (metis (no_types) assms inf_closed sub_inf_left_isotone)
[PROOF STATE]
proof (state)
this:
- p \<sqinter> - r \<le> - q \<sqinter> - s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closure_approachableD:
  assumes "x \<in> closure S" "e>0"
  shows "\<exists>y\<in>S. dist x y < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>y\<in>S. dist x y < e
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> closure S
0 < e

goal (1 subgoal):
 1. \<exists>y\<in>S. dist x y < e
[PROOF STEP]
unfolding closure_approachable
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>y\<in>S. dist y x < e
0 < e

goal (1 subgoal):
 1. \<exists>y\<in>S. dist x y < e
[PROOF STEP]
by (auto simp: dist_commute)


[STATEMENT]
lemma iprod_Cons[simp]: "\<langle>x#xs,y#ys\<rangle> = x*y + \<langle>xs,ys\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>x # xs,y # ys\<rangle> = x * y + \<langle>xs,ys\<rangle>
[PROOF STEP]
by(simp add: iprod_def)


[STATEMENT]
lemma (in Group) d_gchains_leastTr:"\<lbrakk>d_gchain G n f; f n \<noteq> f 0\<rbrakk>  \<Longrightarrow>
               (LEAST j. f j \<in> (f `{i. i \<le> n} - {f 0})) \<in> {i. i \<le> n} \<and>
               f  (LEAST j. f j \<in> (f `{i. i \<le> n} - {f 0})) \<noteq> f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d_gchain G n f; f n \<noteq> f 0\<rbrakk> \<Longrightarrow> (LEAST j. f j \<in> f ` {i. i \<le> n} - {f 0}) \<in> {i. i \<le> n} \<and> f (LEAST j. f j \<in> f ` {i. i \<le> n} - {f 0}) \<noteq> f 0
[PROOF STEP]
apply (frule im_d_gchainsTr1_2 [of "n" "f" "n"],
       simp add:n_in_Nsetn,
       simp add:image_def, blast,
       frule mem_of_Nset[of "LEAST j. f j \<in> f ` {i. i \<le> n} - {f 0}" "n"],
       simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d_gchain G n f; f n \<noteq> f 0; (LEAST j. f j \<in> f ` {i. i \<le> n} \<and> f j \<noteq> f 0) \<le> n\<rbrakk> \<Longrightarrow> f (LEAST j. f j \<in> f ` {i. i \<le> n} \<and> f j \<noteq> f 0) \<noteq> f 0
[PROOF STEP]
apply (frule im_d_gchainTr1[of "n" "f" "n"],
       simp add:image_def, cut_tac n_in_Nsetn[of "n"], blast)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>d_gchain G n f; f n \<noteq> f 0; (LEAST j. f j \<in> f ` {i. i \<le> n} \<and> f j \<noteq> f 0) \<le> n; f (LEAST j. f j \<in> f ` {i. i \<le> n} - {f 0}) \<in> f ` {i. i \<le> n} - {f 0}\<rbrakk> \<Longrightarrow> f (LEAST j. f j \<in> f ` {i. i \<le> n} \<and> f j \<noteq> f 0) \<noteq> f 0
[PROOF STEP]
apply (simp add:image_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cat_prod_CId_app_component[cat_cs_simps]:
  assumes "a \<in>\<^sub>\<circ> (\<Prod>\<^sub>Ci\<in>\<^sub>\<circ>I. \<AA> i)\<lparr>Obj\<rparr>" and "i \<in>\<^sub>\<circ> I"
  shows "(\<Prod>\<^sub>Ci\<in>\<^sub>\<circ>I. \<AA> i)\<lparr>CId\<rparr>\<lparr>a\<rparr>\<lparr>i\<rparr> = \<AA> i\<lparr>CId\<rparr>\<lparr>a\<lparr>i\<rparr>\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cat_prod I \<AA>\<lparr>CId\<rparr>\<lparr>a\<rparr>\<lparr>i\<rparr> = \<AA> i\<lparr>CId\<rparr>\<lparr>a\<lparr>i\<rparr>\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> cat_prod I \<AA>\<lparr>Obj\<rparr>
i \<in>\<^sub>\<circ> I

goal (1 subgoal):
 1. cat_prod I \<AA>\<lparr>CId\<rparr>\<lparr>a\<rparr>\<lparr>i\<rparr> = \<AA> i\<lparr>CId\<rparr>\<lparr>a\<lparr>i\<rparr>\<rparr>
[PROOF STEP]
unfolding cat_prod_components
[PROOF STATE]
proof (prove)
using this:
a \<in>\<^sub>\<circ> (\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. \<AA> i\<lparr>Obj\<rparr>)
i \<in>\<^sub>\<circ> I

goal (1 subgoal):
 1. (\<lambda>a\<in>\<^sub>\<circ>\<Prod>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. \<AA> i\<lparr>Obj\<rparr>. \<lambda>i\<in>\<^sub>\<circ>I. \<AA> i\<lparr>CId\<rparr>\<lparr>a\<lparr>i\<rparr>\<rparr>)\<lparr>a\<rparr>\<lparr>i\<rparr> = \<AA> i\<lparr>CId\<rparr>\<lparr>a\<lparr>i\<rparr>\<rparr>
[PROOF STEP]
by simp


[STATEMENT]
lemma sqrt_float_interval:
  "sqrt ` set_of (real_interval X) \<subseteq> set_of (real_interval (sqrt_float_interval prec X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ` set_of (real_interval X) \<subseteq> set_of (real_interval (sqrt_float_interval prec X))
[PROOF STEP]
using bnds_sqrt
[PROOF STATE]
proof (prove)
using this:
\<forall>x lx ux. (?l, ?u) = (lb_sqrt ?prec lx, ub_sqrt ?prec ux) \<and> x \<in> {real_of_float lx..real_of_float ux} \<longrightarrow> real_of_float ?l \<le> sqrt x \<and> sqrt x \<le> real_of_float ?u

goal (1 subgoal):
 1. sqrt ` set_of (real_interval X) \<subseteq> set_of (real_interval (sqrt_float_interval prec X))
[PROOF STEP]
by (auto simp: set_of_eq lower_float_interval upper_float_interval)


[STATEMENT]
lemma continuous_diff [continuous_intros]:
  fixes f g :: "'a::t2_space \<Rightarrow> 'b::topological_group_add"
  shows "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. f x - g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. f x - g x)
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F; (g \<longlongrightarrow> g (Lim F (\<lambda>x. x))) F\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) \<longlongrightarrow> f (Lim F (\<lambda>x. x)) - g (Lim F (\<lambda>x. x))) F
[PROOF STEP]
by (rule tendsto_diff)


[STATEMENT]
lemma property_empty_interval: "\<forall>a b. content (cbox a b) = 0 \<longrightarrow> P (cbox a b) \<Longrightarrow> P {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a b. content (cbox a b) = 0 \<longrightarrow> P (cbox a b) \<Longrightarrow> P {}
[PROOF STEP]
using content_empty
[PROOF STATE]
proof (prove)
using this:
content {} = 0

goal (1 subgoal):
 1. \<forall>a b. content (cbox a b) = 0 \<longrightarrow> P (cbox a b) \<Longrightarrow> P {}
[PROOF STEP]
unfolding empty_as_interval
[PROOF STATE]
proof (prove)
using this:
content (cbox One (0::?'a)) = 0

goal (1 subgoal):
 1. \<forall>a b. content (cbox a b) = 0 \<longrightarrow> P (cbox a b) \<Longrightarrow> P (cbox One (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma decomp_size_mset_less:
  assumes "length ss = length ts"
  shows "size_mset (M + mset (zip ss ts)) < size_mset (M + {#(Fun f ss, Fun f ts)#})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size_mset (M + mset (zip ss ts)) < size_mset (M + {#(Fun f ss, Fun f ts)#})
[PROOF STEP]
using assms and size_mset_Fun_less [of ss ts f f]
[PROOF STATE]
proof (prove)
using this:
length ss = length ts
size_mset (mset (zip ss ts)) < size_mset {#(Fun f ss, Fun f ts)#}

goal (1 subgoal):
 1. size_mset (M + mset (zip ss ts)) < size_mset (M + {#(Fun f ss, Fun f ts)#})
[PROOF STEP]
by simp


[STATEMENT]
lemma fps_sin_add: "fps_sin (a + b) = fps_sin a * fps_cos b + fps_cos a * fps_sin b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_sin (a + b) = fps_sin a * fps_cos b + fps_cos a * fps_sin b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_sin (a + b) = fps_sin a * fps_cos b + fps_cos a * fps_sin b
[PROOF STEP]
have "fps_deriv (fps_deriv (fps_sin a * fps_cos b + fps_cos a * fps_sin b)) =
         - (fps_const (a + b) * fps_const (a + b) * (fps_sin a * fps_cos b + fps_cos a * fps_sin b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_deriv (fps_deriv (fps_sin a * fps_cos b + fps_cos a * fps_sin b)) = - (fps_const (a + b) * fps_const (a + b) * (fps_sin a * fps_cos b + fps_cos a * fps_sin b))
[PROOF STEP]
by (simp flip: fps_const_neg fps_const_add fps_const_mult
        add: fps_sin_deriv fps_cos_deriv algebra_simps)
[PROOF STATE]
proof (state)
this:
fps_deriv (fps_deriv (fps_sin a * fps_cos b + fps_cos a * fps_sin b)) = - (fps_const (a + b) * fps_const (a + b) * (fps_sin a * fps_cos b + fps_cos a * fps_sin b))

goal (1 subgoal):
 1. fps_sin (a + b) = fps_sin a * fps_cos b + fps_cos a * fps_sin b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps_deriv (fps_deriv (fps_sin a * fps_cos b + fps_cos a * fps_sin b)) = - (fps_const (a + b) * fps_const (a + b) * (fps_sin a * fps_cos b + fps_cos a * fps_sin b))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fps_deriv (fps_deriv (fps_sin a * fps_cos b + fps_cos a * fps_sin b)) = - (fps_const (a + b) * fps_const (a + b) * (fps_sin a * fps_cos b + fps_cos a * fps_sin b))

goal (1 subgoal):
 1. fps_sin (a + b) = fps_sin a * fps_cos b + fps_cos a * fps_sin b
[PROOF STEP]
by (auto intro: eq_fps_sin)
[PROOF STATE]
proof (state)
this:
fps_sin (a + b) = fps_sin a * fps_cos b + fps_cos a * fps_sin b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fps_inverse_eq_0_iff':
  fixes f :: "'a::{ab_group_add,inverse,mult_zero} fps"
  shows "inverse f = 0 \<longleftrightarrow> inverse (f $ 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inverse f = 0) = (inverse (f $ 0) = (0::'a))
[PROOF STEP]
by    (simp add: fps_inverse_def fps_lr_inverse_eq_0_iff(2))


[STATEMENT]
lemma sum_encode: "(\<Sum>i = 0..<d1. \<Sum>j = 0..<d2. f i j) = sum (\<lambda>k. f (encode1 k) (encode2 k)) {0..<d}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<d1. sum (f i) {0..<d2}) = (\<Sum>k = 0..<d. f (encode1 k) (encode2 k))
[PROOF STEP]
apply (subst sum.cartesian_product)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(x, y)\<in>{0..<d1} \<times> {0..<d2}. f x y) = (\<Sum>k = 0..<d. f (encode1 k) (encode2 k))
[PROOF STEP]
apply (rule sum.reindex_bij_witness[where i="\<lambda>k. (encode1 k, encode2 k)" and j=encode12])
[PROOF STATE]
proof (prove)
goal (5 subgoals):
 1. \<And>a. a \<in> {0..<d1} \<times> {0..<d2} \<Longrightarrow> (encode1 (encode12 a), encode2 (encode12 a)) = a
 2. \<And>a. a \<in> {0..<d1} \<times> {0..<d2} \<Longrightarrow> encode12 a \<in> {0..<d}
 3. \<And>b. b \<in> {0..<d} \<Longrightarrow> encode12 (encode1 b, encode2 b) = b
 4. \<And>b. b \<in> {0..<d} \<Longrightarrow> (encode1 b, encode2 b) \<in> {0..<d1} \<times> {0..<d2}
 5. \<And>a. a \<in> {0..<d1} \<times> {0..<d2} \<Longrightarrow> f (encode1 (encode12 a)) (encode2 (encode12 a)) = (case a of (x, xa) \<Rightarrow> f x xa)
[PROOF STEP]
by (auto simp: encode12_inv1 encode12_inv2 encode12_inv encode12_lt)


[STATEMENT]
lemma contractible_imp_connected_space:
   "contractible_space X \<Longrightarrow> connected_space X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space X \<Longrightarrow> connected_space X
[PROOF STEP]
by (simp add: contractible_imp_path_connected_space path_connected_imp_connected_space)


[STATEMENT]
lemma forall_one: "(\<forall>(x::'a ^1). P x) \<longleftrightarrow> (\<forall>x. P(\<chi> i. x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. P x) = (\<forall>x. P (\<chi>i. x))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<forall>x. P (\<chi>i. x) \<Longrightarrow> P x
[PROOF STEP]
apply (erule_tac x= "x$1" in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. P (\<chi>i. x $ 1) \<Longrightarrow> P x
[PROOF STEP]
apply (simp only: vector_one[symmetric])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iso_set_refl: "(\<lambda>x. x) \<in> iso G G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x) \<in> Group.iso G G
[PROOF STEP]
by (simp add: iso_def hom_def inj_on_def bij_betw_def Pi_def)


[STATEMENT]
lemma Qp_funs_mult'':
  assumes "f \<in> (carrier (Fun\<^bsub>n\<^esub> Q\<^sub>p))"
  assumes "g \<in> (carrier (Fun\<^bsub>n\<^esub> Q\<^sub>p))"
  shows "(f \<otimes>\<^bsub>Fun\<^bsub>n\<^esub> Q\<^sub>p\<^esub> g) = (\<lambda> x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<otimes> g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^bsub>function_ring (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<^esub> g = (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<otimes> g x)
[PROOF STEP]
unfolding function_ring_def function_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^bsub>\<lparr>carrier = carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow>\<^sub>E carrier Q\<^sub>p, monoid.mult = \<lambda>f g. \<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<otimes> g x, one = function_one (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, zero = function_zero (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, add = function_add (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, smult = function_scalar_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<rparr>\<^esub> g = (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<otimes> g x)
[PROOF STEP]
using ring_record_simps(5)
[PROOF STATE]
proof (prove)
using this:
(\<otimes>\<^bsub>\<lparr>carrier = ?carrier, monoid.mult = ?mult, one = ?one, \<dots> = ?more\<rparr>\<^esub>) = ?mult

goal (1 subgoal):
 1. f \<otimes>\<^bsub>\<lparr>carrier = carrier (Q\<^sub>p\<^bsup>n\<^esup>) \<rightarrow>\<^sub>E carrier Q\<^sub>p, monoid.mult = \<lambda>f g. \<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<otimes> g x, one = function_one (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, zero = function_zero (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, add = function_add (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p, smult = function_scalar_mult (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) Q\<^sub>p\<rparr>\<^esub> g = (\<lambda>x\<in>carrier (Q\<^sub>p\<^bsup>n\<^esup>). f x \<otimes> g x)
[PROOF STEP]
by metis


[STATEMENT]
lemma cis_pi_half [simp]: "cis (pi / 2) = \<i>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cis (pi / 2) = \<i>
[PROOF STEP]
by (simp add: complex_eq_iff)


[STATEMENT]
lemma mod_0_less_div_conv: "
  n mod (m::nat) = 0 \<Longrightarrow> (k * m < n) = (k < n div m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n mod m = 0 \<Longrightarrow> (k * m < n) = (k < n div m)
[PROOF STEP]
apply (case_tac "m = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n mod m = 0; m \<noteq> 0\<rbrakk> \<Longrightarrow> (k * m < n) = (k < n div m)
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma H_iso_fInf:
  fixes F :: "('a \<Rightarrow> 'b::complete_lattice) set"
  shows "(\<forall>f \<in> F. x \<le> f y) \<Longrightarrow> x \<le> (\<Sqinter>F) y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>f\<in>F. x \<le> f y \<Longrightarrow> x \<le> (\<Sqinter> F) y
[PROOF STEP]
by (simp add: le_INF_iff)


[STATEMENT]
theorem "DA.accepts (na2da(rexp2na r)) w = (w : lang r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. DA.accepts (na2da (rexp2na r)) w = (w \<in> lang r)
[PROOF STEP]
by (simp add: NA_DA_equiv[THEN sym] accepts_rexp2na)


[STATEMENT]
theorem i_Exec_Stream_causal: "
  input1 \<Down> n = input2 \<Down> n \<Longrightarrow>
  (i_Exec_Comp_Stream trans_fun input1 c) \<Down> n = (i_Exec_Comp_Stream trans_fun input2 c) \<Down> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. input1 \<Down> n = input2 \<Down> n \<Longrightarrow> i_Exec_Comp_Stream trans_fun input1 c \<Down> n = i_Exec_Comp_Stream trans_fun input2 c \<Down> n
[PROOF STEP]
by (simp add: i_Exec_Stream_take)


[STATEMENT]
lemma mertens_third_theorem_asymp_equiv:
  "(\<lambda>x. (\<Prod>p | prime p \<and> real p \<le> x. 1 - 1 / real p)) \<sim>[at_top]
     (\<lambda>x. third_mertens_const / ln x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<Prod>p\<in>{p. prime p \<and> real p \<le> x}. 1 - 1 / real p) \<sim>[at_top] (\<lambda>x. third_mertens_const / ln x)
[PROOF STEP]
by (rule smallo_imp_asymp_equiv[OF landau_o.big_small_trans[OF mertens_third_theorem]])
     (use third_mertens_const_pos in real_asymp)


[STATEMENT]
lemma trivial_LCoset: "H\<subseteq>G \<Longrightarrow> H = LCoset_rel H `` {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H \<subseteq> G \<Longrightarrow> H = LCoset_rel H `` {0::'g}
[PROOF STEP]
using zero_closed
[PROOF STATE]
proof (prove)
using this:
(0::'g) \<in> G

goal (1 subgoal):
 1. H \<subseteq> G \<Longrightarrow> H = LCoset_rel H `` {0::'g}
[PROOF STEP]
unfolding lcoset_rel_def
[PROOF STATE]
proof (prove)
using this:
(0::'g) \<in> G

goal (1 subgoal):
 1. H \<subseteq> G \<Longrightarrow> H = Restr {(x, y). - x + y \<in> H} G `` {0::'g}
[PROOF STEP]
by auto


[STATEMENT]
lemma replace_comp_portfolio:
  assumes "portfolio pf1"
  and "portfolio pf2"
shows "portfolio (qty_replace_comp pf1 x pf2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. portfolio (qty_replace_comp pf1 x pf2)
[PROOF STEP]
unfolding portfolio_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (support_set (qty_replace_comp pf1 x pf2))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite (support_set (qty_replace_comp pf1 x pf2))
[PROOF STEP]
have "support_set (qty_replace_comp pf1 x pf2) \<subseteq> (support_set pf1) \<union> (support_set pf2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 \<union> support_set pf2
[PROOF STEP]
using replace_comp_support_set[of pf1 x pf2]
[PROOF STATE]
proof (prove)
using this:
support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 - {x} \<union> support_set pf2

goal (1 subgoal):
 1. support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 \<union> support_set pf2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 \<union> support_set pf2

goal (1 subgoal):
 1. finite (support_set (qty_replace_comp pf1 x pf2))
[PROOF STEP]
thus "finite (support_set (qty_replace_comp pf1 x pf2))"
[PROOF STATE]
proof (prove)
using this:
support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 \<union> support_set pf2

goal (1 subgoal):
 1. finite (support_set (qty_replace_comp pf1 x pf2))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 \<union> support_set pf2
portfolio pf1
portfolio pf2

goal (1 subgoal):
 1. finite (support_set (qty_replace_comp pf1 x pf2))
[PROOF STEP]
unfolding portfolio_def
[PROOF STATE]
proof (prove)
using this:
support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 \<union> support_set pf2
finite (support_set pf1)
finite (support_set pf2)

goal (1 subgoal):
 1. finite (support_set (qty_replace_comp pf1 x pf2))
[PROOF STEP]
using infinite_super
[PROOF STATE]
proof (prove)
using this:
support_set (qty_replace_comp pf1 x pf2) \<subseteq> support_set pf1 \<union> support_set pf2
finite (support_set pf1)
finite (support_set pf2)
\<lbrakk>?S \<subseteq> ?T; infinite ?S\<rbrakk> \<Longrightarrow> infinite ?T

goal (1 subgoal):
 1. finite (support_set (qty_replace_comp pf1 x pf2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (support_set (qty_replace_comp pf1 x pf2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem transpose_rectangle:
  assumes "xs = [] \<Longrightarrow> n = 0"
  assumes rect: "\<And> i. i < length xs \<Longrightarrow> length (xs ! i) = n"
  shows "transpose xs = map (\<lambda> i. map (\<lambda> j. xs ! j ! i) [0..<length xs]) [0..<n]"
    (is "?trans = ?map")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. transpose xs = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n]
[PROOF STEP]
proof (rule nth_equalityI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])
 2. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
have "sorted (rev (map length xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (rev (map length xs))
[PROOF STEP]
by (auto simp: rev_nth rect sorted_iff_nth_mono)
[PROOF STATE]
proof (state)
this:
sorted (rev (map length xs))

goal (2 subgoals):
 1. length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])
 2. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
from foldr_max_sorted[OF this] assms
[PROOF STATE]
proof (chain)
picking this:
foldr max (map length xs) ?y = (if map length xs = [] then ?y else max (map length xs ! 0) ?y)
xs = [] \<Longrightarrow> n = 0
?i < length xs \<Longrightarrow> length (xs ! ?i) = n
[PROOF STEP]
show len: "length ?trans = length ?map"
[PROOF STATE]
proof (prove)
using this:
foldr max (map length xs) ?y = (if map length xs = [] then ?y else max (map length xs ! 0) ?y)
xs = [] \<Longrightarrow> n = 0
?i < length xs \<Longrightarrow> length (xs ! ?i) = n

goal (1 subgoal):
 1. length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])
[PROOF STEP]
by (simp_all add: length_transpose foldr_map comp_def)
[PROOF STATE]
proof (state)
this:
length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])

goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])

goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])

goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
assume "i < n"
[PROOF STATE]
proof (state)
this:
i < n

goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
hence "filter (\<lambda>ys. i < length ys) xs = xs"
[PROOF STATE]
proof (prove)
using this:
i < n

goal (1 subgoal):
 1. filter (\<lambda>ys. i < length ys) xs = xs
[PROOF STEP]
using rect
[PROOF STATE]
proof (prove)
using this:
i < n
?i < length xs \<Longrightarrow> length (xs ! ?i) = n

goal (1 subgoal):
 1. filter (\<lambda>ys. i < length ys) xs = xs
[PROOF STEP]
by (auto simp: in_set_conv_nth intro!: filter_True)
[PROOF STATE]
proof (state)
this:
filter (\<lambda>ys. i < length ys) xs = xs

goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?i2 < n \<Longrightarrow> filter (\<lambda>ys. ?i2 < length ys) xs = xs

goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])
?i2 < n \<Longrightarrow> filter (\<lambda>ys. ?i2 < length ys) xs = xs
[PROOF STEP]
show "\<And>i. i < length (transpose xs) \<Longrightarrow> ?trans ! i = ?map ! i"
[PROOF STATE]
proof (prove)
using this:
length (transpose xs) = length (map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n])
?i2 < n \<Longrightarrow> filter (\<lambda>ys. ?i2 < length ys) xs = xs

goal (1 subgoal):
 1. \<And>i. i < length (transpose xs) \<Longrightarrow> transpose xs ! i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! i
[PROOF STEP]
by (auto simp: nth_transpose intro: nth_equalityI)
[PROOF STATE]
proof (state)
this:
?i < length (transpose xs) \<Longrightarrow> transpose xs ! ?i = map (\<lambda>i. map (\<lambda>j. xs ! j ! i) [0..<length xs]) [0..<n] ! ?i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compos_aI_l:"\<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compos A aI\<^bsub>B\<^esub> f = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compos A aI\<^bsub>B\<^esub> f = f
[PROOF STEP]
apply (simp add:compos_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compose (carrier A) aI\<^bsub>B\<^esub> f = f
[PROOF STEP]
apply (rule funcset_eq[of _ "carrier A"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> compose (carrier A) aI\<^bsub>B\<^esub> f \<in> extensional (carrier A)
 2. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> f \<in> extensional (carrier A)
 3. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier A. compose (carrier A) aI\<^bsub>B\<^esub> f x = f x
[PROOF STEP]
apply (simp add:compose_def extensional_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> f \<in> extensional (carrier A)
 2. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier A. compose (carrier A) aI\<^bsub>B\<^esub> f x = f x
[PROOF STEP]
apply (simp add:aHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B\<rbrakk> \<Longrightarrow> \<forall>x\<in>carrier A. compose (carrier A) aI\<^bsub>B\<^esub> f x = f x
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; x \<in> carrier A\<rbrakk> \<Longrightarrow> compose (carrier A) aI\<^bsub>B\<^esub> f x = f x
[PROOF STEP]
apply (frule_tac a = x in aHom_mem[of "A" "B" "f"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>aGroup A; aGroup B; f \<in> aHom A B; x \<in> carrier A; f x \<in> carrier B\<rbrakk> \<Longrightarrow> compose (carrier A) aI\<^bsub>B\<^esub> f x = f x
[PROOF STEP]
apply (simp add:compose_def ag_idmap_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bisimulation_trans[trans]:
    assumes "bisimulation R1 A B"
    assumes "bisimulation R2 B C"
    shows "bisimulation (R1 O R2) A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bisimulation (R1 O R2) A C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bisimulation (R1 O R2) A C
[PROOF STEP]
interpret s1: bisimulation R1 A B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bisimulation R1 A B
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bisimulation (R1 O R2) A C
[PROOF STEP]
interpret s2: bisimulation R2 B C
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bisimulation R2 B C
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bisimulation (R1 O R2) A C
[PROOF STEP]
interpret t1: simulation "(R1 O R2)" A C
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simulation (R1 O R2) A C
[PROOF STEP]
using simulation_trans s1.s1.simulation_this s2.s1.simulation_this
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>simulation ?R1.0 ?A ?B; simulation ?R2.0 ?B ?C\<rbrakk> \<Longrightarrow> simulation (?R1.0 O ?R2.0) ?A ?C
simulation R1 A B
simulation R2 B C

goal (1 subgoal):
 1. simulation (R1 O R2) A C
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bisimulation (R1 O R2) A C
[PROOF STEP]
interpret t2: simulation "(R1 O R2)\<inverse>" C A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simulation ((R1 O R2)\<inverse>) C A
[PROOF STEP]
using simulation_trans s2.s2.simulation_this s1.s2.simulation_this
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>simulation ?R1.0 ?A ?B; simulation ?R2.0 ?B ?C\<rbrakk> \<Longrightarrow> simulation (?R1.0 O ?R2.0) ?A ?C
simulation (R2\<inverse>) C B
simulation (R1\<inverse>) B A

goal (1 subgoal):
 1. simulation ((R1 O R2)\<inverse>) C A
[PROOF STEP]
unfolding converse_relcomp
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>simulation ?R1.0 ?A ?B; simulation ?R2.0 ?B ?C\<rbrakk> \<Longrightarrow> simulation (?R1.0 O ?R2.0) ?A ?C
simulation (R2\<inverse>) C B
simulation (R1\<inverse>) B A

goal (1 subgoal):
 1. simulation (R2\<inverse> O R1\<inverse>) C A
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bisimulation (R1 O R2) A C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bisimulation (R1 O R2) A C
[PROOF STEP]
by unfold_locales
[PROOF STATE]
proof (state)
this:
bisimulation (R1 O R2) A C

goal:
No subgoals!
[PROOF STEP]
qed