[STATEMENT]
lemma uedge_in_set_eq: "uedge (u, v) \<in> uedge ` S \<longleftrightarrow> (u,v)\<in>S \<or> (v,u)\<in>S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (uedge (u, v) \<in> uedge ` S) = ((u, v) \<in> S \<or> (v, u) \<in> S)
[PROOF STEP]
by (auto simp: uedge_def doubleton_eq_iff)


[STATEMENT]
lemma sum_mset_product:
  fixes f :: "'a::{comm_monoid_add,times} \<Rightarrow> 'b::semiring_0"
  shows "(\<Sum>i \<in># A. f i) * (\<Sum>i \<in># B. g i) = (\<Sum>i\<in>#A. \<Sum>j\<in>#B. f i * g j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum>\<^sub># (image_mset f A) * \<Sum>\<^sub># (image_mset g B) = (\<Sum>i\<in>#A. \<Sum>j\<in>#B. f i * g j)
[PROOF STEP]
by (subst sum_mset.swap) (simp add: sum_mset_distrib_left sum_mset_distrib_right)


[STATEMENT]
lemma cinner_divide_right:
  fixes a :: "'a :: {complex_inner,complex_div_algebra}"
  shows "cinner a (b / of_complex m) = (cinner a b) / m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cinner a (b / of_complex m) = cinner a b / m
[PROOF STEP]
by (metis cinner_mult_right' divide_inverse of_complex_inverse)


[STATEMENT]
lemma circline_set_fix_iff_circline_fix:
  assumes "circline_set H' \<noteq> {}"
  shows "circline_set (moebius_circline M H) = circline_set H' \<longleftrightarrow>
         moebius_circline M H = H'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (circline_set (moebius_circline M H) = circline_set H') = (moebius_circline M H = H')
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
circline_set H' \<noteq> {}

goal (1 subgoal):
 1. (circline_set (moebius_circline M H) = circline_set H') = (moebius_circline M H = H')
[PROOF STEP]
by auto (rule inj_circline_set, auto)


[STATEMENT]
lemma mpoly_coeff_prod_0: "coeff (\<Prod>x\<in>A. f x) 0 = (\<Prod>x\<in>A. coeff (f x) 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (prod f A) 0 = (\<Prod>x\<in>A. MPoly_Type.coeff (f x) 0)
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto simp: mpoly_coeff_times_0 mpoly_coeff_1)


[STATEMENT]
lemma (in vectorspace) dim1I:
assumes "gen_set {v}"
assumes "v \<noteq> \<zero>\<^bsub>V\<^esub>" "v \<in> carrier V"
shows "dim = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dim = 1
[PROOF STEP]
have "basis {v}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis {v}
[PROOF STEP]
by (metis assms(1) assms(2) assms(3) basis_def empty_iff empty_subsetI
   finite.emptyI finite_lin_indpt2 insert_iff insert_subset insert_union lin_dep_iff_in_span
   span_empty)
[PROOF STATE]
proof (state)
this:
basis {v}

goal (1 subgoal):
 1. dim = 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
basis {v}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
basis {v}

goal (1 subgoal):
 1. dim = 1
[PROOF STEP]
using dim_basis
[PROOF STATE]
proof (prove)
using this:
basis {v}
\<lbrakk>finite ?A; basis ?A\<rbrakk> \<Longrightarrow> dim = card ?A

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lformula_nFAND: "lformula (nFAND \<phi>s) = (\<forall>\<phi> \<in> set \<phi>s. lformula \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lformula (nFAND \<phi>s) = Ball (set \<phi>s) lformula
[PROOF STEP]
by (induct \<phi>s rule: nFAND.induct) auto


[STATEMENT]
lemma downset_set_prop_var: "\<Down>X = (\<Union>x \<in> X. \<down>x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Down> X = \<Union> (\<down> ` X)
[PROOF STEP]
by (simp add: downset_set_prop)


[STATEMENT]
lemma divisors_eq_dvd[iff]: "(a \<in> divisors(n)) \<longleftrightarrow> (a dvd n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> divisors n) = (a dvd n)
[PROOF STEP]
by(simp add: divisors_def)


[STATEMENT]
theorem Ex1_Normal_form: "(f \<in> Ex1) = (\<exists>k. \<forall>n. f(n) = n + k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> CofGroups.Ex1) = (\<exists>k. \<forall>n. f n = n + k)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f \<in> CofGroups.Ex1 \<Longrightarrow> \<exists>k. \<forall>n. f n = n + k
 2. \<exists>k. \<forall>n. f n = n + k \<Longrightarrow> f \<in> CofGroups.Ex1
[PROOF STEP]
assume "f \<in> Ex1"
[PROOF STATE]
proof (state)
this:
f \<in> CofGroups.Ex1

goal (2 subgoals):
 1. f \<in> CofGroups.Ex1 \<Longrightarrow> \<exists>k. \<forall>n. f n = n + k
 2. \<exists>k. \<forall>n. f n = n + k \<Longrightarrow> f \<in> CofGroups.Ex1
[PROOF STEP]
with Ex1_Normal_form_part1 [of f]
[PROOF STATE]
proof (chain)
picking this:
f \<in> CofGroups.Ex1 \<Longrightarrow> \<exists>k. \<forall>n. f n = n + k
f \<in> CofGroups.Ex1
[PROOF STEP]
show "(\<exists>k. \<forall>n. f(n) = n + k)"
[PROOF STATE]
proof (prove)
using this:
f \<in> CofGroups.Ex1 \<Longrightarrow> \<exists>k. \<forall>n. f n = n + k
f \<in> CofGroups.Ex1

goal (1 subgoal):
 1. \<exists>k. \<forall>n. f n = n + k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>k. \<forall>n. f n = n + k

goal (1 subgoal):
 1. \<exists>k. \<forall>n. f n = n + k \<Longrightarrow> f \<in> CofGroups.Ex1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>k. \<forall>n. f n = n + k \<Longrightarrow> f \<in> CofGroups.Ex1
[PROOF STEP]
assume "\<exists>k. \<forall>n. f(n) = n + k"
[PROOF STATE]
proof (state)
this:
\<exists>k. \<forall>n. f n = n + k

goal (1 subgoal):
 1. \<exists>k. \<forall>n. f n = n + k \<Longrightarrow> f \<in> CofGroups.Ex1
[PROOF STEP]
with Ex1_Normal_form_part2
[PROOF STATE]
proof (chain)
picking this:
\<forall>f. (\<forall>n. f n = n + ?k) \<longrightarrow> f \<in> CofGroups.Ex1
\<exists>k. \<forall>n. f n = n + k
[PROOF STEP]
show "f \<in> Ex1"
[PROOF STATE]
proof (prove)
using this:
\<forall>f. (\<forall>n. f n = n + ?k) \<longrightarrow> f \<in> CofGroups.Ex1
\<exists>k. \<forall>n. f n = n + k

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Order) le_neq_less: "\<lbrakk>a \<preceq> b; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<prec> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<preceq> b; a \<noteq> b\<rbrakk> \<Longrightarrow> a \<prec> b
[PROOF STEP]
by (simp add: oless_def)


[STATEMENT]
lemma hyperpow_hrabs: "\<And>r n. \<bar>r::'a::{linordered_idom} star\<bar> pow n = \<bar>r pow n\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>r n. \<bar>r\<bar> pow n = \<bar>r pow n\<bar>
[PROOF STEP]
by transfer (rule power_abs [symmetric])


[STATEMENT]
lemma sub_mult:
  assumes "g \<in> carrier P"
  assumes "f \<in> carrier P"
  assumes "h \<in>carrier P"
  shows "((f \<otimes>\<^bsub>P\<^esub> h) of g) = ((f of g) \<otimes>\<^bsub>P\<^esub> (h of g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Cring_Poly.compose R (f \<otimes>\<^bsub>P\<^esub> h) g = Cring_Poly.compose R f g \<otimes>\<^bsub>P\<^esub> Cring_Poly.compose R h g
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) rev_sub_mult sub_rev_sub)


[STATEMENT]
lemma graph_antimono: "antimono (graph A w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (\<le>) (\<lambda>x y. y \<subseteq> x) (graph A w)
[PROOF STEP]
using alternate_antimono clean_decreasing prune_decreasing
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. ?f x \<le> x; \<And>x. ?g x \<le> x\<rbrakk> \<Longrightarrow> decseq (alternate ?f ?g)
clean ?A ?w ?V \<subseteq> ?V
prune ?A ?w ?V \<subseteq> ?V

goal (1 subgoal):
 1. monotone (\<le>) (\<lambda>x y. y \<subseteq> x) (graph A w)
[PROOF STEP]
unfolding monotone_def le_fun_def graph_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. ?f x \<le> x; \<And>x. ?g x \<le> x\<rbrakk> \<Longrightarrow> \<forall>x y. x \<le> y \<longrightarrow> (\<forall>xa. alternate ?f ?g y xa \<le> alternate ?f ?g x xa)
clean ?A ?w ?V \<subseteq> ?V
prune ?A ?w ?V \<subseteq> ?V

goal (1 subgoal):
 1. \<forall>x y. x \<le> y \<longrightarrow> alternate (clean A w) (prune A w) y (gunodes A w) \<subseteq> alternate (clean A w) (prune A w) x (gunodes A w)
[PROOF STEP]
by metis


[STATEMENT]
lemma le_append:
  assumes "length xs = length vs"
  shows "xs @ ys \<le>\<^sub>v vs @ ws \<longleftrightarrow> xs \<le>\<^sub>v vs \<and> ys \<le>\<^sub>v ws"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs @ ys \<le>\<^sub>v vs @ ws) = (xs \<le>\<^sub>v vs \<and> ys \<le>\<^sub>v ws)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length vs

goal (1 subgoal):
 1. (xs @ ys \<le>\<^sub>v vs @ ws) = (xs \<le>\<^sub>v vs \<and> ys \<le>\<^sub>v ws)
