[STATEMENT]
lemma test_suite_to_io_maximal_finite :
  assumes "implies_completeness T M m"
  and     "is_finite_test_suite T"
  and     "observable M"
shows "finite (test_suite_to_io_maximal M T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (test_suite_to_io_maximal M T)
[PROOF STEP]
using test_suite_to_io_finite[OF assms(1,2)]
[PROOF STATE]
proof (prove)
using this:
finite (test_suite_to_io M T)

goal (1 subgoal):
 1. finite (test_suite_to_io_maximal M T)
[PROOF STEP]
unfolding test_suite_to_io_maximal_code[OF assms, symmetric]
[PROOF STATE]
proof (prove)
using this:
finite (test_suite_to_io M T)

goal (1 subgoal):
 1. finite {io' \<in> test_suite_to_io M T. \<nexists>io''. io'' \<noteq> [] \<and> io' @ io'' \<in> test_suite_to_io M T}
[PROOF STEP]
by simp


[STATEMENT]
lemma (in group) subgroup_ord_eq:
  assumes "subgroup H G" "x \<in> H"
  shows "group.ord (G\<lparr>carrier := H\<rparr>) x = ord x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. group.ord (G\<lparr>carrier := H\<rparr>) x = ord x
[PROOF STEP]
using nat_pow_consistent ord_def group.ord_def[of "(G\<lparr>carrier := H\<rparr>)" x]
        subgroup.subgroup_is_group[of H G] assms
[PROOF STATE]
proof (prove)
using this:
?x [^] ?n = ?x [^]\<^bsub>G\<lparr>carrier := ?H\<rparr>\<^esub> ?n
ord ?x \<equiv> SOME d. \<forall>n. (?x [^] n = \<one>) = (d dvd n)
Group.group (G\<lparr>carrier := H\<rparr>) \<Longrightarrow> group.ord (G\<lparr>carrier := H\<rparr>) x \<equiv> SOME d. \<forall>n. (x [^]\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub> n = \<one>\<^bsub>G\<lparr>carrier := H\<rparr>\<^esub>) = (d dvd n)
\<lbrakk>subgroup H G; Group.group G\<rbrakk> \<Longrightarrow> Group.group (G\<lparr>carrier := H\<rparr>)
subgroup H G
x \<in> H

goal (1 subgoal):
 1. group.ord (G\<lparr>carrier := H\<rparr>) x = ord x
[PROOF STEP]
by simp


[STATEMENT]
lemma vec_of_basis_enum_divide:
  fixes \<psi> \<phi> :: "'a::one_dim"
  shows "vec_of_basis_enum (\<psi> / \<phi>)
   = vec_of_list [vec_index (vec_of_basis_enum \<psi>) 0 / vec_index (vec_of_basis_enum \<phi>) 0]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (\<psi> / \<phi>) = vec_of_list [vec_of_basis_enum \<psi> $ 0 / vec_of_basis_enum \<phi> $ 0]
[PROOF STEP]
by (simp add: divide_inverse vec_of_basis_enum_to_inverse vec_of_basis_enum_times)


[STATEMENT]
lemma relabel_vars_mult:
  assumes "g \<in> I \<rightarrow> J"
  assumes "P \<in> carrier (Pring R I)"
  assumes "Q \<in> carrier (Pring R I)"
  shows "relabel_vars I J g (P \<otimes>\<^bsub>Pring R I\<^esub> Q) = relabel_vars I J g P \<otimes>\<^bsub>Pring R J\<^esub> relabel_vars I J g Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relabel_vars I J g (P \<otimes>\<^bsub>Pring R I\<^esub> Q) = relabel_vars I J g P \<otimes>\<^bsub>Pring R J\<^esub> relabel_vars I J g Q
[PROOF STEP]
using assms relabel_vars_is_morphism(1)[of g I J] ring_hom_ring.homh ring_hom_mult
[PROOF STATE]
proof (prove)
using this:
g \<in> I \<rightarrow> J
P \<in> carrier (Pring R I)
Q \<in> carrier (Pring R I)
g \<in> I \<rightarrow> J \<Longrightarrow> ring_hom_ring (Pring R I) (Pring R J) (relabel_vars I J g)
ring_hom_ring ?R ?S ?h \<Longrightarrow> ?h \<in> ring_hom ?R ?S
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<otimes>\<^bsub>?R\<^esub> ?y) = ?h ?x \<otimes>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. relabel_vars I J g (P \<otimes>\<^bsub>Pring R I\<^esub> Q) = relabel_vars I J g P \<otimes>\<^bsub>Pring R J\<^esub> relabel_vars I J g Q
[PROOF STEP]
by (metis (no_types, lifting))


[STATEMENT]
lemma odd_word_imp_even_next:"odd (unat (x::('a::len) word)) \<Longrightarrow> x + 1 = 0 \<or> even (unat (x + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (unat x) \<Longrightarrow> x + 1 = 0 \<or> even (unat (x + 1))
[PROOF STEP]
apply (cut_tac x=x in word_overflow_unat)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>odd (unat x); unat (x + 1) = unat x + 1 \<or> x + 1 = 0\<rbrakk> \<Longrightarrow> x + 1 = 0 \<or> even (unat (x + 1))
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma output_complete_alt_def_h :
  "output_complete M = (\<forall> q x . h M (q,x) \<noteq> {} \<longrightarrow> (\<forall> y \<in> outputs M . \<exists> q' . (y,q') \<in> h M (q,x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. output_complete M = (\<forall>q x. FSM.h M (q, x) \<noteq> {} \<longrightarrow> (\<forall>y\<in>FSM.outputs M. \<exists>q'. (y, q') \<in> FSM.h M (q, x)))
[PROOF STEP]
by force


[STATEMENT]
lemma mset_ran_empty_iff[simp]:
  "finite r \<Longrightarrow> mset_ran a r = {#} \<longleftrightarrow> r={}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite r \<Longrightarrow> (mset_ran a r = {#}) = (r = {})
[PROOF STEP]
by (auto simp: mset_ran_def mset_set_empty_iff)


[STATEMENT]
lemma Sup_trans_least:
  "\<lbrakk> \<forall>t\<in>S. le_utrans t u; \<And>P. unitary P \<Longrightarrow> unitary (u P) \<rbrakk> \<Longrightarrow> le_utrans (Sup_trans S) u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>t\<in>S. le_utrans t u; \<And>P. unitary P \<Longrightarrow> unitary (u P)\<rbrakk> \<Longrightarrow> le_utrans (Sup_trans S) u
[PROOF STEP]
unfolding Sup_trans_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>t\<in>S. le_utrans t u; \<And>P. unitary P \<Longrightarrow> unitary (u P)\<rbrakk> \<Longrightarrow> le_utrans (\<lambda>P. Sup_exp {t P |t. t \<in> S}) u
[PROOF STEP]
by(auto intro!:sound_nneg[OF unitary_sound] le_utransI[OF Sup_exp_least])


[STATEMENT]
lemma eint_Min_gr:
  assumes "finite (A::eint set)"
  assumes "\<And>x. x \<in> A \<Longrightarrow> x > c"
  assumes "A \<noteq> {}"
  shows "Min A > c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c < Min A