[PROOF STEP]
by (auto simp: less_eq_def nth_append)
    (metis add.commute add_diff_cancel_left' nat_add_left_cancel_less not_add_less2)


[STATEMENT]
lemma ok_Join_commute:
     "(F ok G & (F\<squnion>G) ok H) = (G ok H & F ok (G\<squnion>H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F ok G \<and> F \<squnion> G ok H) = (G ok H \<and> F ok (G \<squnion> H))
[PROOF STEP]
by (auto simp add: ok_def)


[STATEMENT]
lemma inj_op_nth:
  fixes X::"'a::{field}^'n^'n"
  assumes is_basis: "is_basis (set_of_vector X)"
  shows "inj (($) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (($) X)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inj (($) X)
[PROOF STEP]
have fact_1: "set_of_vector X = range (($) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_vector X = range (($) X)
[PROOF STEP]
unfolding set_of_vector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {X $ i |i. i \<in> UNIV} = range (($) X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set_of_vector X = range (($) X)

goal (1 subgoal):
 1. inj (($) X)
[PROOF STEP]
have card_set_of_vector:"card(set_of_vector X) = CARD('n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set_of_vector X) = CARD('n)
[PROOF STEP]
using independent_is_basis[of "set_of_vector X"]
[PROOF STATE]
proof (prove)
using this:
(vec.independent (set_of_vector X) \<and> card (set_of_vector X) = CARD('n)) = is_basis (set_of_vector X)

goal (1 subgoal):
 1. card (set_of_vector X) = CARD('n)
[PROOF STEP]
using is_basis
[PROOF STATE]
proof (prove)
using this:
(vec.independent (set_of_vector X) \<and> card (set_of_vector X) = CARD('n)) = is_basis (set_of_vector X)
is_basis (set_of_vector X)

goal (1 subgoal):
 1. card (set_of_vector X) = CARD('n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (set_of_vector X) = CARD('n)

goal (1 subgoal):
 1. inj (($) X)
[PROOF STEP]
show "inj (($) X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj (($) X)
[PROOF STEP]
proof (rule eq_card_imp_inj_on)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite UNIV
 2. card (range (($) X)) = CARD('n)
[PROOF STEP]
show "finite (UNIV::'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
using finite_class.finite_UNIV
[PROOF STATE]
proof (prove)
using this:
finite UNIV

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

goal (1 subgoal):
 1. card (range (($) X)) = CARD('n)
[PROOF STEP]
show "card (range (($) X)) = card (UNIV::'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (range (($) X)) = CARD('n)
[PROOF STEP]
using card_set_of_vector
[PROOF STATE]
proof (prove)
using this:
card (set_of_vector X) = CARD('n)

goal (1 subgoal):
 1. card (range (($) X)) = CARD('n)
[PROOF STEP]
using fact_1
[PROOF STATE]
proof (prove)
using this:
card (set_of_vector X) = CARD('n)
set_of_vector X = range (($) X)

goal (1 subgoal):
 1. card (range (($) X)) = CARD('n)
[PROOF STEP]
unfolding set_of_vector_def
[PROOF STATE]
proof (prove)
using this:
card {X $ i |i. i \<in> UNIV} = CARD('n)
{X $ i |i. i \<in> UNIV} = range (($) X)

goal (1 subgoal):
 1. card (range (($) X)) = CARD('n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (range (($) X)) = CARD('n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inj (($) X)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_diff_self2: "
  m \<le> (n::nat) \<Longrightarrow> (n - m) mod m = n mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> (n - m) mod m = n mod m
[PROOF STEP]
by (simp add: mod_diff_right_eq)


[STATEMENT]
lemma neg_wtn_union_subset:
  shows "(\<Union> i \<le> n. neg_wtn E i) \<subseteq> E"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (neg_wtn E ` {..n}) \<subseteq> E
[PROOF STEP]
using neg_wtn_subset
[PROOF STATE]
proof (prove)
using this:
neg_wtn ?E ?n \<subseteq> ?E

goal (1 subgoal):
 1. \<Union> (neg_wtn E ` {..n}) \<subseteq> E
[PROOF STEP]
by auto


[STATEMENT]
lemma closed_Inter [continuous_intros, intro]: "\<forall>S\<in>K. closed S \<Longrightarrow> closed (\<Inter>K)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>S\<in>K. closed S \<Longrightarrow> closed (\<Inter> K)
[PROOF STEP]
unfolding closed_def uminus_Inf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>S\<in>K. open (- S) \<Longrightarrow> open (\<Union> (uminus ` K))
[PROOF STEP]
by auto


[STATEMENT]
lemma submatrix_index:
assumes "i<card {i. i<dim_row A \<and> i\<in>I}"
assumes "j<card {j. j<dim_col A \<and> j\<in>J}"
shows "submatrix A I J $$ (i,j) = A $$ (pick I i, pick J j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. submatrix A I J $$ (i, j) = A $$ (pick I i, pick J j)
[PROOF STEP]
unfolding submatrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (card {i. i < dim_row A \<and> i \<in> I}) (card {j. j < dim_col A \<and> j \<in> J}) (\<lambda>(i, j). A $$ (pick I i, pick J j)) $$ (i, j) = A $$ (pick I i, pick J j)
[PROOF STEP]
by (simp add: assms(1) assms(2))


[STATEMENT]
lemma frag_cmul_diff_distrib: "frag_cmul (a - b) c = frag_cmul a c - frag_cmul b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frag_cmul (a - b) c = frag_cmul a c - frag_cmul b c
[PROOF STEP]
by (auto simp: left_diff_distrib lookup_minus poly_mapping_eqI)


[STATEMENT]
lemma non_empty_cycle_root_var_axioms_3:
  "non_empty_cycle_root r x \<longleftrightarrow> x;1 \<le> x\<^sup>+;r \<and> is_inj x \<and> is_p_fun x \<and> point r \<and> r \<le> x\<^sup>+;x;1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. non_empty_cycle_root r x = (x ; 1 \<le> x\<^sup>+ ; r \<and> is_inj x \<and> is_p_fun x \<and> point r \<and> r \<le> x\<^sup>+ ; x ; 1)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. non_empty_cycle_root r x \<Longrightarrow> x ; 1 \<le> x\<^sup>+ ; r \<and> is_inj x \<and> is_p_fun x \<and> point r \<and> r \<le> x\<^sup>+ ; x ; 1
 2. x ; 1 \<le> x\<^sup>+ ; r \<and> is_inj x \<and> is_p_fun x \<and> point r \<and> r \<le> x\<^sup>+ ; x ; 1 \<Longrightarrow> non_empty_cycle_root r x
[PROOF STEP]
apply (metis comp_assoc eq_refl backward_finite_path_root_def star_inductl_var_eq2
              non_empty_cycle_root_no_start_end_points non_empty_cycle_root_rtc_start_points
              non_empty_cycle_root_tc_start_points)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ; 1 \<le> x\<^sup>+ ; r \<and> is_inj x \<and> is_p_fun x \<and> point r \<and> r \<le> x\<^sup>+ ; x ; 1 \<Longrightarrow> non_empty_cycle_root r x
[PROOF STEP]
by (metis annir comp_assoc conv_contrav no_end_point_char non_empty_cycle_root_var_axioms_2)


[STATEMENT]
lemma nset_Tr52:"\<lbrakk>j \<noteq> Suc (Suc 0); Suc 0 \<le> j - Suc 0\<rbrakk>
       \<Longrightarrow> \<not> j - Suc 0 \<le> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j \<noteq> Suc (Suc 0); Suc 0 \<le> j - Suc 0\<rbrakk> \<Longrightarrow> \<not> j - Suc 0 \<le> Suc 0
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_lr_inverse_zero:
  fixes x :: "'a::{ab_group_add,mult_zero}"
  and   y :: "'b::{comm_monoid_add,mult_zero,uminus}"
  shows "fps_left_inverse 0 x = fps_const x"
  and   "fps_right_inverse 0 y = fps_const y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_left_inverse 0 x = fps_const x &&& fps_right_inverse 0 y = fps_const y
[PROOF STEP]
using fps_const_lr_inverse[of 0]
[PROOF STATE]
proof (prove)
using this:
fps_left_inverse (fps_const (0::?'c1)) ?x = fps_const ?x
fps_right_inverse (fps_const (0::?'c1)) ?y = fps_const ?y

goal (1 subgoal):
 1. fps_left_inverse 0 x = fps_const x &&& fps_right_inverse 0 y = fps_const y
[PROOF STEP]
by    simp_all


[STATEMENT]
lemma nths_singleton2: "nths xs {y} = (if y < length xs then [xs ! y] else [])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths xs {y} = (if y < length xs then [xs ! y] else [])
[PROOF STEP]
apply (unfold nths_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map fst (filter (\<lambda>p. snd p \<in> {y}) (zip xs [0..<length xs])) = (if y < length xs then [xs ! y] else [])
[PROOF STEP]
apply (induct xs rule: rev_induct, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xs. map fst (filter (\<lambda>p. snd p \<in> {y}) (zip xs [0..<length xs])) = (if y < length xs then [xs ! y] else []) \<Longrightarrow> map fst (filter (\<lambda>p. snd p \<in> {y}) (zip (xs @ [x]) [0..<length (xs @ [x])])) = (if y < length (xs @ [x]) then [(xs @ [x]) ! y] else [])
[PROOF STEP]
apply (simp add: nth_append)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Qp_res_eqI':
  assumes "a \<in> \<O>\<^sub>p"
  assumes "b \<in> \<O>\<^sub>p"
  assumes "val (a \<ominus> b) \<ge> n"
  shows "Qp_res a n = Qp_res b n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Qp_res a n = Qp_res b n
[PROOF STEP]
apply(rule Qp_res_eqI, rule assms, rule assms, rule Qp_res_eq_zeroI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<ominus> b \<in> \<O>\<^sub>p
 2. eint (int n) \<le> val (a \<ominus> b)
[PROOF STEP]
using assms Q\<^sub>p_def Zp_def \<iota>_def padic_fields.val_ring_minus_closed padic_fields_axioms
[PROOF STATE]
proof (prove)
using this:
a \<in> \<O>\<^sub>p
b \<in> \<O>\<^sub>p
eint (int n) \<le> val (a \<ominus> b)
Q\<^sub>p \<equiv> Frac Z\<^sub>p
Z\<^sub>p \<equiv> padic_int p
\<iota> \<equiv> Frac_inc Z\<^sub>p
\<lbrakk>padic_fields ?p; ?a \<in> Frac_inc (padic_int ?p) ` carrier (padic_int ?p); ?b \<in> Frac_inc (padic_int ?p) ` carrier (padic_int ?p)\<rbrakk> \<Longrightarrow> ?a \<ominus>\<^bsub>Frac (padic_int ?p)\<^esub> ?b \<in> Frac_inc (padic_int ?p) ` carrier (padic_int ?p)
padic_fields p

goal (2 subgoals):
 1. a \<ominus> b \<in> \<O>\<^sub>p
 2. eint (int n) \<le> val (a \<ominus> b)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eint (int n) \<le> val (a \<ominus> b)
[PROOF STEP]
by(rule assms)


[STATEMENT]
lemma nso_nostep: "\<lbrakk> \<not>rstep l s i; can_step l (s i)\<rbrakk>
      \<Longrightarrow> next_step_of l (Suc i) = next_step_of l i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> rstep l s i; can_step l (s i)\<rbrakk> \<Longrightarrow> next_step_of l (Suc i) = next_step_of l i
[PROOF STEP]
unfolding next_step_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<not> rstep l s i; can_step l (s i)\<rbrakk> \<Longrightarrow> (LEAST j. Suc i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j)) = (LEAST j. i \<le> j \<and> (\<not> can_step l (s j) \<or> rstep l s j))
[PROOF STEP]
by (metis (full_types) Suc_leD dual_order.antisym not_less_eq_eq)


[STATEMENT]
theorem fundamental_theorem_of_algebra:
    fixes a :: "nat \<Rightarrow> complex"
  assumes "a 0 = 0 \<or> (\<exists>i \<in> {1..n}. a i \<noteq> 0)"
  obtains z where "(\<Sum>i\<le>n. a i * z^i) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a 0 = 0 \<or> (\<exists>i\<in>{1..n}. a i \<noteq> 0)

goal (1 subgoal):
 1. (\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (elim disjE bexE)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; a 0 = 0\<rbrakk> \<Longrightarrow> thesis
 2. \<And>i. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; i \<in> {1..n}; a i \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume "a 0 = 0"
[PROOF STATE]
proof (state)
this:
a 0 = 0

goal (2 subgoals):
 1. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; a 0 = 0\<rbrakk> \<Longrightarrow> thesis
 2. \<And>i. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; i \<in> {1..n}; a i \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a 0 = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a 0 = 0

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (auto simp: that [of 0])
[PROOF STATE]
proof (state)
this:
thesis

goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; i \<in> {1..n}; a i \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; i \<in> {1..n}; a i \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; i \<in> {1..n}; a i \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
assume i: "i \<in> {1..n}" and nz: "a i \<noteq> 0"
[PROOF STATE]
proof (state)
this:
i \<in> {1..n}
a i \<noteq> 0

goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; i \<in> {1..n}; a i \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
have 1: "(\<lambda>z. \<Sum>i\<le>n. a i * z^i) holomorphic_on UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>z. \<Sum>i\<le>n. a i * z ^ i) holomorphic_on UNIV
[PROOF STEP]
by (rule holomorphic_intros)+
[PROOF STATE]
proof (state)
this:
(\<lambda>z. \<Sum>i\<le>n. a i * z ^ i) holomorphic_on UNIV

goal (1 subgoal):
 1. \<And>i. \<lbrakk>\<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis; i \<in> {1..n}; a i \<noteq> 0\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof (rule Liouville_weak_inverse [OF 1])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>B. \<forall>\<^sub>F x in at_infinity. B \<le> cmod (\<Sum>i\<le>n. a i * x ^ i)
 2. \<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis
[PROOF STEP]
show "\<forall>\<^sub>F x in at_infinity. B \<le> cmod (\<Sum>i\<le>n. a i * x ^ i)" for B
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. B \<le> cmod (\<Sum>i\<le>n. a i * x ^ i)
[PROOF STEP]
using i nz
[PROOF STATE]
proof (prove)
using this:
i \<in> {1..n}
a i \<noteq> 0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_infinity. B \<le> cmod (\<Sum>i\<le>n. a i * x ^ i)
[PROOF STEP]
by (intro polyfun_extremal exI[of _ i]) auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_infinity. ?B \<le> cmod (\<Sum>i\<le>n. a i * x ^ i)

goal (1 subgoal):
 1. \<And>z. (\<Sum>i\<le>n. a i * z ^ i) = 0 \<Longrightarrow> thesis
[PROOF STEP]
qed (use that in auto)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Nadd_assoc:
  assumes "SORT_CONSTRAINT('a::field_char_0)"
  shows "x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)
[PROOF STEP]
have n: "isnormNum (x +\<^sub>N y +\<^sub>N z)" "isnormNum (x +\<^sub>N (y +\<^sub>N z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isnormNum (x +\<^sub>N y +\<^sub>N z) &&& isnormNum (x +\<^sub>N (y +\<^sub>N z))
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
isnormNum (x +\<^sub>N y +\<^sub>N z)
isnormNum (x +\<^sub>N (y +\<^sub>N z))

goal (1 subgoal):
 1. x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)
[PROOF STEP]
have "INum (x +\<^sub>N y +\<^sub>N z) = (INum (x +\<^sub>N (y +\<^sub>N z)) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. INum (x +\<^sub>N y +\<^sub>N z) = INum (x +\<^sub>N (y +\<^sub>N z))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
INum (x +\<^sub>N y +\<^sub>N z) = INum (x +\<^sub>N (y +\<^sub>N z))

goal (1 subgoal):
 1. x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)
[PROOF STEP]
with isnormNum_unique[OF n]
[PROOF STATE]
proof (chain)
picking this:
(INum (x +\<^sub>N y +\<^sub>N z) = INum (x +\<^sub>N (y +\<^sub>N z))) = (x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z))
INum (x +\<^sub>N y +\<^sub>N z) = INum (x +\<^sub>N (y +\<^sub>N z))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(INum (x +\<^sub>N y +\<^sub>N z) = INum (x +\<^sub>N (y +\<^sub>N z))) = (x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z))
INum (x +\<^sub>N y +\<^sub>N z) = INum (x +\<^sub>N (y +\<^sub>N z))

goal (1 subgoal):
 1. x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x +\<^sub>N y +\<^sub>N z = x +\<^sub>N (y +\<^sub>N z)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp1: "exp 1 \<in> {2.718281 .. 2.718284::real}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp 1 \<in> {2718281 / 10 ^ 6..2718284 / 10 ^ 6}
[PROOF STEP]
using exp_ode_result[of 1 0 1]
[PROOF STATE]
proof (prove)
using this:
1 \<in> point_ivl 1 \<longrightarrow> (0, 1) \<in> point_ivl (0, 1) \<longrightarrow> 1 \<in> exp_ivp.existence_ivl0 (0, 1) \<and> exp_ivp.flow0 (0, 1) 1 \<in> {(99 / 10\<^sup>2, 2718281 / 10 ^ 6)..(1, 2718284 / 10 ^ 6)}

goal (1 subgoal):
 1. exp 1 \<in> {2718281 / 10 ^ 6..2718284 / 10 ^ 6}
[PROOF STEP]
by (auto simp: exp_eq_exp_ivp_aux)


[STATEMENT]
lemma drop_minus:
  "\<lbrakk> n < length xs; n' = length xs \<rbrakk> \<Longrightarrow> drop (n' - Suc n) xs = rev xs ! n  # drop (n' - n) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> drop (n' - Suc n) xs = rev xs ! n # drop (n' - n) xs
[PROOF STEP]
apply (subst drop_minus_lem)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> Suc n \<le> length xs
 2. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> 0 < Suc n
 3. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> n' = length xs
 4. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> rev xs ! (Suc n - 1) # drop (Suc (n' - Suc n)) xs = rev xs ! n # drop (n' - n) xs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> 0 < Suc n
 2. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> n' = length xs
 3. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> rev xs ! (Suc n - 1) # drop (Suc (n' - Suc n)) xs = rev xs ! n # drop (n' - n) xs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> n' = length xs
 2. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> rev xs ! (Suc n - 1) # drop (Suc (n' - Suc n)) xs = rev xs ! n # drop (n' - n) xs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> rev xs ! (Suc n - 1) # drop (Suc (n' - Suc n)) xs = rev xs ! n # drop (n' - n) xs
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs; n' = length xs\<rbrakk> \<Longrightarrow> drop (Suc (length xs - Suc n)) xs = drop (length xs - n) xs
[PROOF STEP]
apply (cases "length xs", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>nat. \<lbrakk>n < length xs; n' = length xs; length xs = Suc nat\<rbrakk> \<Longrightarrow> drop (Suc (length xs - Suc n)) xs = drop (length xs - n) xs
[PROOF STEP]
apply (simp add: Suc_diff_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma DirProd_commute_iso_set:
  shows "(\<lambda>(x,y). (y,x)) \<in> iso (G \<times>\<times> H) (H \<times>\<times> G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (y, x)) \<in> Group.iso (G \<times>\<times> H) (H \<times>\<times> G)
[PROOF STEP]
by (auto simp add: iso_def hom_def inj_on_def bij_betw_def)


[STATEMENT]
lemma GEO079_1:
  "(\<forall>U V W X Y Z. right_angle(U::'a,V,W) & right_angle(X::'a,Y,Z) --> eq(U::'a,V,W,X,Y,Z)) &
  (\<forall>U V W X Y Z. CONGRUENT(U::'a,V,W,X,Y,Z) --> eq(U::'a,V,W,X,Y,Z)) &
  (\<forall>V W U X. trapezoid(U::'a,V,W,X) --> parallel(V::'a,W,U,X)) &
  (\<forall>U V X Y. parallel(U::'a,V,X,Y) --> eq(X::'a,V,U,V,X,Y)) &
  (trapezoid(a::'a,b,c,d)) &
  (~eq(a::'a,c,b,c,a,d)) --> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>U V W X Y Z. right_angle (U, V, W) \<and> right_angle (X, Y, Z) \<longrightarrow> eq (U, V, W, X, Y, Z)) \<and> (\<forall>U V W X Y Z. CONGRUENT (U, V, W, X, Y, Z) \<longrightarrow> eq (U, V, W, X, Y, Z)) \<and> (\<forall>V W U X. trapezoid (U, V, W, X) \<longrightarrow> parallel (V, W, U, X)) \<and> (\<forall>U V X Y. parallel (U, V, X, Y) \<longrightarrow> eq (X, V, U, V, X, Y)) \<and> trapezoid (a, b, c, d) \<and> \<not> eq (a, c, b, c, a, d) \<longrightarrow> False
[PROOF STEP]
by meson


[STATEMENT]
lemma SA_funs_to_SA_decomp_closed:
  assumes "finite Fs"
  assumes "Fs \<subseteq> carrier (SA n)"
  assumes "is_semialgebraic n S"
  shows "SA_funs_to_SA_decomp n Fs S \<subseteq> semialg_sets n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SA_funs_to_SA_decomp n Fs S \<subseteq> semialg_sets n
[PROOF STEP]
unfolding SA_funs_to_SA_decomp_def semialg_sets_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. atoms_of ((\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs)) \<subseteq> gen_boolean_algebra (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) (Collect (is_basic_semialg n))
[PROOF STEP]
apply(rule atoms_of_gen_boolean_algebra)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs) \<subseteq> gen_boolean_algebra (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) (Collect (is_basic_semialg n))
 2. finite ((\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs))
[PROOF STEP]
using SA_funs_to_SA_decomp_closed_0[of Fs n S]  assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Fs \<subseteq> carrier (SA n); is_semialgebraic n S\<rbrakk> \<Longrightarrow> (\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs) \<subseteq> semialg_sets n
finite Fs
Fs \<subseteq> carrier (SA n)
is_semialgebraic n S

goal (2 subgoals):
 1. (\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs) \<subseteq> gen_boolean_algebra (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) (Collect (is_basic_semialg n))
 2. finite ((\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs))
[PROOF STEP]
unfolding semialg_sets_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Fs \<subseteq> carrier (SA n); is_semialgebraic n S\<rbrakk> \<Longrightarrow> (\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs) \<subseteq> gen_boolean_algebra (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) (Collect (is_basic_semialg n))
finite Fs
Fs \<subseteq> carrier (SA n)
is_semialgebraic n S

goal (2 subgoals):
 1. (\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs) \<subseteq> gen_boolean_algebra (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) (Collect (is_basic_semialg n))
 2. finite ((\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite ((\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite Fs
Fs \<subseteq> carrier (SA n)
is_semialgebraic n S

goal (1 subgoal):
 1. finite ((\<inter>) S ` (SA_zero_set n ` Fs \<union> SA_nonzero_set n ` Fs))
[PROOF STEP]
by blast


[STATEMENT]
lemma ennreal_spmf_map_conv_nn_integral:
  "ennreal (spmf (map_spmf f p) x) = integral\<^sup>N (measure_spmf p) (indicator (f -` {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (spmf (map_spmf f p) x) = integral\<^sup>N (measure_spmf p) (indicator (f -` {x}))
[PROOF STEP]
by(auto simp add: ennreal_pmf_map measure_spmf_def emeasure_distr space_restrict_space emeasure_restrict_space intro: arg_cong2[where f=emeasure])


[STATEMENT]
lemma fixes rhs z
  defines "rhs \<equiv> nth_cons (flatten (\<lambda>s'. s') (upto_prod 17) (upto_prod z)) (2, None) 8"
  shows "nth (List.maps (\<lambda>x. upto x 17) (upto 2 z)) 8 = rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.maps (\<lambda>x. [x..17]) [2..z] ! 8 = rhs
[PROOF STEP]
using [[simproc add: stream_fusion, stream_fusion_trace]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. List.maps (\<lambda>x. [x..17]) [2..z] ! 8 = rhs
[PROOF STEP]
apply(simp del: id_apply) \<comment> \<open>fuses\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_cons (flatten (\<lambda>s'. s') (upto_prod 17) (upto_prod z)) (2, None) 8 = rhs
[PROOF STEP]
by(unfold rhs_def) rule


[STATEMENT]
lemma emeasure_pmf_of_list:
  assumes "pmf_of_list_wf xs"
  shows   "emeasure (pmf_of_list xs) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "emeasure (pmf_of_list xs) A = nn_integral (measure_pmf (pmf_of_list xs)) (indicator A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = integral\<^sup>N (measure_pmf (pmf_of_list xs)) (indicator A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure (measure_pmf (pmf_of_list xs)) A = integral\<^sup>N (measure_pmf (pmf_of_list xs)) (indicator A)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure (measure_pmf (pmf_of_list xs)) A = integral\<^sup>N (measure_pmf (pmf_of_list xs)) (indicator A)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pmf_of_list_wf xs
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. ennreal (sum_list (map snd [z\<leftarrow>xs . fst z = x])))"
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf (pmf_of_list xs)) (indicator A) = (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. ennreal (sum_list (map snd (filter (\<lambda>z. fst z = x) xs))))
[PROOF STEP]
by (subst nn_integral_measure_pmf_finite) (simp_all add: finite_set_pmf_of_list pmf_pmf_of_list Int_def)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (pmf_of_list xs)) (indicator A) = (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. ennreal (sum_list (map snd (filter (\<lambda>z. fst z = x) xs))))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (measure_pmf (pmf_of_list xs)) (indicator A) = (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. ennreal (sum_list (map snd (filter (\<lambda>z. fst z = x) xs))))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
pmf_of_list_wf xs
[PROOF STEP]
have "\<dots> = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd [z\<leftarrow>xs . fst z = x]))"
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. ennreal (sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))) = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
by (subst sum_ennreal) (auto simp: pmf_of_list_wf_def intro!: sum_list_nonneg)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. ennreal (sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))) = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. ennreal (sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))) = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A.
      indicator A x * pmf (pmf_of_list xs) x)" (is "_ = ennreal ?S")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd (filter (\<lambda>z. fst z = x) xs))) = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd (filter (\<lambda>z. fst z = x) xs))) = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x)
[PROOF STEP]
by (intro ennreal_cong sum.cong) (auto simp: pmf_pmf_of_list)
[PROOF STATE]
proof (state)
this:
ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd (filter (\<lambda>z. fst z = x) xs))) = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. sum_list (map snd (filter (\<lambda>z. fst z = x) xs))) = ennreal (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "?S = (\<Sum>x\<in>set_pmf (pmf_of_list xs). indicator A x * pmf (pmf_of_list xs) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. (\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x)
[PROOF STEP]
by (intro sum.mono_neutral_left set_pmf_of_list finite_set_pmf_of_list) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set_pmf (pmf_of_list xs) \<inter> A. indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>set (map fst xs). indicator A x * pmf (pmf_of_list xs) x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. (\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x)
[PROOF STEP]
by (intro sum.mono_neutral_left set_pmf_of_list) (auto simp: set_pmf_eq)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set_pmf (pmf_of_list xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>set (map fst xs). indicator A x *
                      sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
pmf_of_list_wf xs

goal (1 subgoal):
 1. (\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))
[PROOF STEP]
by (simp add: pmf_pmf_of_list)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). indicat_real A x * pmf (pmf_of_list xs) x) = (\<Sum>x\<in>set (map fst xs). indicat_real A x * sum_list (map snd (filter (\<lambda>z. fst z = x) xs)))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>set (map fst xs). sum_list (map snd (filter (\<lambda>z. fst z = x \<and> x \<in> A) xs)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (map fst xs). indicat_real A x * sum_list (map snd (filter (\<lambda>z. fst z = x) xs))) = (\<Sum>x\<in>set (map fst xs). sum_list (map snd (filter (\<lambda>z. fst z = x \<and> x \<in> A) xs)))
[PROOF STEP]
by (intro sum.cong) (auto simp: indicator_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). indicat_real A x * sum_list (map snd (filter (\<lambda>z. fst z = x) xs))) = (\<Sum>x\<in>set (map fst xs). sum_list (map snd (filter (\<lambda>z. fst z = x \<and> x \<in> A) xs)))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). indicat_real A x * sum_list (map snd (filter (\<lambda>z. fst z = x) xs))) = (\<Sum>x\<in>set (map fst xs). sum_list (map snd (filter (\<lambda>z. fst z = x \<and> x \<in> A) xs)))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>set (map fst xs). (\<Sum>xa = 0..<length xs.
                     if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (map fst xs). sum_list (map snd (filter (\<lambda>z. fst z = x \<and> x \<in> A) xs))) = (\<Sum>x\<in>set (map fst xs). \<Sum>xa = 0..<length xs. if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0)
[PROOF STEP]
by (intro sum.cong refl, subst sum_list_map_filter', subst sum_list_sum_nth) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). sum_list (map snd (filter (\<lambda>z. fst z = x \<and> x \<in> A) xs))) = (\<Sum>x\<in>set (map fst xs). \<Sum>xa = 0..<length xs. if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). sum_list (map snd (filter (\<lambda>z. fst z = x \<and> x \<in> A) xs))) = (\<Sum>x\<in>set (map fst xs). \<Sum>xa = 0..<length xs. if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = (\<Sum>xa = 0..<length xs. (\<Sum>x\<in>set (map fst xs).
                     if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (map fst xs). \<Sum>xa = 0..<length xs. if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0) = (\<Sum>xa = 0..<length xs. \<Sum>x\<in>set (map fst xs). if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0)
[PROOF STEP]
by (rule sum.swap)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). \<Sum>xa = 0..<length xs. if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0) = (\<Sum>xa = 0..<length xs. \<Sum>x\<in>set (map fst xs). if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (map fst xs). \<Sum>xa = 0..<length xs. if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0) = (\<Sum>xa = 0..<length xs. \<Sum>x\<in>set (map fst xs). if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then
                     (\<Sum>x\<in>set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>xa = 0..<length xs. \<Sum>x\<in>set (map fst xs). if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0) = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then \<Sum>x\<in>set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0 else 0)
[PROOF STEP]
by (auto intro!: sum.cong sum.neutral simp del: sum.delta)
[PROOF STATE]
proof (state)
this:
(\<Sum>xa = 0..<length xs. \<Sum>x\<in>set (map fst xs). if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0) = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then \<Sum>x\<in>set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0 else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>xa = 0..<length xs. \<Sum>x\<in>set (map fst xs). if fst (xs ! xa) = x \<and> x \<in> A then snd (xs ! xa) else 0) = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then \<Sum>x\<in>set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0 else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then snd (xs ! xa) else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then \<Sum>x\<in>set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0 else 0) = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then snd (xs ! xa) else 0)
[PROOF STEP]
by (intro sum.cong refl) (simp_all add: sum.delta)
[PROOF STATE]
proof (state)
this:
(\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then \<Sum>x\<in>set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0 else 0) = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then snd (xs ! xa) else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then \<Sum>x\<in>set (map fst xs). if x = fst (xs ! xa) then snd (xs ! xa) else 0 else 0) = (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then snd (xs ! xa) else 0)

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
have "\<dots> = sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then snd (xs ! xa) else 0) = sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs))
[PROOF STEP]
by (subst sum_list_map_filter', subst sum_list_sum_nth) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>xa = 0..<length xs. if fst (xs ! xa) \<in> A then snd (xs ! xa) else 0) = sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))

goal (1 subgoal):
 1. emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure (measure_pmf (pmf_of_list xs)) A = ennreal (sum_list (map snd (filter (\<lambda>x. fst x \<in> A) xs)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma int_prime_not_sqr :
  assumes "is_prime p"
  shows "int p \<noteq> n\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int p \<noteq> n\<^sup>2
[PROOF STEP]
by (metis assms nat_int nat_sqr prime_not_sqr)


[STATEMENT]
lemma fst_Gauss_Jordan_column_k_PA:
fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
assumes PB_A: "P ** B = A"
shows "fst (Gauss_Jordan_column_k_PA (P,i,A) k) ** B = snd (snd (Gauss_Jordan_column_k_PA (P,i,A) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_PA (P, i, A) k) ** B = snd (snd (Gauss_Jordan_column_k_PA (P, i, A) k))
[PROOF STEP]
unfolding Gauss_Jordan_column_k_PA_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (let Pa = fst (P, i, A); ia = fst (snd (P, i, A)); A = snd (snd (P, i, A)); from_nat_i = mod_type_class.from_nat ia; from_nat_k = mod_type_class.from_nat k in if (\<forall>m\<ge>from_nat_i. A $ m $ from_nat_k = (0::'a)) \<or> ia = nrows A then (Pa, ia, A) else let Gauss = Gauss_Jordan_in_ij_PA (Pa, A) from_nat_i from_nat_k in (fst Gauss, ia + 1, snd Gauss)) ** B = snd (snd (let Pa = fst (P, i, A); ia = fst (snd (P, i, A)); A = snd (snd (P, i, A)); from_nat_i = mod_type_class.from_nat ia; from_nat_k = mod_type_class.from_nat k in if (\<forall>m\<ge>from_nat_i. A $ m $ from_nat_k = (0::'a)) \<or> ia = nrows A then (Pa, ia, A) else let Gauss = Gauss_Jordan_in_ij_PA (Pa, A) from_nat_i from_nat_k in (fst Gauss, ia + 1, snd Gauss)))
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (if (\<forall>m\<ge>mod_type_class.from_nat (fst (snd (P, i, A))). snd (snd (P, i, A)) $ m $ mod_type_class.from_nat k = (0::'a)) \<or> fst (snd (P, i, A)) = nrows (snd (snd (P, i, A))) then (fst (P, i, A), fst (snd (P, i, A)), snd (snd (P, i, A))) else (fst (Gauss_Jordan_in_ij_PA (fst (P, i, A), snd (snd (P, i, A))) (mod_type_class.from_nat (fst (snd (P, i, A)))) (mod_type_class.from_nat k)), fst (snd (P, i, A)) + 1, snd (Gauss_Jordan_in_ij_PA (fst (P, i, A), snd (snd (P, i, A))) (mod_type_class.from_nat (fst (snd (P, i, A)))) (mod_type_class.from_nat k)))) ** B = snd (snd (if (\<forall>m\<ge>mod_type_class.from_nat (fst (snd (P, i, A))). snd (snd (P, i, A)) $ m $ mod_type_class.from_nat k = (0::'a)) \<or> fst (snd (P, i, A)) = nrows (snd (snd (P, i, A))) then (fst (P, i, A), fst (snd (P, i, A)), snd (snd (P, i, A))) else (fst (Gauss_Jordan_in_ij_PA (fst (P, i, A), snd (snd (P, i, A))) (mod_type_class.from_nat (fst (snd (P, i, A)))) (mod_type_class.from_nat k)), fst (snd (P, i, A)) + 1, snd (Gauss_Jordan_in_ij_PA (fst (P, i, A), snd (snd (P, i, A))) (mod_type_class.from_nat (fst (snd (P, i, A)))) (mod_type_class.from_nat k)))))
[PROOF STEP]
unfolding fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, snd (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)))) ** B = snd (snd (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, snd (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)))))
[PROOF STEP]
by (auto intro: assms fst_Gauss_Jordan_in_ij_PA)


[STATEMENT]
lemma prime_in_primes_upto: "prime n \<longleftrightarrow> n \<in> set (primes_upto n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime n = (n \<in> set (primes_upto n))
[PROOF STEP]
by (simp add: set_primes_upto)


[STATEMENT]
lemma Cons_Cons_eq [iff]: "(x#xs=y#ys) = (x=y & xs=ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs = y # ys) = (x = y \<and> xs = ys)
[PROOF STEP]
apply (simp add: Cons_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Abs_List (CONS (Leaf x) (Rep_List xs)) = Abs_List (CONS (Leaf y) (Rep_List ys))) = (x = y \<and> xs = ys)
[PROOF STEP]
apply (subst Abs_List_inject)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. CONS (Leaf x) (Rep_List xs) \<in> List
 2. CONS (Leaf y) (Rep_List ys) \<in> List
 3. (CONS (Leaf x) (Rep_List xs) = CONS (Leaf y) (Rep_List ys)) = (x = y \<and> xs = ys)
[PROOF STEP]
apply (auto simp add: Rep_List_inject)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma exp_less: "a \<le> b \<Longrightarrow> (2::real)^a \<le> 2^b" for a b :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> 2 ^ a \<le> 2 ^ b
[PROOF STEP]
by auto


[STATEMENT]
lemma i_aggregate_Cons: "
  \<lbrakk> 0 < k; length xs = k \<rbrakk> \<Longrightarrow>
  i_aggregate (xs \<frown> f) k ag = [ag xs] \<frown> (i_aggregate f k ag)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; length xs = k\<rbrakk> \<Longrightarrow> i_aggregate (xs \<frown> f) k ag = [ag xs] \<frown> i_aggregate f k ag
[PROOF STEP]
apply (insert i_aggregate_i_append_mod[of xs k f ag], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < k; length xs = k; i_aggregate (xs \<frown> f) k ag = f_aggregate xs k ag \<frown> i_aggregate f k ag\<rbrakk> \<Longrightarrow> f_aggregate xs k ag = [ag xs]
[PROOF STEP]
apply (simp add: f_aggregate_def list_slice_div_eq_1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dim_is_n: "dim = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.dim = n
[PROOF STEP]
unfolding dim_basis[OF finite_set unit_vecs_basis]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (set (unit_vecs n)) = n
[PROOF STEP]
unfolding distinct_card[OF unit_vecs_distinct]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (unit_vecs n) = n
[PROOF STEP]
by simp


[STATEMENT]
lemma star_back_loop_mu:
  "\<mu> (\<lambda>x . x * y \<squnion> z) = z * y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> (\<lambda>x. x * y \<squnion> z) = z * y\<^sup>\<star>
[PROOF STEP]
by (metis least_fixpoint_same star_back_loop_is_least_fixpoint)


[STATEMENT]
lemma det_fst_Gauss_Jordan_column_k_PA_eq_fst_Gauss_Jordan_column_k_det_P:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
shows "fst (Gauss_Jordan_column_k_det_P (det P,i,A) k) = det (fst (Gauss_Jordan_column_k_PA (P,i,A) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_column_k_det_P (det P, i, A) k) = det (fst (Gauss_Jordan_column_k_PA (P, i, A) k))
[PROOF STEP]
unfolding Gauss_Jordan_column_k_det_P_def Gauss_Jordan_column_k_PA_def Let_def snd_conv fst_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (det P, i, A) else (fst (Gauss_Jordan_in_ij_det_P A (mod_type_class.from_nat i) (mod_type_class.from_nat k)) * det P, i + 1, snd (Gauss_Jordan_in_ij_det_P A (mod_type_class.from_nat i) (mod_type_class.from_nat k)))) = det (fst (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, snd (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)))))
[PROOF STEP]
using det_fst_Gauss_Jordan_in_ij_PA_eq_fst_Gauss_Jordan_in_ij_det_P
[PROOF STATE]
proof (prove)
using this:
fst (Gauss_Jordan_in_ij_det_P ?A ?i ?j) * det ?P = det (fst (Gauss_Jordan_in_ij_PA (?P, ?A) ?i ?j))

goal (1 subgoal):
 1. fst (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (det P, i, A) else (fst (Gauss_Jordan_in_ij_det_P A (mod_type_class.from_nat i) (mod_type_class.from_nat k)) * det P, i + 1, snd (Gauss_Jordan_in_ij_det_P A (mod_type_class.from_nat i) (mod_type_class.from_nat k)))) = det (fst (if (\<forall>m\<ge>mod_type_class.from_nat i. A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> i = nrows A then (P, i, A) else (fst (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)), i + 1, snd (Gauss_Jordan_in_ij_PA (P, A) (mod_type_class.from_nat i) (mod_type_class.from_nat k)))))
[PROOF STEP]
by auto


[STATEMENT]
lemma f_aggregate_take_nth: "
  \<And>xs m. \<lbrakk> n < length xs div k; n < m div k \<rbrakk> \<Longrightarrow>
  f_aggregate (xs \<down> m) k ag ! n = f_aggregate xs k ag ! n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs m. \<lbrakk>n < length xs div k; n < m div k\<rbrakk> \<Longrightarrow> f_aggregate (xs \<down> m) k ag ! n = f_aggregate xs k ag ! n
[PROOF STEP]
apply (simp add: f_aggregate_nth drop_take)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs m. \<lbrakk>n < length xs div k; n < m div k\<rbrakk> \<Longrightarrow> ag (xs \<up> (n * k) \<down> min k (m - n * k)) = ag (xs \<up> (n * k) \<down> k)
[PROOF STEP]
apply (drule_tac n=m in less_div_imp_mult_add_divisor_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xs m. \<lbrakk>n < length xs div k; n * k + k \<le> m\<rbrakk> \<Longrightarrow> ag (xs \<up> (n * k) \<down> min k (m - n * k)) = ag (xs \<up> (n * k) \<down> k)
[PROOF STEP]
apply (simp add: min_eqL)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma closure_of_subtopology:
  "(subtopology X U) closure_of S = U \<inter> (X closure_of (U \<inter> S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subtopology X U closure_of S = U \<inter> X closure_of (U \<inter> S)
[PROOF STEP]
unfolding closure_of_def topspace_subtopology openin_subtopology
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> topspace X \<inter> U. \<forall>T. x \<in> T \<and> (\<exists>Ta. openin X Ta \<and> T = Ta \<inter> U) \<longrightarrow> (\<exists>y\<in>S. y \<in> T)} = U \<inter> {x \<in> topspace X. \<forall>T. x \<in> T \<and> openin X T \<longrightarrow> (\<exists>y\<in>U \<inter> S. y \<in> T)}
[PROOF STEP]
by safe (metis (full_types) IntI Int_iff inf.commute)+


[STATEMENT]
lemma advice_sets_element_length:
  "(xs, ys) \<in> set (advice_sets \<phi>) \<Longrightarrow> length xs \<le> card (subfrmlsn \<phi>)"
  "(xs, ys) \<in> set (advice_sets \<phi>) \<Longrightarrow> length ys \<le> card (subfrmlsn \<phi>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((xs, ys) \<in> set (advice_sets \<phi>) \<Longrightarrow> length xs \<le> card (subfrmlsn \<phi>)) &&& ((xs, ys) \<in> set (advice_sets \<phi>) \<Longrightarrow> length ys \<le> card (subfrmlsn \<phi>))
[PROOF STEP]
unfolding advice_sets_def set_product
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((xs, ys) \<in> set (subseqs (subformulas\<^sub>\<mu>_list \<phi>)) \<times> set (subseqs (subformulas\<^sub>\<nu>_list \<phi>)) \<Longrightarrow> length xs \<le> card (subfrmlsn \<phi>)) &&& ((xs, ys) \<in> set (subseqs (subformulas\<^sub>\<mu>_list \<phi>)) \<times> set (subseqs (subformulas\<^sub>\<nu>_list \<phi>)) \<Longrightarrow> length ys \<le> card (subfrmlsn \<phi>))
[PROOF STEP]
by (metis SigmaD1 card_mono in_set_subseqs list_emb_length order_trans subformulas\<^sub>\<mu>_list_length subformulas\<^sub>\<mu>_subfrmlsn subfrmlsn_finite)
     (metis SigmaD2 card_mono in_set_subseqs list_emb_length order_trans subformulas\<^sub>\<nu>_list_length subformulas\<^sub>\<nu>_subfrmlsn subfrmlsn_finite)


[STATEMENT]
lemma allocationCharacterization:
  "a \<in> allAllocations N \<Omega>  =
   (a \<in> injectionsUniverse & Domain a \<subseteq> N & Range a \<in> all_partitions \<Omega>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<in> allAllocations N \<Omega>) = (a \<in> injectionsUniverse \<and> Domain a \<subseteq> N \<and> Range a \<in> all_partitions \<Omega>)
[PROOF STEP]
by (metis (full_types) posssibleAllocationsRelCharacterization)


[STATEMENT]
lemma continuous_on_cases_1:
  fixes s :: "real set"
  assumes "continuous_on {t \<in> s. t \<le> a} f"
      and "continuous_on {t \<in> s. a \<le> t} g"
      and "a \<in> s \<Longrightarrow> f a = g a"
    shows "continuous_on s (\<lambda>t. if t \<le> a then f(t) else g(t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on s (\<lambda>t. if t \<le> a then f t else g t)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on {t \<in> s. t \<le> a} f
continuous_on {t \<in> s. a \<le> t} g
a \<in> s \<Longrightarrow> f a = g a

goal (1 subgoal):
 1. continuous_on s (\<lambda>t. if t \<le> a then f t else g t)
[PROOF STEP]
by (auto intro: continuous_on_cases_le [where h = id, simplified])


[STATEMENT]
lemma ex_mono: "(\<exists>x. P x) \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> (\<exists>x. Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. P x; \<And>x. P x \<Longrightarrow> Q x\<rbrakk> \<Longrightarrow> \<exists>x. Q x
[PROOF STEP]
by blast


[STATEMENT]
lemma subgroup_0: "subgroup {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup {0::'a}
[PROOF STEP]
unfolding subgroup_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<in> {0::'a} \<and> (\<forall>a\<in>{0::'a}. \<forall>b\<in>{0::'a}. a + b \<in> {0::'a}) \<and> (\<forall>a\<in>{0::'a}. - a \<in> {0::'a})
[PROOF STEP]
by auto


[STATEMENT]
lemma discrete_card:
  assumes "discrete (X :: 'a::topological_space set)"
  shows "card {f. CK_nf_pos (f::'a set \<Rightarrow> 'a set)} = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f. CK_nf_pos f} = 1
[PROOF STEP]
using discrete_eqs[OF assms] CK_nf_pos_lattice[where 'a='a]
[PROOF STATE]
proof (prove)
using this:
I = id
K = id
I \<le> id
id \<le> K
I \<le> I \<circ> K \<circ> I
I \<circ> K \<circ> I \<le> I \<circ> K
I \<circ> K \<circ> I \<le> K \<circ> I
I \<circ> K \<le> K \<circ> I \<circ> K
K \<circ> I \<le> K \<circ> I \<circ> K
K \<circ> I \<circ> K \<le> K

goal (1 subgoal):
 1. card {f. CK_nf_pos f} = 1
[PROOF STEP]
by (simp add: CK_nf_pos_set)


[STATEMENT]
lemma fiter_unfoldl:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'a"
  shows "mono f \<Longrightarrow> mono g \<Longrightarrow> f \<sqinter> (g \<circ> fiter f g) = fiter f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>mono f; mono g\<rbrakk> \<Longrightarrow> f \<sqinter> (g \<circ> fiter f g) = fiter f g
[PROOF STEP]
by (metis fiter_def fiter_fun_exp gfp_unfold iso_fiter_fun2)


[STATEMENT]
lemma (in submonoid) is_submonoid: "submonoid M S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Localization.submonoid M S
[PROOF STEP]
by (rule submonoid_axioms)


[STATEMENT]
lemma INF_INF_seq_distrib_UNIV: "(\<Sqinter>x. c x) ; (\<Sqinter>y. d y) = (\<Sqinter>x. \<Sqinter>y. c x ; d y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter> range c ; \<Sqinter> range d = (\<Sqinter>(x::'b) y::'c. c x ; d y)
variables:
d :: 'c \<Rightarrow> 'a
c :: 'b \<Rightarrow> 'a
(;) :: 'a \<Rightarrow> 'a \<Rightarrow> 'a
type variables:
'a :: refinement_lattice
'b, 'c :: type
[PROOF STEP]
by (simp add: INF_INF_seq_distrib)


[STATEMENT]
lemma semialg_val_strict_ineq_set_formula:
"{x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) < val (f x)} = {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) \<le> val (f x)} - {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) = val (f x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) < val (f x)} = {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) \<le> val (f x)} - {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) = val (f x)}
[PROOF STEP]
using neq_iff le_less
[PROOF STATE]
proof (prove)
using this:
(?x \<noteq> ?y) = (?x < ?y \<or> ?y < ?x)
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (1 subgoal):
 1. {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) < val (f x)} = {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) \<le> val (f x)} - {x \<in> carrier (Q\<^sub>p\<^bsup>k\<^esup>). val (g x) = val (f x)}
[PROOF STEP]
by blast


[STATEMENT]
lemma iDM_b:" \<^bold>\<midarrow>(\<^bold>\<Or>S) = \<^bold>\<And>S\<inverse>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. supremum\<^sup>c S = \<^bold>\<And>S\<inverse>
[PROOF STEP]
unfolding dom_compl_def2 infimum_def supremum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>\<midarrow>(\<lambda>w. nonEmpty (\<lambda>X. S X \<and> X w)) = (\<lambda>w. contains (\<lambda>X. X w) (\<lambda>X. S (\<^bold>\<midarrow>X)))
[PROOF STEP]
using compl_def
[PROOF STATE]
proof (prove)
using this:
\<^bold>\<midarrow>?A \<equiv> \<lambda>w. \<not> ?A w

goal (1 subgoal):
 1. \<^bold>\<midarrow>(\<lambda>w. nonEmpty (\<lambda>X. S X \<and> X w)) = (\<lambda>w. contains (\<lambda>X. X w) (\<lambda>X. S (\<^bold>\<midarrow>X)))
[PROOF STEP]
by force


[STATEMENT]
lemma dist_real: "dist(x::real ^ 1) y = \<bar>(x$1) - (y$1)\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x y = \<bar>x $ 1 - y $ 1\<bar>
[PROOF STEP]
by (auto simp add: norm_real dist_norm)


[STATEMENT]
lemma  npi_disj[no_atp]: "\<lbrakk>\<forall>x. \<not>P1' \<and> P1 x \<longrightarrow>  (\<exists>u\<in> U. x \<le> u) ; \<forall>x. \<not>P2' \<and> P2 x \<longrightarrow>  (\<exists>u\<in> U. x \<le> u)\<rbrakk>
  \<Longrightarrow> \<forall>x. \<not>(P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow>  (\<exists>u\<in> U. x \<le> u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. \<not> P1' \<and> P1 x \<longrightarrow> (\<exists>u\<in>U. x \<le> u); \<forall>x. \<not> P2' \<and> P2 x \<longrightarrow> (\<exists>u\<in>U. x \<le> u)\<rbrakk> \<Longrightarrow> \<forall>x. \<not> (P1' \<or> P2') \<and> (P1 x \<or> P2 x) \<longrightarrow> (\<exists>u\<in>U. x \<le> u)
[PROOF STEP]
by auto


[STATEMENT]
lemma Not_Rall: "\<turnstile> (\<not>(\<forall> x. F x)) = (\<exists> x. \<not>F x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<turnstile> \<not> (\<forall>x. F x) = (\<exists>x. \<not> F x)
[PROOF STEP]
by auto


[STATEMENT]
lemma bin_cat_assoc_sym: "(\<lambda>k n l. concat_bit n l k) x m ((\<lambda>k n l. concat_bit n l k) y n z) = (\<lambda>k n l. concat_bit n l k) ((\<lambda>k n l. concat_bit n l k) x (m - n) y) (min m n) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. concat_bit m (concat_bit n z y) x = concat_bit (min m n) z (concat_bit (m - n) y x)
[PROOF STEP]
by (fact concat_bit_assoc_sym)


[STATEMENT]
lemma gauss_norm_normalize_poly:
  assumes "g \<noteq> \<zero>\<^bsub>UP Q\<^sub>p\<^esub>"
  assumes "g \<in> carrier (UP Q\<^sub>p)"
  shows "gauss_norm (normalize_poly g) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_norm (normalize_poly g) = 0
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gauss_norm (normalize_poly g) = 0
[PROOF STEP]
have 0: "eint (int_gauss_norm (normalize_poly g)) = gauss_norm (normalize_poly g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eint (int_gauss_norm (normalize_poly g)) = gauss_norm (normalize_poly g)
[PROOF STEP]
by(rule int_gauss_norm_eq, rule normalize_poly_closed, rule assms,
          rule normalize_poly_nonzero, rule assms, rule assms)
[PROOF STATE]
proof (state)
this:
eint (int_gauss_norm (normalize_poly g)) = gauss_norm (normalize_poly g)

goal (1 subgoal):
 1. gauss_norm (normalize_poly g) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gauss_norm (normalize_poly g) = 0
[PROOF STEP]
using 0 int_gauss_norm_normalize_poly assms
[PROOF STATE]
proof (prove)
using this:
eint (int_gauss_norm (normalize_poly g)) = gauss_norm (normalize_poly g)
\<lbrakk>?g \<noteq> \<zero>\<^bsub>UP Q\<^sub>p\<^esub>; ?g \<in> carrier (UP Q\<^sub>p)\<rbrakk> \<Longrightarrow> int_gauss_norm (normalize_poly ?g) = 0
g \<noteq> \<zero>\<^bsub>UP Q\<^sub>p\<^esub>
g \<in> carrier (UP Q\<^sub>p)

goal (1 subgoal):
 1. gauss_norm (normalize_poly g) = 0
[PROOF STEP]
by (simp add: zero_eint_def)
[PROOF STATE]
proof (state)
this:
gauss_norm (normalize_poly g) = 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diffeomorphism_scaleR: "diffeomorphism k UNIV UNIV (\<lambda>x. c *\<^sub>R x) (\<lambda>x. x /\<^sub>R c)"
  if "c \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diffeomorphism k UNIV UNIV ((*\<^sub>R) c) (\<lambda>x. x /\<^sub>R c)
[PROOF STEP]
by (auto simp: that diffeomorphism_def homeomorphism_scaleR
      intro!: smooth_on_minus smooth_on_scaleR)


[STATEMENT]
lemma prime_elemI:
    "p \<noteq> 0 \<Longrightarrow> \<not>p dvd 1 \<Longrightarrow> (\<And>a b. p dvd (a * b) \<Longrightarrow> p dvd a \<or> p dvd b) \<Longrightarrow> prime_elem p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<noteq> (0::'a); \<not> p dvd (1::'a); \<And>a b. p dvd a * b \<Longrightarrow> p dvd a \<or> p dvd b\<rbrakk> \<Longrightarrow> prime_elem p
[PROOF STEP]
by (simp add: prime_elem_def)


[STATEMENT]
lemma radical_0 [simp]: "radical 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. radical (0::'a) = (0::'a)
[PROOF STEP]
by (simp add: radical_def)


[STATEMENT]
lemma summable_If_finite[simp, intro]: "finite {r. P r} \<Longrightarrow> summable (\<lambda>r. if P r then f r else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {r. P r} \<Longrightarrow> summable (\<lambda>r. if P r then f r else (0::'a))
[PROOF STEP]
by (rule sums_summable) (rule sums_If_finite)


[STATEMENT]
lemma minus_lucas_lehmer_ring: "\<ominus>\<^bsub>lucas_lehmer_ring\<^esub> x = (case x of (a, b) \<Rightarrow> (-a, -b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<ominus>\<^bsub>lucas_lehmer_ring\<^esub> x = (case x of (a, b) \<Rightarrow> (- a, - b))
[PROOF STEP]
by (rule sym, rule sum_zero_eq_neg)
     (auto simp: case_prod_unfold lucas_lehmer_ring_def lucas_lehmer_add'_def)


[STATEMENT]
lemma in_eq_out_arc_ends: "(u, v) \<in> ((arc_to_ends G) ` (in_arcs G v)) \<longleftrightarrow>
    (v, u) \<in> ((arc_to_ends G) ` (out_arcs G v))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((u, v) \<in> arc_to_ends G ` in_arcs G v) = ((v, u) \<in> arc_to_ends G ` out_arcs G v)
[PROOF STEP]
using arc_to_ends_def in_in_arcs_conv in_out_arcs_conv
[PROOF STATE]
proof (prove)
using this:
arc_to_ends ?G ?e \<equiv> (tail ?G ?e, head ?G ?e)
(?e \<in> in_arcs ?G ?v) = (?e \<in> arcs ?G \<and> head ?G ?e = ?v)
(?e \<in> out_arcs ?G ?v) = (?e \<in> arcs ?G \<and> tail ?G ?e = ?v)

goal (1 subgoal):
 1. ((u, v) \<in> arc_to_ends G ` in_arcs G v) = ((v, u) \<in> arc_to_ends G ` out_arcs G v)
[PROOF STEP]
by (smt (z3) Pair_inject adj_in_verts(1) dominatesI image_iff out_in_arcs_reflexive_uniq)


[STATEMENT]
lemma sum_div_card:
"(\<Sum>l\<in>{..<n::nat}. f l) + q * real n=
  (\<Sum>l\<in>{..<n}. f l + q )"
  (is "?Sl n = ?Sr n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<n} + q * real n = (\<Sum>l<n. f l + q)
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sum f {..<0} + q * real 0 = (\<Sum>l<0. f l + q)
 2. \<And>n. sum f {..<n} + q * real n = (\<Sum>l<n. f l + q) \<Longrightarrow> sum f {..<Suc n} + q * real (Suc n) = (\<Sum>l<Suc n. f l + q)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. sum f {..<0} + q * real 0 = (\<Sum>l<0. f l + q)
 2. \<And>n. sum f {..<n} + q * real n = (\<Sum>l<n. f l + q) \<Longrightarrow> sum f {..<Suc n} + q * real (Suc n) = (\<Sum>l<Suc n. f l + q)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..<0} + q * real 0 = (\<Sum>l<0. f l + q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum f {..<0} + q * real 0 = (\<Sum>l<0. f l + q)

goal (1 subgoal):
 1. \<And>n. sum f {..<n} + q * real n = (\<Sum>l<n. f l + q) \<Longrightarrow> sum f {..<Suc n} + q * real (Suc n) = (\<Sum>l<Suc n. f l + q)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. sum f {..<n} + q * real n = (\<Sum>l<n. f l + q) \<Longrightarrow> sum f {..<Suc n} + q * real (Suc n) = (\<Sum>l<Suc n. f l + q)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
sum f {..<n} + q * real n = (\<Sum>l<n. f l + q)

goal (1 subgoal):
 1. \<And>n. sum f {..<n} + q * real n = (\<Sum>l<n. f l + q) \<Longrightarrow> sum f {..<Suc n} + q * real (Suc n) = (\<Sum>l<Suc n. f l + q)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
sum f {..<n} + q * real n = (\<Sum>l<n. f l + q)

goal (1 subgoal):
 1. sum f {..<Suc n} + q * real (Suc n) = (\<Sum>l<Suc n. f l + q)
[PROOF STEP]
by (auto simp: of_nat_Suc distrib_left lessThan_Suc)
[PROOF STATE]
proof (state)
this:
sum f {..<Suc n} + q * real (Suc n) = (\<Sum>l<Suc n. f l + q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Apollonius:
  fixes A B C :: "'a::euclidean_space"
  assumes "B \<noteq> C"
  assumes "b = dist A C"
  assumes "c = dist B A"
  assumes "d = dist A (midpoint B C)"
  assumes "m = dist B (midpoint B C)"
  shows "b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
from \<open>B \<noteq> C\<close>
[PROOF STATE]
proof (chain)
picking this:
B \<noteq> C
[PROOF STEP]
have "m \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
B \<noteq> C

goal (1 subgoal):
 1. m \<noteq> 0
[PROOF STEP]
unfolding \<open>m = _\<close>
[PROOF STATE]
proof (prove)
using this:
B \<noteq> C

goal (1 subgoal):
 1. dist B (midpoint B C) \<noteq> 0
[PROOF STEP]
using midpoint_eq_endpoint(1)
[PROOF STATE]
proof (prove)
using this:
B \<noteq> C
(midpoint ?a ?b = ?a) = (?a = ?b)

goal (1 subgoal):
 1. dist B (midpoint B C) \<noteq> 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
m \<noteq> 0

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "between (B, C) (midpoint B C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. between (B, C) (midpoint B C)
[PROOF STEP]
by (simp add: between_midpoint)
[PROOF STATE]
proof (state)
this:
between (B, C) (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
between (B, C) (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "dist C (midpoint B C) = dist B (midpoint B C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist C (midpoint B C) = dist B (midpoint B C)
[PROOF STEP]
by (simp add: dist_midpoint)
[PROOF STATE]
proof (state)
this:
dist C (midpoint B C) = dist B (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dist C (midpoint B C) = dist B (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "dist B C = 2 * dist B (midpoint B C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist B C = 2 * dist B (midpoint B C)
[PROOF STEP]
by (simp add: dist_midpoint)
[PROOF STATE]
proof (state)
this:
dist B C = 2 * dist B (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
dist B C = 2 * dist B (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
note assms(2-5)
[PROOF STATE]
proof (state)
this:
b = dist A C
c = dist B A
d = dist A (midpoint B C)
m = dist B (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
between (B, C) (midpoint B C)
dist C (midpoint B C) = dist B (midpoint B C)
dist B C = 2 * dist B (midpoint B C)
b = dist A C
c = dist B A
d = dist A (midpoint B C)
m = dist B (midpoint B C)
[PROOF STEP]
have "b\<^sup>2 * m + c\<^sup>2 * m = (2 * m) * (m\<^sup>2 + d\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
between (B, C) (midpoint B C)
dist C (midpoint B C) = dist B (midpoint B C)
dist B C = 2 * dist B (midpoint B C)
b = dist A C
c = dist B A
d = dist A (midpoint B C)
m = dist B (midpoint B C)

goal (1 subgoal):
 1. b\<^sup>2 * m + c\<^sup>2 * m = 2 * m * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
by (auto dest!: Stewart[where a="2 * m"] simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
b\<^sup>2 * m + c\<^sup>2 * m = 2 * m * (m\<^sup>2 + d\<^sup>2)

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
b\<^sup>2 * m + c\<^sup>2 * m = 2 * m * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "m * (b\<^sup>2 + c\<^sup>2) = m * (2 * (m\<^sup>2 + d\<^sup>2))"
[PROOF STATE]
proof (prove)
using this:
b\<^sup>2 * m + c\<^sup>2 * m = 2 * m * (m\<^sup>2 + d\<^sup>2)

goal (1 subgoal):
 1. m * (b\<^sup>2 + c\<^sup>2) = m * (2 * (m\<^sup>2 + d\<^sup>2))
[PROOF STEP]
by (simp add: distrib_left semiring_normalization_rules(7))
[PROOF STATE]
proof (state)
this:
m * (b\<^sup>2 + c\<^sup>2) = m * (2 * (m\<^sup>2 + d\<^sup>2))

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
from this \<open>m \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
m * (b\<^sup>2 + c\<^sup>2) = m * (2 * (m\<^sup>2 + d\<^sup>2))
m \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m * (b\<^sup>2 + c\<^sup>2) = m * (2 * (m\<^sup>2 + d\<^sup>2))
m \<noteq> 0

goal (1 subgoal):
 1. b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b\<^sup>2 + c\<^sup>2 = 2 * (m\<^sup>2 + d\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dist_fun_lt_imp_dist_val_lt:
  fixes f g :: "'a \<Rightarrow>\<^sub>C 'b"
  assumes "dist f g < e"
  shows "dist (f x) (g x) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (apply_bcontfun f x) (apply_bcontfun g x) < e
[PROOF STEP]
using dist_bounded assms
[PROOF STATE]
proof (prove)
using this:
dist (apply_bcontfun ?f ?x) (apply_bcontfun ?g ?x) \<le> dist ?f ?g
dist f g < e

goal (1 subgoal):
 1. dist (apply_bcontfun f x) (apply_bcontfun g x) < e
[PROOF STEP]
by (rule le_less_trans)


[STATEMENT]
lemma gcd_fib_mod: "gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)" if "0 < m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
proof (induct n rule: nat_less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>ma<n. gcd (fib m) (fib (ma mod m)) = gcd (fib m) (fib ma) \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
case hyp: (1 n)
[PROOF STATE]
proof (state)
this:
\<forall>ma<n. gcd (fib m) (fib (ma mod m)) = gcd (fib m) (fib ma)

goal (1 subgoal):
 1. \<And>n. \<forall>ma<n. gcd (fib m) (fib (ma mod m)) = gcd (fib m) (fib ma) \<Longrightarrow> gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
have "n mod m = (if n < m then n else (n - m) mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n mod m = (if n < m then n else (n - m) mod m)
[PROOF STEP]
by (rule mod_if)
[PROOF STATE]
proof (state)
this:
n mod m = (if n < m then n else (n - m) mod m)

goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n mod m = (if n < m then n else (n - m) mod m)

goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
have "gcd (fib m) (fib \<dots>) = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
proof (cases "n < m")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
 2. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n < m

goal (2 subgoals):
 1. n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
 2. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n < m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n < m

goal (1 subgoal):
 1. gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> n < m

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> n < m
[PROOF STEP]
have "m \<le> n"
[PROOF STATE]
proof (prove)
using this:
\<not> n < m

goal (1 subgoal):
 1. m \<le> n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
m \<le> n

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
from \<open>0 < m\<close> and False
[PROOF STATE]
proof (chain)
picking this:
0 < m
\<not> n < m
[PROOF STEP]
have "n - m < n"
[PROOF STATE]
proof (prove)
using this:
0 < m
\<not> n < m

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

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
with hyp
[PROOF STATE]
proof (chain)
picking this:
\<forall>ma<n. gcd (fib m) (fib (ma mod m)) = gcd (fib m) (fib ma)
n - m < n
[PROOF STEP]
have "gcd (fib m) (fib ((n - m) mod m))
          = gcd (fib m) (fib (n - m))"
[PROOF STATE]
proof (prove)
using this:
\<forall>ma<n. gcd (fib m) (fib (ma mod m)) = gcd (fib m) (fib ma)
n - m < n

goal (1 subgoal):
 1. gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib (n - m))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib (n - m))

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib (n - m))

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
have "\<dots> = gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)
[PROOF STEP]
using \<open>m \<le> n\<close>
[PROOF STATE]
proof (prove)
using this:
m \<le> n

goal (1 subgoal):
 1. gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)
[PROOF STEP]
by (rule gcd_fib_diff)
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n - m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
have "gcd (fib m) (fib ((n - m) mod m)) =
          gcd (fib m) (fib n)"
[PROOF STATE]
proof (prove)
using this:
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. \<not> n < m \<Longrightarrow> gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> n < m
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> n < m
gcd (fib m) (fib ((n - m) mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (if n < m then n else (n - m) mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)

goal (1 subgoal):
 1. gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
gcd (fib m) (fib (n mod m)) = gcd (fib m) (fib n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutations_of_set_singleton [simp]: "permutations_of_set {x} = {[x]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permutations_of_set {x} = {[x]}
[PROOF STEP]
by (subst permutations_of_set_nonempty) auto


[STATEMENT]
lemma subseqs_powset: "set ` set (subseqs xs) = Pow (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set ` set (subseqs xs) = Pow (set xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set ` set (subseqs xs) = Pow (set xs)
[PROOF STEP]
have aux: "\<And>x A. set ` Cons x ` A = insert x ` set ` A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x A. set ` (#) x ` A = insert x ` set ` A
[PROOF STEP]
by (auto simp add: image_def)
[PROOF STATE]
proof (state)
this:
set ` (#) ?x ` ?A = insert ?x ` set ` ?A

goal (1 subgoal):
 1. set ` set (subseqs xs) = Pow (set xs)
[PROOF STEP]
have "set (map set (subseqs xs)) = Pow (set xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (map set (subseqs xs)) = Pow (set xs)
[PROOF STEP]
by (induct xs) (simp_all add: aux Let_def Pow_insert Un_commute comp_def del: map_map)
[PROOF STATE]
proof (state)
this:
set (map set (subseqs xs)) = Pow (set xs)

goal (1 subgoal):
 1. set ` set (subseqs xs) = Pow (set xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set (map set (subseqs xs)) = Pow (set xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set (map set (subseqs xs)) = Pow (set xs)

goal (1 subgoal):
 1. set ` set (subseqs xs) = Pow (set xs)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set ` set (subseqs xs) = Pow (set xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pickFT_pred:
assumes "WtFT cl = 1"  shows "\<exists> n. pickFT_pred cl n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. pickFT_pred cl n
[PROOF STEP]
proof(rule ccontr, unfold not_ex)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>x. \<not> pickFT_pred cl x \<Longrightarrow> False
[PROOF STEP]
assume "\<forall>n. \<not> pickFT_pred cl n"
[PROOF STATE]
proof (state)
this:
\<forall>n. \<not> pickFT_pred cl n

goal (1 subgoal):
 1. \<forall>x. \<not> pickFT_pred cl x \<Longrightarrow> False
[PROOF STEP]
hence "\<And> n. n < length cl \<Longrightarrow> \<not> finished (cl!n)"
[PROOF STATE]
proof (prove)
using this:
\<forall>n. \<not> pickFT_pred cl n

goal (1 subgoal):
 1. \<And>n. n < length cl \<Longrightarrow> \<not> finished (cl ! n)
[PROOF STEP]
unfolding pickFT_pred_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. \<not> (n < length cl \<and> finished (cl ! n))

goal (1 subgoal):
 1. \<And>n. n < length cl \<Longrightarrow> \<not> finished (cl ! n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?n < length cl \<Longrightarrow> \<not> finished (cl ! ?n)

goal (1 subgoal):
 1. \<forall>x. \<not> pickFT_pred cl x \<Longrightarrow> False
[PROOF STEP]
hence "theFT cl = {}"
[PROOF STATE]
proof (prove)
using this:
?n < length cl \<Longrightarrow> \<not> finished (cl ! ?n)

goal (1 subgoal):
 1. theFT cl = {}
[PROOF STEP]
unfolding theFT_def
[PROOF STATE]
proof (prove)
using this:
?n < length cl \<Longrightarrow> \<not> finished (cl ! ?n)

goal (1 subgoal):
 1. {n. n < length cl \<and> finished (cl ! n)} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
theFT cl = {}

goal (1 subgoal):
 1. \<forall>x. \<not> pickFT_pred cl x \<Longrightarrow> False
[PROOF STEP]
hence "WtFT cl = 0"
[PROOF STATE]
proof (prove)
using this:
theFT cl = {}

goal (1 subgoal):
 1. WtFT cl = 0
[PROOF STEP]
unfolding WtFT_def
[PROOF STATE]
proof (prove)
using this:
theFT cl = {}

goal (1 subgoal):
 1. (\<Sum>n\<in>theFT cl. 1 / real (length cl)) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
WtFT cl = 0

goal (1 subgoal):
 1. \<forall>x. \<not> pickFT_pred cl x \<Longrightarrow> False
[PROOF STEP]
thus False
[PROOF STATE]
proof (prove)
using this:
WtFT cl = 0

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
WtFT cl = 0
WtFT cl = 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiset_induct_max[case_names empty add]:
  fixes M :: "'a::linorder multiset"
  assumes
    empty: "P {#}" and
    add: "\<And>x M. P M \<Longrightarrow> (\<forall>y \<in># M. y \<le> x) \<Longrightarrow> P (add_mset x M)"
  shows "P M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P M
[PROOF STEP]
proof (induct "size M" arbitrary: M)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k = size ?M \<Longrightarrow> P ?M
Suc k = size M

goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
note ih = this(1) and Sk_eq_sz_M = this(2)
[PROOF STATE]
proof (state)
this:
k = size ?M \<Longrightarrow> P ?M
Suc k = size M

goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
let ?y = "Max_mset M"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
let ?N = "M - {#?y#}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
have M: "M = add_mset ?y ?N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = add_mset (Max_mset M) (M - {#Max_mset M#})
[PROOF STEP]
by (metis Max_in Sk_eq_sz_M finite_set_mset insert_DiffM lessI not_less_zero
      set_mset_eq_empty_iff size_empty)
[PROOF STATE]
proof (state)
this:
M = add_mset (Max_mset M) (M - {#Max_mset M#})

goal (2 subgoals):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
 2. \<And>x M. \<lbrakk>\<And>M. x = size M \<Longrightarrow> P M; Suc x = size M\<rbrakk> \<Longrightarrow> P M
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P M
[PROOF STEP]
by (subst M, rule add, rule ih, metis M Sk_eq_sz_M nat.inject size_add_mset,
      meson Max_ge finite_set_mset in_diffD)
[PROOF STATE]
proof (state)
this:
P M

goal (1 subgoal):
 1. \<And>M. 0 = size M \<Longrightarrow> P M
[PROOF STEP]
qed (simp add: empty)


[STATEMENT]
lemma many_reducible_to_trans: "\<lbrakk> many_reducible_to A B; many_reducible_to B C \<rbrakk> \<Longrightarrow> many_reducible_to A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>many_reducible_to A B; many_reducible_to B C\<rbrakk> \<Longrightarrow> many_reducible_to A C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>many_reducible_to A B; many_reducible_to B C\<rbrakk> \<Longrightarrow> many_reducible_to A C
[PROOF STEP]
assume "many_reducible_to A B"
[PROOF STATE]
proof (state)
this:
many_reducible_to A B

goal (1 subgoal):
 1. \<lbrakk>many_reducible_to A B; many_reducible_to B C\<rbrakk> \<Longrightarrow> many_reducible_to A C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
many_reducible_to A B
[PROOF STEP]
obtain f where A1: "many_reducible_to_via A B f"
[PROOF STATE]
proof (prove)
using this:
many_reducible_to A B

goal (1 subgoal):
 1. (\<And>f. many_reducible_to_via A B f \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding many_reducible_to_def
[PROOF STATE]
proof (prove)
using this:
Ex (many_reducible_to_via A B)

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

goal (1 subgoal):
 1. \<lbrakk>many_reducible_to A B; many_reducible_to B C\<rbrakk> \<Longrightarrow> many_reducible_to A C
[PROOF STEP]
assume "many_reducible_to B C"
[PROOF STATE]
proof (state)
this:
many_reducible_to B C

goal (1 subgoal):
 1. \<lbrakk>many_reducible_to A B; many_reducible_to B C\<rbrakk> \<Longrightarrow> many_reducible_to A C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
many_reducible_to B C
[PROOF STEP]
obtain g where A2: "many_reducible_to_via B C g"
[PROOF STATE]
proof (prove)
using this:
many_reducible_to B C

goal (1 subgoal):
 1. (\<And>g. many_reducible_to_via B C g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding many_reducible_to_def
[PROOF STATE]
proof (prove)
using this:
Ex (many_reducible_to_via B C)

goal (1 subgoal):
 1. (\<And>g. many_reducible_to_via B C g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
many_reducible_to_via B C g

goal (1 subgoal):
 1. \<lbrakk>many_reducible_to A B; many_reducible_to B C\<rbrakk> \<Longrightarrow> many_reducible_to A C
[PROOF STEP]
from A1 A2
[PROOF STATE]
proof (chain)
picking this:
many_reducible_to_via A B f
many_reducible_to_via B C g
[PROOF STEP]
have "many_reducible_to_via A C (g o f)"
[PROOF STATE]
proof (prove)
using this:
many_reducible_to_via A B f
many_reducible_to_via B C g

goal (1 subgoal):
 1. many_reducible_to_via A C (g \<circ> f)
[PROOF STEP]
by (rule many_reducible_to_via_trans)
[PROOF STATE]
proof (state)
this:
many_reducible_to_via A C (g \<circ> f)

goal (1 subgoal):
 1. \<lbrakk>many_reducible_to A B; many_reducible_to B C\<rbrakk> \<Longrightarrow> many_reducible_to A C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
many_reducible_to_via A C (g \<circ> f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
many_reducible_to_via A C (g \<circ> f)

goal (1 subgoal):
 1. many_reducible_to A C
[PROOF STEP]
unfolding many_reducible_to_def
[PROOF STATE]
proof (prove)
using this:
many_reducible_to_via A C (g \<circ> f)

goal (1 subgoal):
 1. Ex (many_reducible_to_via A C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
many_reducible_to A C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uminus_zero_vec[simp]: "- (0\<^sub>v n) = (0\<^sub>v n :: 'a :: group_add vec)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 0\<^sub>v n = 0\<^sub>v n
[PROOF STEP]
by (intro eq_vecI, auto)