[PROOF STEP]
using Min_in[of A] assms(2)[of "Min A"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite A; A \<noteq> {}\<rbrakk> \<Longrightarrow> Min A \<in> A
Min A \<in> A \<Longrightarrow> c < Min A
finite A
?x1 \<in> A \<Longrightarrow> c < ?x1
A \<noteq> {}

goal (1 subgoal):
 1. c < Min A
[PROOF STEP]
by blast


[STATEMENT]
lemma prefixToLevelPrefixToLevelHigherLevel:
  assumes "level \<le> level'"
  shows "prefixToLevel level M = prefixToLevel level (prefixToLevel level' M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prefixToLevel level M = prefixToLevel level (prefixToLevel level' M)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
level \<le> level'

goal (1 subgoal):
 1. prefixToLevel level M = prefixToLevel level (prefixToLevel level' M)
[PROOF STEP]
unfolding prefixToLevel_def
[PROOF STATE]
proof (prove)
using this:
level \<le> level'

goal (1 subgoal):
 1. prefixToLevel_aux M level 0 = prefixToLevel_aux (prefixToLevel_aux M level' 0) level 0
[PROOF STEP]
using prefixToLevel_auxPrefixToLevel_auxHigherLevel[of "level" "level'" "M" "0"]
[PROOF STATE]
proof (prove)
using this:
level \<le> level'
level \<le> level' \<Longrightarrow> prefixToLevel_aux M level 0 = prefixToLevel_aux (prefixToLevel_aux M level' 0) level 0

goal (1 subgoal):
 1. prefixToLevel_aux M level 0 = prefixToLevel_aux (prefixToLevel_aux M level' 0) level 0
[PROOF STEP]
by simp


[STATEMENT]
lemma join_comm:
  fixes L (structure)
  shows "x \<squnion> y = y \<squnion> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<squnion> y = y \<squnion> x
[PROOF STEP]
by (unfold join_def) (simp add: insert_commute)


[STATEMENT]
lemma drop_shiftr: "drop n (to_bl (w >> n)) = take (size w - n) (to_bl w)"
  for w :: "'a::len word"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. drop n (to_bl (w >> n)) = take (size w - n) (to_bl w)
[PROOF STEP]
apply (rule nth_equalityI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (drop n (to_bl (w >> n))) = length (take (size w - n) (to_bl w))
 2. \<And>i. i < length (drop n (to_bl (w >> n))) \<Longrightarrow> drop n (to_bl (w >> n)) ! i = take (size w - n) (to_bl w) ! i
[PROOF STEP]
apply (simp_all add: word_size to_bl_nth bit_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma USUP_atLeast_first:
  "(P(n) \<and> (\<Squnion> i \<in> {Suc n..} \<bullet> P(i))) = (\<Squnion> i \<in> {n..} \<bullet> P(i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P n \<and> (\<Squnion> i \<in> {Suc n..} \<bullet> P i)) = (\<Squnion> i \<in> {n..} \<bullet> P i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (P n \<and> (\<Squnion> i \<in> {Suc n..} \<bullet> P i)) = (\<Squnion> i \<in> {n..} \<bullet> P i)
[PROOF STEP]
have "insert n {Suc n..} = {n..}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert n {Suc n..} = {n..}
[PROOF STEP]
by (auto)
[PROOF STATE]
proof (state)
this:
insert n {Suc n..} = {n..}

goal (1 subgoal):
 1. (P n \<and> (\<Squnion> i \<in> {Suc n..} \<bullet> P i)) = (\<Squnion> i \<in> {n..} \<bullet> P i)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
insert n {Suc n..} = {n..}

goal (1 subgoal):
 1. (P n \<and> (\<Squnion> i \<in> {Suc n..} \<bullet> P i)) = (\<Squnion> i \<in> {n..} \<bullet> P i)
[PROOF STEP]
by (metis USUP_insert conj_upred_def)
[PROOF STATE]
proof (state)
this:
(P n \<and> (\<Squnion> i \<in> {Suc n..} \<bullet> P i)) = (\<Squnion> i \<in> {n..} \<bullet> P i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_to_iarray_row[code_unfold]: "vec_to_iarray (row i A) = row_iarray (to_nat i) (matrix_to_iarray A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_to_iarray (row i A) = row_iarray (mod_type_class.to_nat i) (matrix_to_iarray A)
[PROOF STEP]
unfolding row_def row_iarray_def vec_to_iarray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IArray.of_fun (\<lambda>ia. vec_lambda (($) (A $ i)) $ mod_type_class.from_nat ia) CARD('b) = matrix_to_iarray A !! mod_type_class.to_nat i
[PROOF STEP]
by (auto, metis IArray.sub_def IArray.of_fun_def vec_matrix vec_to_iarray_def)


[STATEMENT]
lemma pmf_equiv_intro[intro]:
  assumes "\<And>e. e \<in> set_pmf p \<Longrightarrow> pmf p e = pmf q e"
  assumes "\<And>e. e \<in> set_pmf q \<Longrightarrow> pmf q e = pmf p e"
  shows "p = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = q
[PROOF STEP]
by (metis assms(2) less_irrefl pmf_neq_exists_less pmf_not_neg set_pmf_iff)


[STATEMENT]
lemma fact_code [code]:
  "fact n = (of_nat (fold_atLeastAtMost_nat ((*)) 2 n 1) :: 'a::semiring_char_0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
have "fact n = (of_nat (\<Prod>{1..n}) :: 'a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact n = of_nat (\<Prod>{1..n})
[PROOF STEP]
by (simp add: fact_prod)
[PROOF STATE]
proof (state)
this:
fact n = of_nat (\<Prod>{1..n})

goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fact n = of_nat (\<Prod>{1..n})

goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
have "\<Prod>{1..n} = \<Prod>{2..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>{1..n} = \<Prod>{2..n}
[PROOF STEP]
by (intro prod.mono_neutral_right) auto
[PROOF STATE]
proof (state)
this:
\<Prod>{1..n} = \<Prod>{2..n}

goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Prod>{1..n} = \<Prod>{2..n}

goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
have "\<dots> = fold_atLeastAtMost_nat ((*)) 2 n 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>{2..n} = fold_atLeastAtMost_nat (*) 2 n 1
[PROOF STEP]
by (simp add: prod_atLeastAtMost_code)
[PROOF STATE]
proof (state)
this:
\<Prod>{2..n} = fold_atLeastAtMost_nat (*) 2 n 1

goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)

goal (1 subgoal):
 1. fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fact n = of_nat (fold_atLeastAtMost_nat (*) 2 n 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rawpsubstT_suc:
assumes "r \<in> trm" and "snd ` (set txs) \<subseteq> var" and "fst ` (set txs) \<subseteq> trm"
shows "rawpsubstT (suc r) txs = suc (rawpsubstT r txs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rawpsubstT (suc r) txs = suc (rawpsubstT r txs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r \<in> trm
snd ` set txs \<subseteq> var
fst ` set txs \<subseteq> trm

goal (1 subgoal):
 1. rawpsubstT (suc r) txs = suc (rawpsubstT r txs)
[PROOF STEP]
apply(induct txs arbitrary: r)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>r. \<lbrakk>r \<in> trm; snd ` set [] \<subseteq> var; fst ` set [] \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r) [] = suc (rawpsubstT r [])
 2. \<And>a txs r. \<lbrakk>\<And>r. \<lbrakk>r \<in> trm; snd ` set txs \<subseteq> var; fst ` set txs \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r) txs = suc (rawpsubstT r txs); r \<in> trm; snd ` set (a # txs) \<subseteq> var; fst ` set (a # txs) \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r) (a # txs) = suc (rawpsubstT r (a # txs))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>r_ \<in> trm; snd ` set [] \<subseteq> var; fst ` set [] \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r_) [] = suc (rawpsubstT r_ [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a txs r. \<lbrakk>\<And>r. \<lbrakk>r \<in> trm; snd ` set txs \<subseteq> var; fst ` set txs \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r) txs = suc (rawpsubstT r txs); r \<in> trm; snd ` set (a # txs) \<subseteq> var; fst ` set (a # txs) \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r) (a # txs) = suc (rawpsubstT r (a # txs))
[PROOF STEP]
subgoal for tx txs r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>r. \<lbrakk>r \<in> trm; snd ` set txs \<subseteq> var; fst ` set txs \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r) txs = suc (rawpsubstT r txs); r \<in> trm; snd ` set (tx # txs) \<subseteq> var; fst ` set (tx # txs) \<subseteq> trm\<rbrakk> \<Longrightarrow> rawpsubstT (suc r) (tx # txs) = suc (rawpsubstT r (tx # txs))
[PROOF STEP]
by (cases tx) auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.


[STATEMENT]
lemma continuous_at_real_range:
  fixes f :: "'a::real_normed_vector \<Rightarrow> real"
  shows "continuous (at x) f \<longleftrightarrow> (\<forall>e>0. \<exists>d>0. \<forall>x'. norm(x' - x) < d --> \<bar>f x' - f x\<bar> < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f x = (\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e)
[PROOF STEP]
unfolding continuous_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>x\<rightarrow> f x = (\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e)
[PROOF STEP]
unfolding Lim_at
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>d>0. \<forall>xa. 0 < dist xa x \<and> dist xa x < d \<longrightarrow> dist (f xa) (f x) < e) = (\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e)
[PROOF STEP]
unfolding dist_norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<exists>d>0. \<forall>xa. 0 < norm (xa - x) \<and> norm (xa - x) < d \<longrightarrow> norm (f xa - f x) < e) = (\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>d>0. \<forall>xa. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> \<bar>f xa - f x\<bar> < e; 0 < e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e
 2. \<And>e. \<lbrakk>\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e; 0 < e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>xa. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> \<bar>f xa - f x\<bar> < e
[PROOF STEP]
apply (erule_tac x=e in allE, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>e d. \<lbrakk>0 < e; 0 < d; \<forall>xa. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> \<bar>f xa - f x\<bar> < e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e
 2. \<And>e. \<lbrakk>\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e; 0 < e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>xa. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> \<bar>f xa - f x\<bar> < e
[PROOF STEP]
apply (rule_tac x=d in exI, auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>e d x'. \<lbrakk>0 < e; 0 < d; \<forall>xa. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> \<bar>f xa - f x\<bar> < e; norm (x' - x) < d\<rbrakk> \<Longrightarrow> \<bar>f x' - f x\<bar> < e
 2. \<And>e. \<lbrakk>\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e; 0 < e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>xa. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> \<bar>f xa - f x\<bar> < e
[PROOF STEP]
apply (erule_tac x=x' in allE, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>d>0. \<forall>x'. norm (x' - x) < d \<longrightarrow> \<bar>f x' - f x\<bar> < e; 0 < e\<rbrakk> \<Longrightarrow> \<exists>d>0. \<forall>xa. xa \<noteq> x \<and> norm (xa - x) < d \<longrightarrow> \<bar>f xa - f x\<bar> < e
[PROOF STEP]
apply (erule_tac x=e in allE, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma iMin_less_iff: "I \<noteq> {} \<Longrightarrow> (iMin I < n) = (\<exists>a\<in>I. a < n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> (iMin I < n) = (\<exists>a\<in>I. a < n)
[PROOF STEP]
by (metis iMinI_ex2 iMin_neq_imp_greater order_less_trans)


[STATEMENT]
lemma convex_onD_Icc:
  assumes "convex_on {x..y} f" "x \<le> (y :: _ :: {real_vector,preorder})"
  shows "\<And>t. t \<ge> 0 \<Longrightarrow> t \<le> 1 \<Longrightarrow>
    f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t. \<lbrakk>0 \<le> t; t \<le> 1\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
x \<le> y

goal (1 subgoal):
 1. \<And>t. \<lbrakk>0 \<le> t; t \<le> 1\<rbrakk> \<Longrightarrow> f ((1 - t) *\<^sub>R x + t *\<^sub>R y) \<le> (1 - t) * f x + t * f y
[PROOF STEP]
by (intro convex_onD [OF assms(1)]) simp_all


[STATEMENT]
lemma bounded_subset: "bounded T \<Longrightarrow> S \<subseteq> T \<Longrightarrow> bounded S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded T; S \<subseteq> T\<rbrakk> \<Longrightarrow> bounded S
[PROOF STEP]
by (metis bounded_def subset_eq)


[STATEMENT]
lemma subset_code [code_unfold]:
  "set xs \<subseteq> set ys \<longleftrightarrow> (\<forall>x \<in> set xs. x \<in> set ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set xs \<subseteq> set ys) = (\<forall>x\<in>set xs. x \<in> set ys)
[PROOF STEP]
by(rule Set.subset_eq)


[STATEMENT]
lemma fps_conv_radius_shift [simp]:
  "fps_conv_radius (fps_shift n f) = fps_conv_radius f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_conv_radius (fps_shift n f) = fps_conv_radius f
[PROOF STEP]
by (simp add: fps_conv_radius_def fps_shift_def conv_radius_shift)


[STATEMENT]
lemma circline_type_zero_card_eq1_0:
  assumes "circline_type H = 0" and "0\<^sub>h \<in> circline_set H"
  shows "circline_set H = {0\<^sub>h}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. circline_set H = {0\<^sub>h}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
circline_type H = 0
0\<^sub>h \<in> circline_set H

goal (1 subgoal):
 1. circline_set H = {0\<^sub>h}
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
circline_type H = 0
0\<^sub>h \<in> Collect (on_circline H)

goal (1 subgoal):
 1. Collect (on_circline H) = {0\<^sub>h}
[PROOF STEP]
proof(safe)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>circline_type H = 0; on_circline H 0\<^sub>h; x \<notin> {}; on_circline H x\<rbrakk> \<Longrightarrow> x = 0\<^sub>h
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>circline_type H = 0; on_circline H 0\<^sub>h; x \<notin> {}; on_circline H x\<rbrakk> \<Longrightarrow> x = 0\<^sub>h
[PROOF STEP]
assume "on_circline H z" "circline_type H = 0" "on_circline H 0\<^sub>h"
[PROOF STATE]
proof (state)
this:
on_circline H z
circline_type H = 0
on_circline H 0\<^sub>h

goal (1 subgoal):
 1. \<And>x. \<lbrakk>circline_type H = 0; on_circline H 0\<^sub>h; x \<notin> {}; on_circline H x\<rbrakk> \<Longrightarrow> x = 0\<^sub>h
[PROOF STEP]
hence "H = circline_point_0"
[PROOF STATE]
proof (prove)
using this:
on_circline H z
circline_type H = 0
on_circline H 0\<^sub>h

goal (1 subgoal):
 1. H = circline_point_0
[PROOF STEP]
using unique_circline_type_zero_0'
[PROOF STATE]
proof (prove)
using this:
on_circline H z
circline_type H = 0
on_circline H 0\<^sub>h
(circline_type circline_point_0 = 0 \<and> 0\<^sub>h \<in> circline_set circline_point_0) \<and> (\<forall>H. circline_type H = 0 \<and> 0\<^sub>h \<in> circline_set H \<longrightarrow> H = circline_point_0)

goal (1 subgoal):
 1. H = circline_point_0
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
using this:
on_circline H z
circline_type H = 0
on_circline H 0\<^sub>h
(circline_type circline_point_0 = 0 \<and> 0\<^sub>h \<in> Collect (on_circline circline_point_0)) \<and> (\<forall>H. circline_type H = 0 \<and> 0\<^sub>h \<in> Collect (on_circline H) \<longrightarrow> H = circline_point_0)

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

goal (1 subgoal):
 1. \<And>x. \<lbrakk>circline_type H = 0; on_circline H 0\<^sub>h; x \<notin> {}; on_circline H x\<rbrakk> \<Longrightarrow> x = 0\<^sub>h
[PROOF STEP]
thus "z = 0\<^sub>h"
[PROOF STATE]
proof (prove)
using this:
H = circline_point_0

goal (1 subgoal):
 1. z = 0\<^sub>h
[PROOF STEP]
using \<open>on_circline H z\<close>
[PROOF STATE]
proof (prove)
using this:
H = circline_point_0
on_circline H z

goal (1 subgoal):
 1. z = 0\<^sub>h
[PROOF STEP]
by (transfer, transfer) (case_tac z, case_tac H, force simp add: vec_cnj_def)
[PROOF STATE]
proof (state)
this:
z = 0\<^sub>h

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem density_one_imp_cesaro:
  assumes "\<And>n. u n \<ge> (0::real)" "\<And>n. u n \<le> C"
          "lower_asymptotic_density A = 1"
          "(\<lambda>n. u n * indicator A n) \<longlonglongrightarrow> 0"
  shows "(\<lambda>n. (\<Sum>i<n. u i)/n) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. sum u {..<n} / real n) \<longlonglongrightarrow> 0
[PROOF STEP]
proof (rule order_tendstoI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. a < sum u {..<x} / real x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. a < sum u {..<x} / real x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
assume "e < 0"
[PROOF STATE]
proof (state)
this:
e < 0

goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. a < sum u {..<x} / real x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
have "(\<Sum>i<n. u i)/n \<ge> 0" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> sum u {..<n} / real n
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
0 \<le> u ?n

goal (1 subgoal):
 1. 0 \<le> sum u {..<n} / real n
[PROOF STEP]
by (simp add: sum_nonneg divide_simps)
[PROOF STATE]
proof (state)
this:
0 \<le> sum u {..<?n} / real ?n

goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. a < sum u {..<x} / real x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 \<le> sum u {..<?n} / real ?n
[PROOF STEP]
have "(\<Sum>i<n. u i)/n > e" for n
[PROOF STATE]
proof (prove)
using this:
0 \<le> sum u {..<?n} / real ?n

goal (1 subgoal):
 1. e < sum u {..<n} / real n
[PROOF STEP]
using \<open>e < 0\<close> less_le_trans
[PROOF STATE]
proof (prove)
using this:
0 \<le> sum u {..<?n} / real ?n
e < 0
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z

goal (1 subgoal):
 1. e < sum u {..<n} / real n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
e < sum u {..<?n} / real ?n

goal (2 subgoals):
 1. \<And>a. a < 0 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. a < sum u {..<x} / real x
 2. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e < sum u {..<?n} / real ?n
[PROOF STEP]
show "eventually (\<lambda>n. (\<Sum>i<n. u i)/n > e) sequentially"
[PROOF STATE]
proof (prove)
using this:
e < sum u {..<?n} / real ?n

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. e < sum u {..<n} / real n
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
e < sum u {..<?n} / real ?n

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. e < sum u {..<n} / real n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. e < sum u {..<n} / real n

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
have "C \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> C
[PROOF STEP]
using \<open>u 0 \<ge> 0\<close> \<open>u 0 \<le> C\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> u 0
u 0 \<le> C

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

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
have "eventually (\<lambda>n. u n * indicator A n < e/4) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. u n * indicat_real A n < e / 4
[PROOF STEP]
using order_tendstoD(2)[OF assms(4), of "e/4"] \<open>e>0\<close>
[PROOF STATE]
proof (prove)
using this:
0 < e / 4 \<Longrightarrow> \<forall>\<^sub>F x in sequentially. u x * indicat_real A x < e / 4
0 < e

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. u n * indicat_real A n < e / 4
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. u n * indicat_real A n < e / 4

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. u n * indicat_real A n < e / 4
[PROOF STEP]
obtain N where N: "\<And>k. k \<ge> N \<Longrightarrow> u k * indicator A k < e/4"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. u n * indicat_real A n < e / 4

goal (1 subgoal):
 1. (\<And>N. (\<And>k. N \<le> k \<Longrightarrow> u k * indicat_real A k < e / 4) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. u n * indicat_real A n < e / 4

goal (1 subgoal):
 1. (\<And>N. (\<And>k. N \<le> k \<Longrightarrow> u k * indicat_real A k < e / 4) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> ?k \<Longrightarrow> u ?k * indicat_real A ?k < e / 4

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
define B where "B = UNIV - A"
[PROOF STATE]
proof (state)
this:
B = UNIV - A

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
have *: "upper_asymptotic_density B = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_asymptotic_density B = 0
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> u ?n
u ?n \<le> C
lower_asymptotic_density A = 1
(\<lambda>n. u n * indicat_real A n) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. upper_asymptotic_density B = 0
[PROOF STEP]
unfolding B_def lower_upper_asymptotic_density_complement
[PROOF STATE]
proof (prove)
using this:
0 \<le> u ?n
u ?n \<le> C
1 - upper_asymptotic_density (UNIV - A) = 1
(\<lambda>n. u n * indicat_real A n) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. upper_asymptotic_density (UNIV - A) = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
upper_asymptotic_density B = 0

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
have "eventually (\<lambda>n. card(B \<inter> {..<n}) < (e/(4 * (C+1))) * n) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. real (card (B \<inter> {..<n})) < e / (4 * (C + 1)) * real n
[PROOF STEP]
apply (rule upper_asymptotic_densityD)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper_asymptotic_density B < e / (4 * (C + 1))
[PROOF STEP]
using \<open>e > 0\<close> \<open>C \<ge> 0\<close> *
[PROOF STATE]
proof (prove)
using this:
0 < e
0 \<le> C
upper_asymptotic_density B = 0

goal (1 subgoal):
 1. upper_asymptotic_density B < e / (4 * (C + 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. real (card (B \<inter> {..<n})) < e / (4 * (C + 1)) * real n

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. real (card (B \<inter> {..<n})) < e / (4 * (C + 1)) * real n
[PROOF STEP]
obtain M where M: "\<And>n. n \<ge> M \<Longrightarrow> card(B \<inter> {..<n}) < (e/(4 * (C+1))) * n"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. real (card (B \<inter> {..<n})) < e / (4 * (C + 1)) * real n

goal (1 subgoal):
 1. (\<And>M. (\<And>n. M \<le> n \<Longrightarrow> real (card (B \<inter> {..<n})) < e / (4 * (C + 1)) * real n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. real (card (B \<inter> {..<n})) < e / (4 * (C + 1)) * real n

goal (1 subgoal):
 1. (\<And>M. (\<And>n. M \<le> n \<Longrightarrow> real (card (B \<inter> {..<n})) < e / (4 * (C + 1)) * real n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
M \<le> ?n \<Longrightarrow> real (card (B \<inter> {..<?n})) < e / (4 * (C + 1)) * real ?n

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
obtain P::nat where P: "P \<ge> 4 * N * C/e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. real (4 * N) * C / e \<le> real P \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using real_arch_simple
[PROOF STATE]
proof (prove)
using this:
\<exists>n. ?x \<le> of_nat n

goal (1 subgoal):
 1. (\<And>P. real (4 * N) * C / e \<le> real P \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (4 * N) * C / e \<le> real P

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
define Q where "Q = N + M + 1 + P"
[PROOF STATE]
proof (state)
this:
Q = N + M + 1 + P

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
have "(\<Sum>i<n. u i)/n < e" if "n \<ge> Q" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have n: "n \<ge> N" "n \<ge> M" "n \<ge> P" "n \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (N \<le> n &&& M \<le> n) &&& P \<le> n &&& 1 \<le> n
[PROOF STEP]
using \<open>n \<ge> Q\<close>
[PROOF STATE]
proof (prove)
using this:
Q \<le> n

goal (1 subgoal):
 1. (N \<le> n &&& M \<le> n) &&& P \<le> n &&& 1 \<le> n
[PROOF STEP]
unfolding Q_def
[PROOF STATE]
proof (prove)
using this:
N + M + 1 + P \<le> n

goal (1 subgoal):
 1. (N \<le> n &&& M \<le> n) &&& P \<le> n &&& 1 \<le> n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> n
M \<le> n
P \<le> n
1 \<le> n

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> n
M \<le> n
P \<le> n
1 \<le> n
[PROOF STEP]
have n2: "n \<ge> 4 * N * C/e"
[PROOF STATE]
proof (prove)
using this:
N \<le> n
M \<le> n
P \<le> n
1 \<le> n

goal (1 subgoal):
 1. real (4 * N) * C / e \<le> real n
[PROOF STEP]
using P
[PROOF STATE]
proof (prove)
using this:
N \<le> n
M \<le> n
P \<le> n
1 \<le> n
real (4 * N) * C / e \<le> real P

goal (1 subgoal):
 1. real (4 * N) * C / e \<le> real n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real (4 * N) * C / e \<le> real n

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "(\<Sum>i<n. u i) \<le> (\<Sum>i\<in>{..<N} \<union> ({N..<n} \<inter> A) \<union> ({N..<n} - A). u i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u {..<n} \<le> sum u ({..<N} \<union> {N..<n} \<inter> A \<union> ({N..<n} - A))
[PROOF STEP]
by (rule sum_mono2, auto simp add: assms)
[PROOF STATE]
proof (state)
this:
sum u {..<n} \<le> sum u ({..<N} \<union> {N..<n} \<inter> A \<union> ({N..<n} - A))

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum u {..<n} \<le> sum u ({..<N} \<union> {N..<n} \<inter> A \<union> ({N..<n} - A))

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... = (\<Sum>i\<in>{..<N}. u i) + (\<Sum>i\<in>{N..<n} \<inter> A. u i) + (\<Sum>i\<in>{N..<n} - A. u i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u ({..<N} \<union> {N..<n} \<inter> A \<union> ({N..<n} - A)) = sum u {..<N} + sum u ({N..<n} \<inter> A) + sum u ({N..<n} - A)
[PROOF STEP]
by (subst sum.union_disjoint, auto)+
[PROOF STATE]
proof (state)
this:
sum u ({..<N} \<union> {N..<n} \<inter> A \<union> ({N..<n} - A)) = sum u {..<N} + sum u ({N..<n} \<inter> A) + sum u ({N..<n} - A)

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum u ({..<N} \<union> {N..<n} \<inter> A \<union> ({N..<n} - A)) = sum u {..<N} + sum u ({N..<n} \<inter> A) + sum u ({N..<n} - A)

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... = (\<Sum>i\<in>{..<N}. u i) + (\<Sum>i\<in>{N..<n} \<inter> A. u i * indicator A i) + (\<Sum>i\<in>{N..<n} - A. u i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u {..<N} + sum u ({N..<n} \<inter> A) + sum u ({N..<n} - A) = sum u {..<N} + (\<Sum>i\<in>{N..<n} \<inter> A. u i * indicat_real A i) + sum u ({N..<n} - A)
[PROOF STEP]
unfolding indicator_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u {..<N} + sum u ({N..<n} \<inter> A) + sum u ({N..<n} - A) = sum u {..<N} + (\<Sum>i\<in>{N..<n} \<inter> A. u i * of_bool (i \<in> A)) + sum u ({N..<n} - A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum u {..<N} + sum u ({N..<n} \<inter> A) + sum u ({N..<n} - A) = sum u {..<N} + (\<Sum>i\<in>{N..<n} \<inter> A. u i * indicat_real A i) + sum u ({N..<n} - A)

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum u {..<N} + sum u ({N..<n} \<inter> A) + sum u ({N..<n} - A) = sum u {..<N} + (\<Sum>i\<in>{N..<n} \<inter> A. u i * indicat_real A i) + sum u ({N..<n} - A)

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... \<le> (\<Sum>i\<in>{..<N}. u i) + (\<Sum>i\<in>{N..<n}. u i * indicator A i) + (\<Sum>i\<in> B \<inter> {..<n}. u i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u {..<N} + (\<Sum>i\<in>{N..<n} \<inter> A. u i * indicat_real A i) + sum u ({N..<n} - A) \<le> sum u {..<N} + (\<Sum>i = N..<n. u i * indicat_real A i) + sum u (B \<inter> {..<n})
[PROOF STEP]
apply (intro add_mono sum_mono2)
[PROOF STATE]
proof (prove)
goal (9 subgoals):
 1. finite {..<N}
 2. {..<N} \<subseteq> {..<N}
 3. \<And>b. b \<in> {..<N} - {..<N} \<Longrightarrow> 0 \<le> u b
 4. finite {N..<n}
 5. {N..<n} \<inter> A \<subseteq> {N..<n}
 6. \<And>b. b \<in> {N..<n} - {N..<n} \<inter> A \<Longrightarrow> 0 \<le> u b * indicat_real A b
 7. finite (B \<inter> {..<n})
 8. {N..<n} - A \<subseteq> B \<inter> {..<n}
 9. \<And>b. b \<in> B \<inter> {..<n} - ({N..<n} - A) \<Longrightarrow> 0 \<le> u b
[PROOF STEP]
unfolding B_def
[PROOF STATE]
proof (prove)
goal (9 subgoals):
 1. finite {..<N}
 2. {..<N} \<subseteq> {..<N}
 3. \<And>b. b \<in> {..<N} - {..<N} \<Longrightarrow> 0 \<le> u b
 4. finite {N..<n}
 5. {N..<n} \<inter> A \<subseteq> {N..<n}
 6. \<And>b. b \<in> {N..<n} - {N..<n} \<inter> A \<Longrightarrow> 0 \<le> u b * indicat_real A b
 7. finite ((UNIV - A) \<inter> {..<n})
 8. {N..<n} - A \<subseteq> (UNIV - A) \<inter> {..<n}
 9. \<And>b. b \<in> (UNIV - A) \<inter> {..<n} - ({N..<n} - A) \<Longrightarrow> 0 \<le> u b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 \<le> u ?n
u ?n \<le> C
lower_asymptotic_density A = 1
(\<lambda>n. u n * indicat_real A n) \<longlonglongrightarrow> 0

goal (9 subgoals):
 1. finite {..<N}
 2. {..<N} \<subseteq> {..<N}
 3. \<And>b. b \<in> {..<N} - {..<N} \<Longrightarrow> 0 \<le> u b
 4. finite {N..<n}
 5. {N..<n} \<inter> A \<subseteq> {N..<n}
 6. \<And>b. b \<in> {N..<n} - {N..<n} \<inter> A \<Longrightarrow> 0 \<le> u b * indicat_real A b
 7. finite ((UNIV - A) \<inter> {..<n})
 8. {N..<n} - A \<subseteq> (UNIV - A) \<inter> {..<n}
 9. \<And>b. b \<in> (UNIV - A) \<inter> {..<n} - ({N..<n} - A) \<Longrightarrow> 0 \<le> u b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum u {..<N} + (\<Sum>i\<in>{N..<n} \<inter> A. u i * indicat_real A i) + sum u ({N..<n} - A) \<le> sum u {..<N} + (\<Sum>i = N..<n. u i * indicat_real A i) + sum u (B \<inter> {..<n})

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum u {..<N} + (\<Sum>i\<in>{N..<n} \<inter> A. u i * indicat_real A i) + sum u ({N..<n} - A) \<le> sum u {..<N} + (\<Sum>i = N..<n. u i * indicat_real A i) + sum u (B \<inter> {..<n})

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... \<le> (\<Sum>i\<in>{..<N}. C) + (\<Sum>i\<in>{N..<n}. e/4) + (\<Sum>i\<in>B \<inter> {..<n}. C)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum u {..<N} + (\<Sum>i = N..<n. u i * indicat_real A i) + sum u (B \<inter> {..<n}) \<le> (\<Sum>i<N. C) + (\<Sum>i = N..<n. e / 4) + (\<Sum>i\<in>B \<inter> {..<n}. C)
[PROOF STEP]
apply (intro add_mono sum_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>i. i \<in> {..<N} \<Longrightarrow> u i \<le> C
 2. \<And>i. i \<in> {N..<n} \<Longrightarrow> u i * indicat_real A i \<le> e / 4
 3. \<And>i. i \<in> B \<inter> {..<n} \<Longrightarrow> u i \<le> C
[PROOF STEP]
using assms less_imp_le[OF N]
[PROOF STATE]
proof (prove)
using this:
0 \<le> u ?n
u ?n \<le> C
lower_asymptotic_density A = 1
(\<lambda>n. u n * indicat_real A n) \<longlonglongrightarrow> 0
N \<le> ?k1 \<Longrightarrow> u ?k1 * indicat_real A ?k1 \<le> e / 4

goal (3 subgoals):
 1. \<And>i. i \<in> {..<N} \<Longrightarrow> u i \<le> C
 2. \<And>i. i \<in> {N..<n} \<Longrightarrow> u i * indicat_real A i \<le> e / 4
 3. \<And>i. i \<in> B \<inter> {..<n} \<Longrightarrow> u i \<le> C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
sum u {..<N} + (\<Sum>i = N..<n. u i * indicat_real A i) + sum u (B \<inter> {..<n}) \<le> (\<Sum>i<N. C) + (\<Sum>i = N..<n. e / 4) + (\<Sum>i\<in>B \<inter> {..<n}. C)

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum u {..<N} + (\<Sum>i = N..<n. u i * indicat_real A i) + sum u (B \<inter> {..<n}) \<le> (\<Sum>i<N. C) + (\<Sum>i = N..<n. e / 4) + (\<Sum>i\<in>B \<inter> {..<n}. C)

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... = N * C + (n-N) * e/4 + card(B \<inter> {..<n}) * C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i<N. C) + (\<Sum>i = N..<n. e / 4) + (\<Sum>i\<in>B \<inter> {..<n}. C) = real N * C + real (n - N) * e / 4 + real (card (B \<inter> {..<n})) * C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i<N. C) + (\<Sum>i = N..<n. e / 4) + (\<Sum>i\<in>B \<inter> {..<n}. C) = real N * C + real (n - N) * e / 4 + real (card (B \<inter> {..<n})) * C

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i<N. C) + (\<Sum>i = N..<n. e / 4) + (\<Sum>i\<in>B \<inter> {..<n}. C) = real N * C + real (n - N) * e / 4 + real (card (B \<inter> {..<n})) * C

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... \<le> n * e/4 + n * e/4 + (e/(4 * (C+1))) * n * C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real N * C + real (n - N) * e / 4 + real (card (B \<inter> {..<n})) * C \<le> real n * e / 4 + real n * e / 4 + e / (4 * (C + 1)) * real n * C
[PROOF STEP]
apply (intro add_mono)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. real N * C \<le> real n * e / 4
 2. real (n - N) * e / 4 \<le> real n * e / 4
 3. real (card (B \<inter> {..<n})) * C \<le> e / (4 * (C + 1)) * real n * C
[PROOF STEP]
using n2 \<open>e > 0\<close> mult_right_mono[OF less_imp_le[OF M[OF \<open>n \<ge> M\<close>]] \<open>C \<ge> 0\<close>]
[PROOF STATE]
proof (prove)
using this:
real (4 * N) * C / e \<le> real n
0 < e
real (card (B \<inter> {..<n})) * C \<le> e / (4 * (C + 1)) * real n * C

goal (3 subgoals):
 1. real N * C \<le> real n * e / 4
 2. real (n - N) * e / 4 \<le> real n * e / 4
 3. real (card (B \<inter> {..<n})) * C \<le> e / (4 * (C + 1)) * real n * C
[PROOF STEP]
by (auto simp add: divide_simps)
[PROOF STATE]
proof (state)
this:
real N * C + real (n - N) * e / 4 + real (card (B \<inter> {..<n})) * C \<le> real n * e / 4 + real n * e / 4 + e / (4 * (C + 1)) * real n * C

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real N * C + real (n - N) * e / 4 + real (card (B \<inter> {..<n})) * C \<le> real n * e / 4 + real n * e / 4 + e / (4 * (C + 1)) * real n * C

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... \<le> n * e * 3/4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * e / 4 + real n * e / 4 + e / (4 * (C + 1)) * real n * C \<le> real n * e * 3 / 4
[PROOF STEP]
using \<open>C \<ge> 0\<close> \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> C
0 < e

goal (1 subgoal):
 1. real n * e / 4 + real n * e / 4 + e / (4 * (C + 1)) * real n * C \<le> real n * e * 3 / 4
[PROOF STEP]
by (simp add: divide_simps algebra_simps)
[PROOF STATE]
proof (state)
this:
real n * e / 4 + real n * e / 4 + e / (4 * (C + 1)) * real n * C \<le> real n * e * 3 / 4

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real n * e / 4 + real n * e / 4 + e / (4 * (C + 1)) * real n * C \<le> real n * e * 3 / 4

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
have "... < n * e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real n * e * 3 / 4 < real n * e
[PROOF STEP]
using \<open>n \<ge> 1\<close> \<open>e > 0\<close>
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
0 < e

goal (1 subgoal):
 1. real n * e * 3 / 4 < real n * e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
real n * e * 3 / 4 < real n * e

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum u {..<n} < real n * e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum u {..<n} < real n * e

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
using \<open>n \<ge> 1\<close>
[PROOF STATE]
proof (prove)
using this:
sum u {..<n} < real n * e
1 \<le> n

goal (1 subgoal):
 1. sum u {..<n} / real n < e
[PROOF STEP]
by (simp add: divide_simps algebra_simps)
[PROOF STATE]
proof (state)
this:
sum u {..<n} / real n < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Q \<le> ?n \<Longrightarrow> sum u {..<?n} / real ?n < e

goal (1 subgoal):
 1. \<And>a. 0 < a \<Longrightarrow> \<forall>\<^sub>F x in sequentially. sum u {..<x} / real x < a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Q \<le> ?n \<Longrightarrow> sum u {..<?n} / real ?n < e
[PROOF STEP]
show "eventually (\<lambda>n. (\<Sum>i<n. u i)/n < e) sequentially"
[PROOF STATE]
proof (prove)
using this:
Q \<le> ?n \<Longrightarrow> sum u {..<?n} / real ?n < e

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. sum u {..<n} / real n < e
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
Q \<le> ?n \<Longrightarrow> sum u {..<?n} / real ?n < e

goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. sum u {..<n} / real n < e
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. sum u {..<n} / real n < e

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_real_derivative_imp_continuous_on:
  assumes "\<And>x. x \<in> A \<Longrightarrow> (f has_real_derivative f' x) (at x)"
  shows "continuous_on A f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on A f
[PROOF STEP]
apply (intro differentiable_imp_continuous_on, unfold differentiable_on_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>A. f differentiable at x within A
[PROOF STEP]
using assms differentiable_at_withinI real_differentiable_def
[PROOF STATE]
proof (prove)
using this:
?x \<in> A \<Longrightarrow> (f has_real_derivative f' ?x) (at ?x)
?f differentiable at ?x \<Longrightarrow> ?f differentiable at ?x within ?s
(?f differentiable at ?x within ?s) = (\<exists>D. (?f has_real_derivative D) (at ?x within ?s))

goal (1 subgoal):
 1. \<forall>x\<in>A. f differentiable at x within A
[PROOF STEP]
by blast


[STATEMENT]
lemma Con_append:
    assumes "T \<noteq> []" and "U \<noteq> []" and "V \<noteq> []"
    shows "T @ U \<^sup>*\<frown>\<^sup>* V \<longleftrightarrow> T \<^sup>*\<frown>\<^sup>* V \<and> U \<^sup>*\<frown>\<^sup>* V \<^sup>*\\\<^sup>* T"
    and "T \<^sup>*\<frown>\<^sup>* U @ V \<longleftrightarrow> T \<^sup>*\<frown>\<^sup>* U \<and> T \<^sup>*\\\<^sup>* U \<^sup>*\<frown>\<^sup>* V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((T @ U) \<^sup>*\\<^sup>* V \<noteq> []) = (T \<^sup>*\\<^sup>* V \<noteq> [] \<and> U \<^sup>*\\<^sup>* (V \<^sup>*\\<^sup>* T) \<noteq> []) &&& (T \<^sup>*\\<^sup>* (U @ V) \<noteq> []) = (T \<^sup>*\\<^sup>* U \<noteq> [] \<and> (T \<^sup>*\\<^sup>* U) \<^sup>*\\<^sup>* V \<noteq> [])
[PROOF STEP]
using assms Resid_append_ind
[PROOF STATE]
proof (prove)
using this:
T \<noteq> []
U \<noteq> []
V \<noteq> []
\<lbrakk>?T \<noteq> []; ?U \<noteq> []; ?V \<noteq> []\<rbrakk> \<Longrightarrow> ((?V @ ?T) \<^sup>*\\<^sup>* ?U \<noteq> []) = (?V \<^sup>*\\<^sup>* ?U \<noteq> [] \<and> ?T \<^sup>*\\<^sup>* (?U \<^sup>*\\<^sup>* ?V) \<noteq> []) \<and> (?T \<^sup>*\\<^sup>* (?V @ ?U) \<noteq> []) = (?T \<^sup>*\\<^sup>* ?V \<noteq> [] \<and> (?T \<^sup>*\\<^sup>* ?V) \<^sup>*\\<^sup>* ?U \<noteq> []) \<and> ((?V @ ?T) \<^sup>*\\<^sup>* ?U \<noteq> [] \<longrightarrow> (?V @ ?T) \<^sup>*\\<^sup>* ?U = ?V \<^sup>*\\<^sup>* ?U @ ?T \<^sup>*\\<^sup>* (?U \<^sup>*\\<^sup>* ?V)) \<and> (?T \<^sup>*\\<^sup>* (?V @ ?U) \<noteq> [] \<longrightarrow> ?T \<^sup>*\\<^sup>* (?V @ ?U) = (?T \<^sup>*\\<^sup>* ?V) \<^sup>*\\<^sup>* ?U)

goal (1 subgoal):
 1. ((T @ U) \<^sup>*\\<^sup>* V \<noteq> []) = (T \<^sup>*\\<^sup>* V \<noteq> [] \<and> U \<^sup>*\\<^sup>* (V \<^sup>*\\<^sup>* T) \<noteq> []) &&& (T \<^sup>*\\<^sup>* (U @ V) \<noteq> []) = (T \<^sup>*\\<^sup>* U \<noteq> [] \<and> (T \<^sup>*\\<^sup>* U) \<^sup>*\\<^sup>* V \<noteq> [])
[PROOF STEP]
by blast+


[STATEMENT]
lemma less_Node_dag: "(Node l a r) < x \<Longrightarrow> l < x \<and> r < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Node l a r < x \<Longrightarrow> l < x \<and> r < x
[PROOF STEP]
by (auto simp add: less_dag_def dest: subdag_NodeD)


[STATEMENT]
lemma eq_on_xfer_pointwise: "\<lbrakk>a=a' on r'; r\<subseteq>r'\<rbrakk> \<Longrightarrow> (\<forall>i\<in>r. P (a i)) \<longleftrightarrow> (\<forall>i\<in>r. P (a' i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a = a' on r'; r \<subseteq> r'\<rbrakk> \<Longrightarrow> (\<forall>i\<in>r. P (a i)) = (\<forall>i\<in>r. P (a' i))
[PROOF STEP]
by (auto simp: eq_on_def subset_iff)


[STATEMENT]
lemma independent_substdbasis: "d \<subseteq> Basis \<Longrightarrow> independent d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<subseteq> Basis \<Longrightarrow> independent d
[PROOF STEP]
by (rule independent_mono[OF independent_Basis])


[STATEMENT]
lemma mbhd_insert_correct: "set (mbhd_insert x l) = insert x (set l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (mbhd_insert x l) = insert x (set l)
[PROOF STEP]
unfolding mbhd_insert_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (if l = [] then [x] else if x = hd l then l else x # l) = insert x (set l)
[PROOF STEP]
by auto


[STATEMENT]
lemma lift_is_subst_ml: "lift k v = subst_ml (\<lambda>n. if n<k then n else n+1) v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lift k v = subst_ml (\<lambda>n. if n < k then n else n + 1) v
[PROOF STEP]
by(induct k v rule:lift_ml.induct)(simp_all add:list_eq_iff_nth_eq)


[STATEMENT]
lemma splay_map_of_inorder:
  "splay x t = Node l a r \<Longrightarrow> sorted1(inorder t) \<Longrightarrow>
   map_of (inorder t) x = (if x = fst a then Some(snd a) else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Splay_Map.splay x t = \<langle>l, a, r\<rangle>; sorted1 (inorder t)\<rbrakk> \<Longrightarrow> AList_Upd_Del.map_of (inorder t) x = (if x = fst a then Some (snd a) else None)
[PROOF STEP]
by(induction x t arbitrary: l a r rule: splay.induct)
  (auto simp: map_of_simps splay_Leaf_iff split: tree.splits)


[STATEMENT]
lemma fps_shift_subdegree_zero_iff [simp]:
  "fps_shift (subdegree f) f = 0 \<longleftrightarrow> f = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fps_shift (subdegree f) f = 0) = (f = 0)
[PROOF STEP]
by (subst (1) nth_subdegree_zero_iff[symmetric], cases "f = 0")
     (simp_all del: nth_subdegree_zero_iff)


[STATEMENT]
lemma iterates_mono:
  assumes f: "f \<in> ccpo.iterates (fun_lub Sup) (fun_ord (\<le>)) F"
  and mono: "\<And>f. monotone (\<sqsubseteq>) (\<le>) f \<Longrightarrow> monotone (\<sqsubseteq>) (\<le>) (F f)"
  shows "monotone (\<sqsubseteq>) (\<le>) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone (\<sqsubseteq>) (\<le>) f
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
f \<in> ccpo.iterates (fun_lub Sup) (fun_ord (\<le>)) F

goal (1 subgoal):
 1. monotone (\<sqsubseteq>) (\<le>) f
[PROOF STEP]
by(induction rule: ccpo.iterates.induct[OF ccpo_fun, consumes 1, case_names step Sup])(blast intro: mono mono_lub)+


[STATEMENT]
lemma signed_drop_bit_word_numeral [simp]:
  \<open>signed_drop_bit (numeral n) (numeral k) =
    (word_of_int (drop_bit (numeral n) (signed_take_bit (LENGTH('a) - 1) (numeral k))) :: 'a::len word)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. signed_drop_bit (numeral n) (numeral k) = word_of_int (drop_bit (numeral n) (signed_take_bit (LENGTH('a) - 1) (numeral k)))
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma esssup_zero_space:
  "emeasure M (space M) = 0 \<Longrightarrow> f \<in> borel_measurable M \<Longrightarrow> esssup M f = (- \<infinity>::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>emeasure M (space M) = 0; f \<in> borel_measurable M\<rbrakk> \<Longrightarrow> esssup M f = - \<infinity>
[PROOF STEP]
by (simp add: esssup_def ae_filter_eq_bot_iff[symmetric] bot_ereal_def)


[STATEMENT]
lemma disj_matrices_commute: "disj_matrices A B = disj_matrices B A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. disj_matrices A B = disj_matrices B A
[PROOF STEP]
by (auto simp add: disj_matrices_def)


[STATEMENT]
lemma precedes_in_tail:
  assumes "x \<noteq> z"
  shows "x \<preceq> y in (z # zs) \<longleftrightarrow> x \<preceq> y in zs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<preceq> y in (z # zs)) = (x \<preceq> y in zs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<noteq> z

goal (1 subgoal):
 1. (x \<preceq> y in (z # zs)) = (x \<preceq> y in zs)
[PROOF STEP]
unfolding precedes_def
[PROOF STATE]
proof (prove)
using this:
x \<noteq> z

goal (1 subgoal):
 1. (\<exists>l r. z # zs = l @ x # r \<and> y \<in> set (x # r)) = (\<exists>l r. zs = l @ x # r \<and> y \<in> set (x # r))
[PROOF STEP]
by (auto simp: Cons_eq_append_conv)


[STATEMENT]
lemma in_sstart[simp]: "s \<in> sstart S (x # xs) \<longleftrightarrow> shd s = x \<and> stl s \<in> sstart S xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s \<in> sstart S (x # xs)) = (shd s = x \<and> stl s \<in> sstart S xs)
[PROOF STEP]
by (cases s) (auto simp: sstart.simps(2))


[STATEMENT]
lemma nat_0_1_induct [case_names 0 1 step]:
  assumes "P 0" "P 1" "\<And>n. n \<ge> 1 \<Longrightarrow> P n \<Longrightarrow> P (Suc n)"
  shows   "P n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n
[PROOF STEP]
proof (induction n rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> P y) \<Longrightarrow> P x
[PROOF STEP]
case (less n)
[PROOF STATE]
proof (state)
this:
?y < n \<Longrightarrow> P ?y

goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> P y) \<Longrightarrow> P x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n
[PROOF STEP]
using assms(3)[OF _ less.IH[of "n - 1"]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<le> n - 1; n - 1 < n\<rbrakk> \<Longrightarrow> P (Suc (n - 1))

goal (1 subgoal):
 1. P n
[PROOF STEP]
by (cases "n \<le> 1")
      (insert assms(1-2),auto simp: eval_nat_numeral le_Suc_eq)
[PROOF STATE]
proof (state)
this:
P n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_x_ge_neg_x:
  fixes x :: real
  assumes x: "x \<ge> 0"
  shows "sin x \<ge> - x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x \<le> sin x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - x \<le> sin x
[PROOF STEP]
let ?f = "\<lambda>x. x + sin x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - x \<le> sin x
[PROOF STEP]
have \<section>: "\<And>u. \<lbrakk>0 \<le> u; u \<le> x\<rbrakk> \<Longrightarrow> \<exists>y. (?f has_real_derivative 1 + cos u) (at u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>u. \<lbrakk>0 \<le> u; u \<le> x\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. x + sin x) has_real_derivative 1 + cos u) (at u)
[PROOF STEP]
by (auto intro!: derivative_eq_intros simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>0 \<le> ?u1; ?u1 \<le> x\<rbrakk> \<Longrightarrow> \<exists>y. ((\<lambda>x. x + sin x) has_real_derivative 1 + cos ?u1) (at ?u1)

goal (1 subgoal):
 1. - x \<le> sin x
[PROOF STEP]
have "?f x \<ge> ?f 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 + sin 0 \<le> x + sin x
[PROOF STEP]
by (rule DERIV_nonneg_imp_nondecreasing [OF assms]) (use \<section> real_0_le_add_iff in force)
[PROOF STATE]
proof (state)
this:
0 + sin 0 \<le> x + sin x

goal (1 subgoal):
 1. - x \<le> sin x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 + sin 0 \<le> x + sin x
[PROOF STEP]
show "sin x \<ge> -x"
[PROOF STATE]
proof (prove)
using this:
0 + sin 0 \<le> x + sin x

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lconjseq_snoc: "lconjseq (xs@[x]) = lconjseq xs @ [lconjby (sum_list xs) x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lconjseq (xs @ [x]) = lconjseq xs @ [lconjby (sum_list xs) x]
[PROOF STEP]
by (induct xs) (auto simp add: lconjby_add)


[STATEMENT]
lemma rbl_word_and: "rev (to_bl (x AND y)) = map2 (\<and>) (rev (to_bl x)) (rev (to_bl y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev (to_bl (x AND y)) = map2 (\<and>) (rev (to_bl x)) (rev (to_bl y))
[PROOF STEP]
by (simp add: zip_rev bl_word_and rev_map)


[STATEMENT]
lemma mult_if_then:"((v = (if P then 1 else 0))
                    \<and> (w = (if Q then 1 else 0)))
                       \<Longrightarrow> (rat_poly_times v w = (if (P\<and>Q) then 1 else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = (if P then 1 else 0) \<and> w = (if Q then 1 else 0) \<Longrightarrow> rat_poly_times v w = (if P \<and> Q then 1 else 0)
[PROOF STEP]
by auto


[STATEMENT]
lemma map_cond_spmf_fst: "map_spmf f (cond_spmf_fst p x) = cond_spmf_fst (map_spmf (apsnd f) p) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_spmf f (cond_spmf_fst p x) = cond_spmf_fst (map_spmf (apsnd f) p) x
[PROOF STEP]
by(auto simp add: cond_spmf_fst_def spmf.map_comp intro!: map_spmf_cong arg_cong2[where f="cond_spmf"])


[STATEMENT]
lemma swap_swaps:
  "arr' = swap arr x y \<Longrightarrow> arr' y = arr x \<and> arr' x = arr y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr' = swap arr x y \<Longrightarrow> arr' y = arr x \<and> arr' x = arr y
[PROOF STEP]
unfolding swap_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr' = arr(x := arr y, y := arr x) \<Longrightarrow> arr' y = arr x \<and> arr' x = arr y
[PROOF STEP]
by simp


[STATEMENT]
lemma irreducible_primitive_part:
  assumes "irreducible p" and "degree p > 0"
  shows "primitive_part p = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_part p = p
[PROOF STEP]
using irreducible_content[OF assms(1), unfolded primitive_iff_content_eq_1] assms(2)
[PROOF STATE]
proof (prove)
using this:
degree p = 0 \<or> content p = (1::'a)
0 < degree p

goal (1 subgoal):
 1. primitive_part p = p
[PROOF STEP]
by (auto simp: primitive_part_def abs_poly_def)


[STATEMENT]
lemma n_bool_lists_True_count: "xs \<in> set (n_bool_lists n x) \<Longrightarrow> count_list xs True = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> set (n_bool_lists n x) \<Longrightarrow> count_list xs True = n
[PROOF STEP]
by (induct x arbitrary: xs n) (auto split: if_splits simp: count_list_replicate)


[STATEMENT]
lemma quorum_union:"quorum Q \<Longrightarrow> quorum Q' \<Longrightarrow> quorum (Q \<union> Q')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>quorum Q; quorum Q'\<rbrakk> \<Longrightarrow> quorum (Q \<union> Q')
[PROOF STEP]
unfolding quorum_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>p\<in>Q \<inter> W. \<exists>Sl\<in>slices p. Sl \<subseteq> Q; \<forall>p\<in>Q' \<inter> W. \<exists>Sl\<in>slices p. Sl \<subseteq> Q'\<rbrakk> \<Longrightarrow> \<forall>p\<in>(Q \<union> Q') \<inter> W. \<exists>Sl\<in>slices p. Sl \<subseteq> Q \<union> Q'
[PROOF STEP]
by (metis IntE Int_iff UnE inf_sup_aci(1) sup.coboundedI1 sup.coboundedI2)


[STATEMENT]
lemma orthogonal_rvsum:
    "\<lbrakk>finite s; \<And>y. y \<in> s \<Longrightarrow> orthogonal x (f y)\<rbrakk> \<Longrightarrow> orthogonal x (sum f s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite s; \<And>y. y \<in> s \<Longrightarrow> orthogonal x (f y)\<rbrakk> \<Longrightarrow> orthogonal x (sum f s)
[PROOF STEP]
by (induction s rule: finite_induct) (auto simp: orthogonal_clauses)


[STATEMENT]
lemma after_summary_Sum_fun: "finite MM \<Longrightarrow> after_summary (\<Sum>M\<in>MM. f M) A = (\<Sum>M\<in>MM. after_summary (f M) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite MM \<Longrightarrow> after_summary (sum f MM) A = (\<Sum>M\<in>MM. after_summary (f M) A)
[PROOF STEP]
by (induct MM rule: finite_induct) (auto simp: after_summary_union)


[STATEMENT]
lemma gcd_mult_unit2: "is_unit a \<Longrightarrow> gcd b (c * a) = gcd b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_unit a \<Longrightarrow> gcd b (c * a) = gcd b c
[PROOF STEP]
using gcd.commute gcd_mult_unit1
[PROOF STATE]
proof (prove)
using this:
gcd ?a ?b = gcd ?b ?a
is_unit ?a \<Longrightarrow> gcd (?b * ?a) ?c = gcd ?b ?c

goal (1 subgoal):
 1. is_unit a \<Longrightarrow> gcd b (c * a) = gcd b c
[PROOF STEP]
by auto


[STATEMENT]
lemma quat_norm_imaginary: "Re x = 0 \<Longrightarrow> x\<^sup>2 = - (quat_of_real (norm x))\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quat.Re x = 0 \<Longrightarrow> x\<^sup>2 = - (quat_of_real (norm x))\<^sup>2
[PROOF STEP]
unfolding quat_norm_pow_2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quat.Re x = 0 \<Longrightarrow> x\<^sup>2 = - (x * Quaternions.cnj x)
[PROOF STEP]
by (cases x) (auto simp: power2_eq_square cnj.ctr times_quat.ctr uminus_quat.ctr)


[STATEMENT]
lemma poly_deg_zero [simp]: "poly_deg 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg 0 = (0::'a)
[PROOF STEP]
by (simp only: single_zero[of 0, symmetric] poly_deg_monomial_zero)


[STATEMENT]
lemma image_mset_single: "image_mset f {#x#} = {#f x#}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f {#x#} = {#f x#}
[PROOF STEP]
by (simp add: comp_fun_commute.fold_mset_add_mset comp_fun_commute_mset_image image_mset_def)


[STATEMENT]
lemma filterlim_of_int_at_top:
  "filterlim f F at_top \<Longrightarrow> filterlim (\<lambda>x. f (of_int x :: real)) F at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filterlim f F at_top \<Longrightarrow> LIM x at_top. f (real_of_int x) :> F
[PROOF STEP]
by (erule filterlim_compose[OF _ filterlim_real_of_int_at_top])


[STATEMENT]
lemma iMOD_induct: "
  \<lbrakk> P r; \<And>k. \<lbrakk> k \<in> [r, mod m]; P k \<rbrakk> \<Longrightarrow> P (k + m); a \<in> [r, mod m] \<rbrakk> \<Longrightarrow> P a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P r; \<And>k. \<lbrakk>k \<in> [ r, mod m ]; P k\<rbrakk> \<Longrightarrow> P (k + m); a \<in> [ r, mod m ]\<rbrakk> \<Longrightarrow> P a
[PROOF STEP]
apply (rule inext_induct[of _ "[r, mod m]"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>P r; \<And>k. \<lbrakk>k \<in> [ r, mod m ]; P k\<rbrakk> \<Longrightarrow> P (k + m); a \<in> [ r, mod m ]\<rbrakk> \<Longrightarrow> P (iMin [ r, mod m ])
 2. \<And>n. \<lbrakk>P r; \<And>k. \<lbrakk>k \<in> [ r, mod m ]; P k\<rbrakk> \<Longrightarrow> P (k + m); a \<in> [ r, mod m ]; n \<in> [ r, mod m ]; P n\<rbrakk> \<Longrightarrow> P (inext n [ r, mod m ])
 3. \<lbrakk>P r; \<And>k. \<lbrakk>k \<in> [ r, mod m ]; P k\<rbrakk> \<Longrightarrow> P (k + m); a \<in> [ r, mod m ]\<rbrakk> \<Longrightarrow> a \<in> [ r, mod m ]
[PROOF STEP]
apply (simp add: iT_Min iT_inext_if)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma irreducible_dvd_prod_list: fixes p :: "'a poly"
  assumes irr: "irreducible p"
  and dvd: "p dvd prod_list as"
  shows "\<exists> a \<in> set as. p dvd a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a\<in>set as. p dvd a
[PROOF STEP]
by (insert dvd, induct as, insert irr, auto)


[STATEMENT]
lemma bigo_bounded: "\<forall>x. 0 \<le> f x \<Longrightarrow> \<forall>x. f x \<le> g x \<Longrightarrow> f \<in> O(g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. (0::'b) \<le> f x; \<forall>x. f x \<le> g x\<rbrakk> \<Longrightarrow> f \<in> O(g)
[PROOF STEP]
apply (erule bigo_bounded_alt [of f 1 g])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. f x \<le> g x \<Longrightarrow> \<forall>x. f x \<le> (1::'b) * g x
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma finite_carrier_rpr_iff_u:
  assumes "finite carrier"
    and "(relation::'a relation) \<subseteq> carrier \<times> carrier"
  shows "rational_preference carrier relation \<longleftrightarrow> (\<exists>u. ordinal_utility carrier relation u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rational_preference carrier relation = (\<exists>u. ordinal_utility carrier relation u)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rational_preference carrier relation \<Longrightarrow> \<exists>u. ordinal_utility carrier relation u
 2. \<exists>u. ordinal_utility carrier relation u \<Longrightarrow> rational_preference carrier relation
[PROOF STEP]
assume "rational_preference carrier relation"
[PROOF STATE]
proof (state)
this:
rational_preference carrier relation

goal (2 subgoals):
 1. rational_preference carrier relation \<Longrightarrow> \<exists>u. ordinal_utility carrier relation u
 2. \<exists>u. ordinal_utility carrier relation u \<Longrightarrow> rational_preference carrier relation
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rational_preference carrier relation
[PROOF STEP]
show "\<exists>u. ordinal_utility carrier relation u"
[PROOF STATE]
proof (prove)
using this:
rational_preference carrier relation

goal (1 subgoal):
 1. \<exists>u. ordinal_utility carrier relation u
[PROOF STEP]
by (simp add: assms(1) fnt_carrier_exists_util_fun)
[PROOF STATE]
proof (state)
this:
\<exists>u. ordinal_utility carrier relation u

goal (1 subgoal):
 1. \<exists>u. ordinal_utility carrier relation u \<Longrightarrow> rational_preference carrier relation
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>u. ordinal_utility carrier relation u \<Longrightarrow> rational_preference carrier relation
[PROOF STEP]
assume "\<exists>u. ordinal_utility carrier relation u"
[PROOF STATE]
proof (state)
this:
\<exists>u. ordinal_utility carrier relation u

goal (1 subgoal):
 1. \<exists>u. ordinal_utility carrier relation u \<Longrightarrow> rational_preference carrier relation
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>u. ordinal_utility carrier relation u
[PROOF STEP]
show "rational_preference carrier relation"
[PROOF STATE]
proof (prove)
using this:
\<exists>u. ordinal_utility carrier relation u

goal (1 subgoal):
 1. rational_preference carrier relation
[PROOF STEP]
by (metis (full_types) order_on_defs(1) ordinal_utility.util_imp_refl
        ordinal_utility.util_imp_total ordinal_utility.util_imp_trans ordinal_utility_def
        preference.intro rational_preference_axioms_def rational_preference_def)
[PROOF STATE]
proof (state)
this:
rational_preference carrier relation

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in field) subgroup_mult_of :
  assumes "subfield K R"
  shows "subgroup (K - {\<zero>}) (mult_of R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (K - {\<zero>}) (mult_of R)
[PROOF STEP]
proof (intro group.group_incl_imp_subgroup[OF field_mult_group])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. K - {\<zero>} \<subseteq> carrier (mult_of R)
 2. Group.group (mult_of R\<lparr>carrier := K - {\<zero>}\<rparr>)
[PROOF STEP]
show "K - {\<zero>} \<subseteq> carrier (mult_of R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. K - {\<zero>} \<subseteq> carrier (mult_of R)
[PROOF STEP]
by (simp add: Diff_mono assms carrier_mult_of subfieldE(3))
[PROOF STATE]
proof (state)
this:
K - {\<zero>} \<subseteq> carrier (mult_of R)

goal (1 subgoal):
 1. Group.group (mult_of R\<lparr>carrier := K - {\<zero>}\<rparr>)
[PROOF STEP]
show "group ((mult_of R) \<lparr> carrier := K - {\<zero>} \<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (mult_of R\<lparr>carrier := K - {\<zero>}\<rparr>)
[PROOF STEP]
using field.field_mult_group[OF subfield_iff(2)[OF assms]]
[PROOF STATE]
proof (prove)
using this:
Group.group (mult_of (R\<lparr>carrier := K\<rparr>))

goal (1 subgoal):
 1. Group.group (mult_of R\<lparr>carrier := K - {\<zero>}\<rparr>)
[PROOF STEP]
unfolding mult_of_def
[PROOF STATE]
proof (prove)
using this:
Group.group \<lparr>carrier = carrier (R\<lparr>carrier := K\<rparr>) - {\<zero>\<^bsub>R\<lparr>carrier := K\<rparr>\<^esub>}, mult = (\<otimes>\<^bsub>R\<lparr>carrier := K\<rparr>\<^esub>), one = \<one>\<^bsub>R\<lparr>carrier := K\<rparr>\<^esub>\<rparr>

goal (1 subgoal):
 1. Group.group (\<lparr>carrier = carrier R - {\<zero>}, mult = (\<otimes>), one = \<one>\<rparr>\<lparr>carrier := K - {\<zero>}\<rparr>)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Group.group (mult_of R\<lparr>carrier := K - {\<zero>}\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_imp_quotient_map:
   "\<lbrakk>continuous_map X Y f; compact_space X; Hausdorff_space Y; f ` (topspace X) = topspace Y\<rbrakk>
        \<Longrightarrow> quotient_map X Y f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>continuous_map X Y f; compact_space X; Hausdorff_space Y; f ` topspace X = topspace Y\<rbrakk> \<Longrightarrow> quotient_map X Y f
[PROOF STEP]
by (simp add: continuous_imp_closed_map continuous_closed_imp_quotient_map)


[STATEMENT]
lemma bits_ident:
  "push_bit n (drop_bit n a) + take_bit n a = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. push_bit n (drop_bit n a) + take_bit n a = a
[PROOF STEP]
using div_mult_mod_eq
[PROOF STATE]
proof (prove)
using this:
?a div ?b * ?b + ?a mod ?b = ?a

goal (1 subgoal):
 1. push_bit n (drop_bit n a) + take_bit n a = a
[PROOF STEP]
by (simp add: push_bit_eq_mult take_bit_eq_mod drop_bit_eq_div)


[STATEMENT]
lemma fps_exp_neq_0 [simp]: "\<not>fps_exp (c :: 'a :: field_char_0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_exp c \<noteq> 0
[PROOF STEP]
unfolding fps_const_0_eq_0 [symmetric] fps_exp_eq_fps_const_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (c = (0::'a) \<and> (0::'a) = (1::'a))
[PROOF STEP]
by simp


[STATEMENT]
lemma topology_bases_eq_aux:
   "\<lbrakk>(arbitrary union_of P) S;
     \<And>U x. \<lbrakk>P U; x \<in> U\<rbrakk> \<Longrightarrow> \<exists>V. Q V \<and> x \<in> V \<and> V \<subseteq> U\<rbrakk>
        \<Longrightarrow> (arbitrary union_of Q) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(arbitrary union_of P) S; \<And>U x. \<lbrakk>P U; x \<in> U\<rbrakk> \<Longrightarrow> \<exists>V. Q V \<and> x \<in> V \<and> V \<subseteq> U\<rbrakk> \<Longrightarrow> (arbitrary union_of Q) S
[PROOF STEP]
by (metis arbitrary_union_of_alt arbitrary_union_of_idempot)


[STATEMENT]
lemma S'_var:
  "S' = S - M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
have "S' = S * (1 - Z\<^sup>T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S' = S * ((1::'a) - Z\<^sup>T)
[PROOF STEP]
by (simp add: Z_point covector_comp_inf vector_conv_compl)
[PROOF STATE]
proof (state)
this:
S' = S * ((1::'a) - Z\<^sup>T)

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S' = S * ((1::'a) - Z\<^sup>T)

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
have "... = S * (1 - Z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S * ((1::'a) - Z\<^sup>T) = S * ((1::'a) - Z)
[PROOF STEP]
by (metis conv_complement one_inf_conv)
[PROOF STATE]
proof (state)
this:
S * ((1::'a) - Z\<^sup>T) = S * ((1::'a) - Z)

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S * ((1::'a) - Z\<^sup>T) = S * ((1::'a) - Z)

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
have "... = S * 1 \<sqinter> S * -Z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S * ((1::'a) - Z) = S * (1::'a) \<sqinter> S * - Z
[PROOF STEP]
by (simp add: S_mapping univalent_comp_left_dist_inf)
[PROOF STATE]
proof (state)
this:
S * ((1::'a) - Z) = S * (1::'a) \<sqinter> S * - Z

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
S * ((1::'a) - Z) = S * (1::'a) \<sqinter> S * - Z

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
have "... = S - M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S * (1::'a) \<sqinter> S * - Z = S - M
[PROOF STEP]
by (simp add: comp_mapping_complement S_mapping)
[PROOF STATE]
proof (state)
this:
S * (1::'a) \<sqinter> S * - Z = S - M

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
S' = S - M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S' = S - M

goal (1 subgoal):
 1. S' = S - M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
S' = S - M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cot_pfd_real_minus [simp]: "cot_pfd (-x :: real) = -cot_pfd x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
using cot_pfd_complex_minus[of "of_real x"]
[PROOF STATE]
proof (prove)
using this:
cot_pfd (- complex_of_real x) = - cot_pfd (complex_of_real x)

goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
unfolding of_real_minus [symmetric] cot_pfd_complex_of_real of_real_eq_iff
[PROOF STATE]
proof (prove)
using this:
cot_pfd (- x) = - cot_pfd x

goal (1 subgoal):
 1. cot_pfd (- x) = - cot_pfd x
[PROOF STEP]
.


[STATEMENT]
lemma outSetCorelatedEmpty2:
 assumes "outSetCorelated x = {}"   and correct3:"OUTfromV_VARto"
 shows  "OUTfromV x = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. OUTfromV x = {}
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. OUTfromV x \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
assume OUTfromVNonempty:"OUTfromV x \<noteq> {}"
[PROOF STATE]
proof (state)
this:
OUTfromV x \<noteq> {}

goal (1 subgoal):
 1. OUTfromV x \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
from this and correct3
[PROOF STATE]
proof (chain)
picking this:
OUTfromV x \<noteq> {}
OUTfromV_VARto
[PROOF STEP]
have "x \<in> outSetCorelated x"
[PROOF STATE]
proof (prove)
using this:
OUTfromV x \<noteq> {}
OUTfromV_VARto

goal (1 subgoal):
 1. x \<in> outSetCorelated x
[PROOF STEP]
by (rule outSetCorelatedNonemptyX)
[PROOF STATE]
proof (state)
this:
x \<in> outSetCorelated x

goal (1 subgoal):
 1. OUTfromV x \<noteq> {} \<Longrightarrow> False
[PROOF STEP]
from this and assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> outSetCorelated x
outSetCorelated x = {}
OUTfromV_VARto
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
x \<in> outSetCorelated x
outSetCorelated x = {}
OUTfromV_VARto

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Euler_Rule_Amicable_1:
  fixes m n a :: nat
  assumes "m \<ge> 1" and "n \<ge> 1" and "a \<ge> 1"
      and "Esigma m = Esigma n" and "Esigma a * Esigma m = a*(m+n)"
      and "gcd a m =1" and "gcd a n =1"
      shows "(a*m) Amic (a*n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * m) Amic (a * n)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a * m) Amic (a * n)
[PROOF STEP]
have a: "Esigma (a*m) =(Esigma a)*(Esigma m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * m) = Esigma a * Esigma m
[PROOF STEP]
using assms  gcd_Esigma_mult
[PROOF STATE]
proof (prove)
using this:
1 \<le> m
1 \<le> n
1 \<le> a
Esigma m = Esigma n
Esigma a * Esigma m = a * (m + n)
gcd a m = 1
gcd a n = 1
gcd ?m ?n = 1 \<Longrightarrow> Esigma (?m * ?n) = Esigma ?m * Esigma ?n

goal (1 subgoal):
 1. Esigma (a * m) = Esigma a * Esigma m
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
Esigma (a * m) = Esigma a * Esigma m

goal (1 subgoal):
 1. (a * m) Amic (a * n)
[PROOF STEP]
have b: "Esigma (a*m) = Esigma (a*n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * m) = Esigma (a * n)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Esigma (a * m) = Esigma (a * n)
[PROOF STEP]
have c: "Esigma (a*n) = (Esigma a)*(Esigma n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * n) = Esigma a * Esigma n
[PROOF STEP]
using gcd_Esigma_mult \<open>gcd a n =1\<close>
[PROOF STATE]
proof (prove)
using this:
gcd ?m ?n = 1 \<Longrightarrow> Esigma (?m * ?n) = Esigma ?m * Esigma ?n
gcd a n = 1

goal (1 subgoal):
 1. Esigma (a * n) = Esigma a * Esigma n
[PROOF STEP]
by (metis assms(4) a )
[PROOF STATE]
proof (state)
this:
Esigma (a * n) = Esigma a * Esigma n

goal (1 subgoal):
 1. Esigma (a * m) = Esigma (a * n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * m) = Esigma (a * n)
[PROOF STEP]
using c a assms
[PROOF STATE]
proof (prove)
using this:
Esigma (a * n) = Esigma a * Esigma n
Esigma (a * m) = Esigma a * Esigma m
1 \<le> m
1 \<le> n
1 \<le> a
Esigma m = Esigma n
Esigma a * Esigma m = a * (m + n)
gcd a m = 1
gcd a n = 1

goal (1 subgoal):
 1. Esigma (a * m) = Esigma (a * n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Esigma (a * m) = Esigma (a * n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Esigma (a * m) = Esigma (a * n)

goal (1 subgoal):
 1. (a * m) Amic (a * n)
[PROOF STEP]
have d: " Esigma (a*m) = a*m + a*n "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * m) = a * m + a * n
[PROOF STEP]
using a assms
[PROOF STATE]
proof (prove)
using this:
Esigma (a * m) = Esigma a * Esigma m
1 \<le> m
1 \<le> n
1 \<le> a
Esigma m = Esigma n
Esigma a * Esigma m = a * (m + n)
gcd a m = 1
gcd a n = 1

goal (1 subgoal):
 1. Esigma (a * m) = a * m + a * n
[PROOF STEP]
by (simp add: add_mult_distrib2)
[PROOF STATE]
proof (state)
this:
Esigma (a * m) = a * m + a * n

goal (1 subgoal):
 1. (a * m) Amic (a * n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * m) Amic (a * n)
[PROOF STEP]
using a b d Amicable_pair_equiv_def_conv assms
[PROOF STATE]
proof (prove)
using this:
Esigma (a * m) = Esigma a * Esigma m
Esigma (a * m) = Esigma (a * n)
Esigma (a * m) = a * m + a * n
\<lbrakk>1 \<le> ?m; 1 \<le> ?n; Esigma ?m = Esigma ?n \<and> Esigma ?m = ?m + ?n\<rbrakk> \<Longrightarrow> ?m Amic ?n
1 \<le> m
1 \<le> n
1 \<le> a
Esigma m = Esigma n
Esigma a * Esigma m = a * (m + n)
gcd a m = 1
gcd a n = 1

goal (1 subgoal):
 1. (a * m) Amic (a * n)
[PROOF STEP]
by (simp add: Suc_leI)
[PROOF STATE]
proof (state)
this:
(a * m) Amic (a * n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "rec_BitList nil bit0 bit1 (Bit0 xs) = bit0 xs (rec_BitList nil bit0 bit1 xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_BitList nil bit0 bit1 (Bit0 xs) = bit0 xs (rec_BitList nil bit0 bit1 xs)
[PROOF STEP]
refute [maxsize = 2, expect = none]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_BitList nil bit0 bit1 (Bit0 xs) = bit0 xs (rec_BitList nil bit0 bit1 xs)
[PROOF STEP]
by simp


[STATEMENT]
lemma scc_non_empty'[simp]: "is_scc E U \<Longrightarrow> U\<noteq>{}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_scc E U \<Longrightarrow> U \<noteq> {}
[PROOF STEP]
unfolding is_scc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. U \<times> U \<subseteq> E\<^sup>* \<and> (\<forall>V. U \<subset> V \<longrightarrow> \<not> V \<times> V \<subseteq> E\<^sup>*) \<Longrightarrow> U \<noteq> {}
[PROOF STEP]
by auto


[STATEMENT]
lemma closedin_derived_set:
     "closedin (subtopology X T) S \<longleftrightarrow>
      S \<subseteq> topspace X \<and> S \<subseteq> T \<and> (\<forall>x. x \<in> X derived_set_of S \<and> x \<in> T \<longrightarrow> x \<in> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (subtopology X T) S = (S \<subseteq> topspace X \<and> S \<subseteq> T \<and> (\<forall>x. x \<in> X derived_set_of S \<and> x \<in> T \<longrightarrow> x \<in> S))
[PROOF STEP]
by (auto simp: closedin_contains_derived_set derived_set_of_subtopology Int_absorb1)


[STATEMENT]
lemma nullhomotopic_through_contractible:
  fixes S :: "_::topological_space set"
  assumes f: "continuous_on S f" "f ` S \<subseteq> T"
      and g: "continuous_on T g" "g ` T \<subseteq> U"
      and T: "contractible T"
    obtains c where "homotopic_with_canon (\<lambda>h. True) S U (g \<circ> f) (\<lambda>x. c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c. homotopic_with_canon (\<lambda>h. True) S U (g \<circ> f) (\<lambda>x. c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>c. homotopic_with_canon (\<lambda>h. True) S U (g \<circ> f) (\<lambda>x. c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain b where b: "homotopic_with_canon (\<lambda>x. True) T T id (\<lambda>x. b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. homotopic_with_canon (\<lambda>x. True) T T id (\<lambda>x. b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on S f
f ` S \<subseteq> T
continuous_on T g
g ` T \<subseteq> U
contractible T

goal (1 subgoal):
 1. (\<And>b. homotopic_with_canon (\<lambda>x. True) T T id (\<lambda>x. b) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (force simp: contractible_def)
[PROOF STATE]
proof (state)
this:
homotopic_with_canon (\<lambda>x. True) T T id (\<lambda>x. b)

goal (1 subgoal):
 1. (\<And>c. homotopic_with_canon (\<lambda>h. True) S U (g \<circ> f) (\<lambda>x. c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "homotopic_with_canon (\<lambda>f. True) T U (g \<circ> id) (g \<circ> (\<lambda>x. b))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>f. True) T U (g \<circ> id) (g \<circ> (\<lambda>x. b))
[PROOF STEP]
by (metis Abstract_Topology.continuous_map_subtopology_eu b g homotopic_with_compose_continuous_map_left)
[PROOF STATE]
proof (state)
this:
homotopic_with_canon (\<lambda>f. True) T U (g \<circ> id) (g \<circ> (\<lambda>x. b))

goal (1 subgoal):
 1. (\<And>c. homotopic_with_canon (\<lambda>h. True) S U (g \<circ> f) (\<lambda>x. c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homotopic_with_canon (\<lambda>f. True) T U (g \<circ> id) (g \<circ> (\<lambda>x. b))
[PROOF STEP]
have "homotopic_with_canon (\<lambda>f. True) S U (g \<circ> id \<circ> f) (g \<circ> (\<lambda>x. b) \<circ> f)"
[PROOF STATE]
proof (prove)
using this:
homotopic_with_canon (\<lambda>f. True) T U (g \<circ> id) (g \<circ> (\<lambda>x. b))

goal (1 subgoal):
 1. homotopic_with_canon (\<lambda>f. True) S U (g \<circ> id \<circ> f) (g \<circ> (\<lambda>x. b) \<circ> f)
[PROOF STEP]
by (simp add: f homotopic_with_compose_continuous_map_right)
[PROOF STATE]
proof (state)
this:
homotopic_with_canon (\<lambda>f. True) S U (g \<circ> id \<circ> f) (g \<circ> (\<lambda>x. b) \<circ> f)

goal (1 subgoal):
 1. (\<And>c. homotopic_with_canon (\<lambda>h. True) S U (g \<circ> f) (\<lambda>x. c) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homotopic_with_canon (\<lambda>f. True) S U (g \<circ> id \<circ> f) (g \<circ> (\<lambda>x. b) \<circ> f)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
homotopic_with_canon (\<lambda>f. True) S U (g \<circ> id \<circ> f) (g \<circ> (\<lambda>x. b) \<circ> f)

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by (simp add: comp_def that)
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem sym_mpoly_representation_unique:
  fixes p :: "'a mpoly mpoly"
  assumes "finite A"
          "insertion (sym_mpoly A) p = insertion (sym_mpoly A) q"
          "\<And>m. vars (coeff p m) \<inter> A = {}" "\<And>m. vars (coeff q m) \<inter> A = {}"
          "vars p \<subseteq> {1..n}" "vars q \<subseteq> {1..n}"
  shows   "p = q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p = q
[PROOF STEP]
have "p - q = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p - q = 0
[PROOF STEP]
proof (rule sym_mpoly_representation_unique_aux)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite A
 2. insertion (sym_mpoly A) (p - q) = 0
 3. \<And>m. vars (MPoly_Type.coeff (p - q) m) \<inter> A = {}
 4. vars (p - q) \<subseteq> {1..n}
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. finite A
 2. insertion (sym_mpoly A) (p - q) = 0
 3. \<And>m. vars (MPoly_Type.coeff (p - q) m) \<inter> A = {}
 4. vars (p - q) \<subseteq> {1..n}
[PROOF STEP]
show "vars (coeff (p - q) m) \<inter> A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vars (MPoly_Type.coeff (p - q) m) \<inter> A = {}
[PROOF STEP]
using vars_diff[of "coeff p m" "coeff q m"] assms(3,4)[of m]
[PROOF STATE]
proof (prove)
using this:
vars (MPoly_Type.coeff p m - MPoly_Type.coeff q m) \<subseteq> vars (MPoly_Type.coeff p m) \<union> vars (MPoly_Type.coeff q m)
vars (MPoly_Type.coeff p m) \<inter> A = {}
vars (MPoly_Type.coeff q m) \<inter> A = {}

goal (1 subgoal):
 1. vars (MPoly_Type.coeff (p - q) m) \<inter> A = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vars (MPoly_Type.coeff (p - q) m) \<inter> A = {}

goal (3 subgoals):
 1. finite A
 2. insertion (sym_mpoly A) (p - q) = 0
 3. vars (p - q) \<subseteq> {1..n}
[PROOF STEP]
qed (insert assms vars_diff[of p q], auto simp: insertion_diff)
[PROOF STATE]
proof (state)
this:
p - q = 0

goal (1 subgoal):
 1. p = q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p - q = 0

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma surj_to_image:"f \<in> A \<rightarrow> B \<Longrightarrow> surj_to f A (f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> A \<rightarrow> B \<Longrightarrow> surj_to f A (f ` A)
[PROOF STEP]
apply (rule surj_to_test[of "f" "A" "f ` A"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. f \<in> A \<rightarrow> B \<Longrightarrow> f \<in> A \<rightarrow> f ` A
 2. f \<in> A \<rightarrow> B \<Longrightarrow> \<forall>b\<in>f ` A. \<exists>a\<in>A. f a = b
[PROOF STEP]
apply (rule func_to_img[of "f" "A" "B"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> A \<rightarrow> B \<Longrightarrow> \<forall>b\<in>f ` A. \<exists>a\<in>A. f a = b
[PROOF STEP]
apply (rule ballI, simp add:image_def, erule bexE, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b x. \<lbrakk>f \<in> A \<rightarrow> B; x \<in> A; b = f x\<rbrakk> \<Longrightarrow> \<exists>a\<in>A. f a = f x
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma reflect_poly_irreducible:
  fixes x :: "'a :: {field_char_0,field_gcd}"
  assumes p: "irreducible p" and x: "p represents x" and x0: "x \<noteq> 0"
  shows "irreducible (reflect_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible (reflect_poly p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. irreducible (reflect_poly p)
[PROOF STEP]
from represents_inverse[OF x0 x]
[PROOF STATE]
proof (chain)
picking this:
reflect_poly p represents inverse x
[PROOF STEP]
have y: "(reflect_poly p) represents (inverse x)"
[PROOF STATE]
proof (prove)
using this:
reflect_poly p represents inverse x

goal (1 subgoal):
 1. reflect_poly p represents inverse x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
reflect_poly p represents inverse x

goal (1 subgoal):
 1. irreducible (reflect_poly p)
[PROOF STEP]
from x0
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> (0::'a)
[PROOF STEP]
have ix0: "inverse x \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)

goal (1 subgoal):
 1. inverse x \<noteq> (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inverse x \<noteq> (0::'a)

goal (1 subgoal):
 1. irreducible (reflect_poly p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible (reflect_poly p)
[PROOF STEP]
proof (rule irreducible_preservation[OF p x y])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. degree (reflect_poly p) \<le> degree p
 2. \<And>q. q represents inverse x \<Longrightarrow> ?f q represents x \<and> degree (?f q) \<le> degree q
 3. primitive (reflect_poly p)
[PROOF STEP]
from x irreducible_imp_primitive[OF p]
[PROOF STATE]
proof (chain)
picking this:
p represents x
degree p \<noteq> 0 \<Longrightarrow> primitive p
[PROOF STEP]
show "primitive (reflect_poly p)"
[PROOF STATE]
proof (prove)
using this:
p represents x
degree p \<noteq> 0 \<Longrightarrow> primitive p

goal (1 subgoal):
 1. primitive (reflect_poly p)
[PROOF STEP]
by (auto simp: content_reflect_poly)
[PROOF STATE]
proof (state)
this:
primitive (reflect_poly p)

goal (2 subgoals):
 1. degree (reflect_poly p) \<le> degree p
 2. \<And>q. q represents inverse x \<Longrightarrow> ?f q represents x \<and> degree (?f q) \<le> degree q
[PROOF STEP]
fix q
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree (reflect_poly p) \<le> degree p
 2. \<And>q. q represents inverse x \<Longrightarrow> ?f q represents x \<and> degree (?f q) \<le> degree q
[PROOF STEP]
assume "q represents (inverse x)"
[PROOF STATE]
proof (state)
this:
q represents inverse x

goal (2 subgoals):
 1. degree (reflect_poly p) \<le> degree p
 2. \<And>q. q represents inverse x \<Longrightarrow> ?f q represents x \<and> degree (?f q) \<le> degree q
[PROOF STEP]
from represents_inverse[OF ix0 this]
[PROOF STATE]
proof (chain)
picking this:
reflect_poly q represents inverse (inverse x)
[PROOF STEP]
have "(reflect_poly q) represents x"
[PROOF STATE]
proof (prove)
using this:
reflect_poly q represents inverse (inverse x)

goal (1 subgoal):
 1. reflect_poly q represents x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
reflect_poly q represents x

goal (2 subgoals):
 1. degree (reflect_poly p) \<le> degree p
 2. \<And>q. q represents inverse x \<Longrightarrow> ?f q represents x \<and> degree (?f q) \<le> degree q
[PROOF STEP]
with degree_reflect_poly_le
[PROOF STATE]
proof (chain)
picking this:
degree (reflect_poly ?p) \<le> degree ?p
reflect_poly q represents x
[PROOF STEP]
show "(reflect_poly q) represents x \<and> degree (reflect_poly q) \<le> degree q"
[PROOF STATE]
proof (prove)
using this:
degree (reflect_poly ?p) \<le> degree ?p
reflect_poly q represents x

goal (1 subgoal):
 1. reflect_poly q represents x \<and> degree (reflect_poly q) \<le> degree q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
reflect_poly q represents x \<and> degree (reflect_poly q) \<le> degree q

goal (1 subgoal):
 1. degree (reflect_poly p) \<le> degree p
[PROOF STEP]
qed (insert p, auto simp: degree_reflect_poly_le)
[PROOF STATE]
proof (state)
this:
irreducible (reflect_poly p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma wf_fmla_atom_constT_imp_objT: "wf_fmla_atom (ty_term Q constT) a \<Longrightarrow> wf_fmla_atom (ty_term Q objT) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_fmla_atom (ty_term Q constT) a \<Longrightarrow> wf_fmla_atom (ty_term Q objT) a
[PROOF STEP]
apply (erule wf_fmla_atom_mono[rotated])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ty_term Q constT \<subseteq>\<^sub>m ty_term Q objT
[PROOF STEP]
apply (rule ty_term_mono)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Q \<subseteq>\<^sub>m Q
 2. constT \<subseteq>\<^sub>m objT
[PROOF STEP]
by (simp_all add: constT_ss_objT)


[STATEMENT]
lemma D_base_finite':
  "finite {len m i j xs | xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)}
[PROOF STEP]
have "{len m i j xs | xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)}
        \<subseteq> {len m i j xs | xs. set xs \<subseteq> {0..k} \<and> distinct xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)} \<subseteq> {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)} \<subseteq> {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}

goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)}
[PROOF STEP]
with D_base_finite[of m i j k]
[PROOF STATE]
proof (chain)
picking this:
finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}
{len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)} \<subseteq> {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}
{len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)} \<subseteq> {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct xs}

goal (1 subgoal):
 1. finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)}
[PROOF STEP]
by (rule rev_finite_subset)
[PROOF STATE]
proof (state)
this:
finite {len m i j xs |xs. set xs \<subseteq> {0..k} \<and> distinct (i # j # xs)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma [simp]: "c + (a \<sqinter> b) = (c + a) \<sqinter> (c + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c + a \<sqinter> b = (c + a) \<sqinter> (c + b)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c + a \<sqinter> b \<le> (c + a) \<sqinter> (c + b)
 2. (c + a) \<sqinter> (c + b) \<le> c + a \<sqinter> b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c + a \<sqinter> b \<le> c + a \<and> c + a \<sqinter> b \<le> c + b
 2. (c + a) \<sqinter> (c + b) \<le> c + a \<sqinter> b
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. c + a \<sqinter> b \<le> c + a
 2. c + a \<sqinter> b \<le> c + b
 3. (c + a) \<sqinter> (c + b) \<le> c + a \<sqinter> b
[PROOF STEP]
apply (rule add_order_preserving_left)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a \<sqinter> b \<le> a
 2. c + a \<sqinter> b \<le> c + b
 3. (c + a) \<sqinter> (c + b) \<le> c + a \<sqinter> b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. c + a \<sqinter> b \<le> c + b
 2. (c + a) \<sqinter> (c + b) \<le> c + a \<sqinter> b
[PROOF STEP]
apply (rule add_order_preserving_left)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<sqinter> b \<le> b
 2. (c + a) \<sqinter> (c + b) \<le> c + a \<sqinter> b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c + a) \<sqinter> (c + b) \<le> c + a \<sqinter> b
[PROOF STEP]
apply (rule left_move_to_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - c + (c + a) \<sqinter> (c + b) \<le> a \<sqinter> b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - c + (c + a) \<sqinter> (c + b) \<le> a \<and> - c + (c + a) \<sqinter> (c + b) \<le> b
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. - c + (c + a) \<sqinter> (c + b) \<le> a
 2. - c + (c + a) \<sqinter> (c + b) \<le> b
[PROOF STEP]
apply (rule left_move_to_right)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (c + a) \<sqinter> (c + b) \<le> - (- c) + a
 2. - c + (c + a) \<sqinter> (c + b) \<le> b
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - c + (c + a) \<sqinter> (c + b) \<le> b
[PROOF STEP]
apply (rule left_move_to_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c + a) \<sqinter> (c + b) \<le> - (- c) + b
[PROOF STEP]
by simp


[STATEMENT]
lemma list_ordered_pairs_set_containment :
  assumes "x \<in> list.set xs"
  and     "y \<in> list.set xs"
  and     "x \<noteq> y"
shows "(x,y) \<in> list.set (list_ordered_pairs xs) \<or> (y,x) \<in> list.set (list_ordered_pairs xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) \<in> set (list_ordered_pairs xs) \<or> (y, x) \<in> set (list_ordered_pairs xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> set xs
y \<in> set xs
x \<noteq> y

goal (1 subgoal):
 1. (x, y) \<in> set (list_ordered_pairs xs) \<or> (y, x) \<in> set (list_ordered_pairs xs)
[PROOF STEP]
by (induction xs; auto)


[STATEMENT]
lemma int_xor_ge0 [simp]:
  \<open>x XOR y \<ge> 0 \<longleftrightarrow> (x \<ge> 0 \<longleftrightarrow> y \<ge> 0)\<close> for x y :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> x XOR y) = ((0 \<le> x) = (0 \<le> y))
[PROOF STEP]
by (fact xor_nonnegative_int_iff)