[STATEMENT]
lemma val_ineq_setI:
  assumes "f \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
  assumes "g \<in> carrier (Q\<^sub>p[\<X>\<^bsub>n\<^esub>])"
  assumes "x \<in> (val_ineq_set n f g)"
  shows "x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
        "val (Qp_ev f x) \<le> val (Qp_ev g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) &&& val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
x \<in> val_ineq_set n f g

goal (1 subgoal):
 1. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) &&& val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)
[PROOF STEP]
unfolding val_ineq_set_def
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)}

goal (1 subgoal):
 1. x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>) &&& val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
x \<in> val_ineq_set n f g

goal (1 subgoal):
 1. val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)
[PROOF STEP]
unfolding val_ineq_set_def
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (Q\<^sub>p [\<X>\<^bsub>n\<^esub>])
x \<in> {x \<in> carrier (Q\<^sub>p\<^bsup>n\<^esup>). val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)}

goal (1 subgoal):
 1. val (eval_at_point Q\<^sub>p x f) \<le> val (eval_at_point Q\<^sub>p x g)
[PROOF STEP]
by blast


[STATEMENT]
lemma Fract_of_nat_eq: "Fract (of_nat k) 1 = of_nat k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Fract (of_nat k) (1::'a) = of_nat k
[PROOF STEP]
by (rule of_nat_fract [symmetric])


[STATEMENT]
lemma rel_list_all2_antisym:
  "\<lbrakk> (\<And>x y. \<lbrakk>(x,y) \<in> S; (y,x) \<in> T\<rbrakk> \<Longrightarrow> x = y);
     list_all2 (fun_of S) xs ys; list_all2 (fun_of T) ys xs \<rbrakk> \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. \<lbrakk>(x, y) \<in> S; (y, x) \<in> T\<rbrakk> \<Longrightarrow> x = y; list_all2 (fun_of S) xs ys; list_all2 (fun_of T) ys xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. \<lbrakk>(x, y) \<in> S; (y, x) \<in> T\<rbrakk> \<Longrightarrow> x = y; list_all2 (fun_of S) xs ys; list_all2 (fun_of T) ys xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
by (rule list_all2_antisym) auto


[STATEMENT]
lemma poly_of_vec_vCons:
 "poly_of_vec (vCons a v) = monom a (dim_vec v) + poly_of_vec v" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_of_vec (vCons a v) = monom a (dim_vec v) + poly_of_vec v
[PROOF STEP]
by (auto intro: poly_eqI simp: coeff_poly_of_vec vec_index_vCons)


[STATEMENT]
lemma lcm_1_left: "lcm 1 a = normalize a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lcm (1::'a) a = normalize a
[PROOF STEP]
by (fact lcm.top_left_normalize)


[STATEMENT]
lemma trms\<^sub>s\<^sub>s\<^sub>t_cons: "trms\<^sub>s\<^sub>s\<^sub>t (a#A) = trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p a \<union> trms\<^sub>s\<^sub>s\<^sub>t A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trms\<^sub>s\<^sub>s\<^sub>t (a # A) = trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p a \<union> trms\<^sub>s\<^sub>s\<^sub>t A
[PROOF STEP]
unfolding trms\<^sub>s\<^sub>s\<^sub>t_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set (a # A)) = trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p a \<union> \<Union> (trms\<^sub>s\<^sub>s\<^sub>t\<^sub>p ` set A)
[PROOF STEP]
by force


[STATEMENT]
lemma size_Union_distinct_cart_prod_filter2: "distinct_mset V \<Longrightarrow>
    (\<And> b . b \<in># B \<Longrightarrow> size ({# v \<in># V . P v b #}) = c) \<Longrightarrow>
    size (\<Sum>b\<in>#B. ( {# v \<in># V . P v b #} \<times># {#b#})) = size (B) * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>distinct_mset V; \<And>b. b \<in># B \<Longrightarrow> size {#v \<in># V. P v b#} = c\<rbrakk> \<Longrightarrow> size (\<Sum>b\<in>#B. {#v \<in># V. P v b#} \<times># {#b#}) = size B * c
[PROOF STEP]
by (induction B) auto


[STATEMENT]
lemma real_sqrt_sum_squares_ge2 [simp]: "y \<le> sqrt (x\<^sup>2 + y\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<le> sqrt (x\<^sup>2 + y\<^sup>2)
[PROOF STEP]
by (rule power2_le_imp_le) simp_all


[STATEMENT]
lemma
  iLast_UNIV: "(\<ominus> t t0 UNIV. P t) = P (t0 - Suc 0)" and
  iLastWeak_UNIV: "(\<ominus>\<^sub>W t t0 UNIV. P t) = (if 0 < t0 then P (t0 - Suc 0) else True)" and
  iLastStrong_UNIV: "(\<ominus>\<^sub>S t t0 UNIV. P t) = (if 0 < t0 then P (t0 - Suc 0) else False)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iLast t0 UNIV P = P (t0 - Suc 0) &&& iLastWeak t0 UNIV P = (if 0 < t0 then P (t0 - Suc 0) else True) &&& iLastStrong t0 UNIV P = (if 0 < t0 then P (t0 - Suc 0) else False)
[PROOF STEP]
by (simp_all add: iTL_Next_defs iprev_UNIV cut_less_singleton)


[STATEMENT]
lemma least_prefixpoint_fixpoint:
  "has_least_prefixpoint f \<Longrightarrow> isotone f \<Longrightarrow> is_least_fixpoint f (p\<mu> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>has_least_prefixpoint f; isotone f\<rbrakk> \<Longrightarrow> is_least_fixpoint f (p\<mu> f)
[PROOF STEP]
using is_least_fixpoint_def is_least_prefixpoint_def least_prefixpoint order.antisym isotone_def
[PROOF STATE]
proof (prove)
using this:
is_least_fixpoint ?f ?x \<equiv> ?f ?x = ?x \<and> (\<forall>y. ?f y = y \<longrightarrow> ?x \<le> y)
is_least_prefixpoint ?f ?x \<equiv> ?f ?x \<le> ?x \<and> (\<forall>y. ?f y \<le> y \<longrightarrow> ?x \<le> y)
has_least_prefixpoint ?f \<Longrightarrow> is_least_prefixpoint ?f (p\<mu> ?f)
\<lbrakk>?a \<le> ?b; ?b \<le> ?a\<rbrakk> \<Longrightarrow> ?a = ?b
isotone ?f \<equiv> \<forall>x y. x \<le> y \<longrightarrow> ?f x \<le> ?f y

goal (1 subgoal):
 1. \<lbrakk>has_least_prefixpoint f; isotone f\<rbrakk> \<Longrightarrow> is_least_fixpoint f (p\<mu> f)
[PROOF STEP]
by auto


[STATEMENT]
lemma subst_comp_all: "M \<cdot>\<^sub>s\<^sub>e\<^sub>t (\<delta> \<circ>\<^sub>s \<theta>) = (M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<delta>) \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<delta> \<circ>\<^sub>s \<theta> = M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<delta> \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>
[PROOF STEP]
using subst_subst_compose[of _ \<delta> \<theta>]
[PROOF STATE]
proof (prove)
using this:
?t \<cdot> \<delta> \<circ>\<^sub>s \<theta> = ?t \<cdot> \<delta> \<cdot> \<theta>

goal (1 subgoal):
 1. M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<delta> \<circ>\<^sub>s \<theta> = M \<cdot>\<^sub>s\<^sub>e\<^sub>t \<delta> \<cdot>\<^sub>s\<^sub>e\<^sub>t \<theta>
[PROOF STEP]
by auto


[STATEMENT]
lemma LeftDerivationLadder_deriv_n_bound:
  assumes "LeftDerivationLadder a D L b"
  assumes "index < length L"
  shows "deriv_n (L ! index) \<le> length D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv_n (L ! index) \<le> length D
[PROOF STEP]
using LeftDerivationLadder_def assms(1) assms(2) is_ladder_def ladder_n_def
[PROOF STATE]
proof (prove)
using this:
LeftDerivationLadder ?a ?D ?L ?b = (LeftDerivation ?a ?D ?b \<and> is_ladder ?D ?L \<and> LeftDerivationFix ?a (ladder_i ?L 0) (take (ladder_n ?L 0) ?D) (ladder_j ?L 0) (ladder_\<gamma> ?a ?D ?L 0) \<and> LeftDerivationIntros ?a ?D ?L)
LeftDerivationLadder a D L b
index < length L
is_ladder ?D ?L = (?L \<noteq> [] \<and> (\<forall>u<length ?L. ladder_n ?L u \<le> length ?D) \<and> (\<forall>u v. u < v \<and> v < length ?L \<longrightarrow> ladder_n ?L u < ladder_n ?L v) \<and> ladder_last_n ?L = length ?D)
ladder_n ?L ?index = deriv_n (?L ! ?index)

goal (1 subgoal):
 1. deriv_n (L ! index) \<le> length D
[PROOF STEP]
by auto


[STATEMENT]
lemma (in Ring) coprime_prod_int2:"\<lbrakk> \<forall>k \<le> (Suc n). ideal R (J k);
 \<forall>i \<le> (Suc n). \<forall>j \<le> (Suc n). (i \<noteq>j \<longrightarrow> coprime_ideals R (J i) (J j))\<rbrakk>
 \<Longrightarrow> (\<Inter> {I. \<exists>k \<le> (Suc n). I = (J k)} = ideal_n_prod R (Suc n) J)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>k\<le>Suc n. ideal R (J k); \<forall>i\<le>Suc n. \<forall>j\<le>Suc n. i \<noteq> j \<longrightarrow> coprime_ideals R (J i) (J j)\<rbrakk> \<Longrightarrow> \<Inter> {I. \<exists>k\<le>Suc n. I = J k} = i\<Pi>\<^bsub>R,Suc n\<^esub> J
[PROOF STEP]
apply (simp add:coprime_prod_int2Tr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in stateful_protocol_model) timpl_closure_Ana_keys_length_eq:
  fixes s t::"('fun,'atom,'sets,'lbl) prot_term"
  assumes "t \<in> timpl_closure s TI"
    and "Ana s = (Ks, Rs)"
    and "Ana t = (Kt, Rt)"
  shows "length Kt = length Ks"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length Kt = length Ks
[PROOF STEP]
by (rule timpl_closure_Ana_keys(1,2)[OF assms])


[STATEMENT]
lemma or_minus_minus_numerals [simp]:
  \<open>- (numeral m :: int) OR - (numeral n :: int) = NOT ((numeral m - 1) AND (numeral n - 1))\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - numeral m OR - numeral n = NOT (numeral m - 1 AND numeral n - 1)
[PROOF STEP]
by (simp add: minus_numeral_eq_not_sub_one)


[STATEMENT]
lemma set_comp_associative:
  fixes f and g and h
  assumes f: "f \<in> ar (set_cat U)"
    and g: "g \<in> ar (set_cat U)"
    and h: "h \<in> ar (set_cat U)"
    and hg: "cod (set_cat U) h = dom (set_cat U) g"
    and gf: "cod (set_cat U) g = dom (set_cat U) f"
  shows "comp (set_cat U) f (comp (set_cat U) g h) =
  comp (set_cat U) (comp (set_cat U) f g) h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<bullet>\<^bsub>set_cat U\<^esub> (g \<bullet>\<^bsub>set_cat U\<^esub> h) = f \<bullet>\<^bsub>set_cat U\<^esub> g \<bullet>\<^bsub>set_cat U\<^esub> h
[PROOF STEP]
proof (simp add: set_cat_def set_comp_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compose (set_dom h) (set_func f) (compose (set_dom h) (set_func g) (set_func h)) = compose (set_dom h) (compose (set_dom g) (set_func f) (set_func g)) (set_func h)
[PROOF STEP]
show "compose (set_dom h) (set_func f) (compose (set_dom h) (set_func g) (set_func h)) =
    compose (set_dom h) (compose (set_dom g) (set_func f) (set_func g)) (set_func h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose (set_dom h) (set_func f) (compose (set_dom h) (set_func g) (set_func h)) = compose (set_dom h) (compose (set_dom g) (set_func f) (set_func g)) (set_func h)
[PROOF STEP]
proof (rule compose_assoc)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_func h \<in> set_dom h \<rightarrow> set_dom g
[PROOF STEP]
show "set_func h \<in> set_dom h \<rightarrow> set_dom g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_func h \<in> set_dom h \<rightarrow> set_dom g
[PROOF STEP]
using h hg
[PROOF STATE]
proof (prove)
using this:
h \<in> Ar\<^bsub>set_cat U\<^esub>
Cod\<^bsub>set_cat U\<^esub> h = Dom\<^bsub>set_cat U\<^esub> g

goal (1 subgoal):
 1. set_func h \<in> set_dom h \<rightarrow> set_dom g
[PROOF STEP]
by (simp add: set_cat_def set_arrow_def)
[PROOF STATE]
proof (state)
this:
set_func h \<in> set_dom h \<rightarrow> set_dom g

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
compose (set_dom h) (set_func f) (compose (set_dom h) (set_func g) (set_func h)) = compose (set_dom h) (compose (set_dom g) (set_func f) (set_func g)) (set_func h)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma uMult_unit_right: "(x::UNat) *\<^sub># 1 = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x *\<^sub># 1 = x
[PROOF STEP]
unfolding uMult_def one_discr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Lambda> x y. Discr (undiscr x * undiscr y))\<cdot>x\<cdot>(Discr 1) = x
[PROOF STEP]
by simp


[STATEMENT]
lemma separate_othogonal_commuted: assumes
    "\<And>ps n. P (ps,n) \<Longrightarrow> ps = 0"
    "\<And>ps n. Q (ps,n) \<Longrightarrow> n = 0"
  shows "(P ** Q) (ps,n) \<longleftrightarrow> P (0,n) \<and> Q (ps,0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P \<and>* Q) (ps, n) = (P (0::'a, n) \<and> Q (ps, 0::'b))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P (?ps, ?n) \<Longrightarrow> ?ps = (0::'a)
Q (?ps, ?n) \<Longrightarrow> ?n = (0::'b)

goal (1 subgoal):
 1. (P \<and>* Q) (ps, n) = (P (0::'a, n) \<and> Q (ps, 0::'b))
[PROOF STEP]
unfolding sep_conj_def
[PROOF STATE]
proof (prove)
using this:
P (?ps, ?n) \<Longrightarrow> ?ps = (0::'a)
Q (?ps, ?n) \<Longrightarrow> ?n = (0::'b)

goal (1 subgoal):
 1. (\<exists>x y. x ## y \<and> (ps, n) = x + y \<and> P x \<and> Q y) = (P (0::'a, n) \<and> Q (ps, 0::'b))
[PROOF STEP]
by force


[STATEMENT]
lemma poly_roots_of_int_conv_sum_prime_factors:
  "poly_roots (of_int_poly q :: 'a :: {idom, ring_char_0} poly) =
   (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
proof (cases "q = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
case [simp]: False
[PROOF STATE]
proof (state)
this:
q \<noteq> 0

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
have "(\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p :: 'a poly)) =
        poly_roots (\<Prod>p\<in>#prime_factorization q. of_int_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p)) = poly_roots (\<Prod>\<^sub># (image_mset of_int_poly (prime_factorization q)))
[PROOF STEP]
by (subst poly_roots_prod_mset) (auto simp: multiset.map_comp o_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p)) = poly_roots (\<Prod>\<^sub># (image_mset of_int_poly (prime_factorization q)))

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p)) = poly_roots (\<Prod>\<^sub># (image_mset of_int_poly (prime_factorization q)))

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
have "(\<Prod>p\<in>#prime_factorization q. of_int_poly p :: 'a poly) =
               of_int_poly (prod_mset (prime_factorization q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>\<^sub># (image_mset of_int_poly (prime_factorization q)) = of_int_poly (\<Prod>\<^sub># (prime_factorization q))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (image_mset of_int_poly (prime_factorization q)) = of_int_poly (\<Prod>\<^sub># (prime_factorization q))

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Prod>\<^sub># (image_mset of_int_poly (prime_factorization q)) = of_int_poly (\<Prod>\<^sub># (prime_factorization q))

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
have "poly_roots \<dots> = poly_roots (of_int_poly (normalize (prod_mset (prime_factorization q))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (of_int_poly (\<Prod>\<^sub># (prime_factorization q))) = poly_roots (of_int_poly (normalize (\<Prod>\<^sub># (prime_factorization q))))
[PROOF STEP]
by (rule poly_roots_of_int_normalize [symmetric])
[PROOF STATE]
proof (state)
this:
poly_roots (of_int_poly (\<Prod>\<^sub># (prime_factorization q))) = poly_roots (of_int_poly (normalize (\<Prod>\<^sub># (prime_factorization q))))

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_roots (of_int_poly (\<Prod>\<^sub># (prime_factorization q))) = poly_roots (of_int_poly (normalize (\<Prod>\<^sub># (prime_factorization q))))

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
have "normalize (prod_mset (prime_factorization q)) = normalize q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (\<Prod>\<^sub># (prime_factorization q)) = normalize q
[PROOF STEP]
by (rule prod_mset_prime_factorization_weak) auto
[PROOF STATE]
proof (state)
this:
normalize (\<Prod>\<^sub># (prime_factorization q)) = normalize q

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
normalize (\<Prod>\<^sub># (prime_factorization q)) = normalize q

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
have "poly_roots (of_int_poly \<dots> :: 'a poly) = poly_roots (of_int_poly q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_roots (of_int_poly (normalize q)) = poly_roots (of_int_poly q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_roots (of_int_poly (normalize q)) = poly_roots (of_int_poly q)

goal (2 subgoals):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
 2. q \<noteq> 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p)) = poly_roots (of_int_poly q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p)) = poly_roots (of_int_poly q)

goal (1 subgoal):
 1. poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))

goal (1 subgoal):
 1. q = 0 \<Longrightarrow> poly_roots (of_int_poly q) = (\<Sum>p\<in>#prime_factorization q. poly_roots (of_int_poly p))
[PROOF STEP]
qed auto


[STATEMENT]
lemma homomorphism_add: "(of_int_mod_ring x)+(of_int_mod_ring y) =
              ((of_int_mod_ring  (x+y)) ::(('a::prime_card) mod_ring))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_mod_ring x + of_int_mod_ring y = of_int_mod_ring (x + y)
[PROOF STEP]
by (metis of_int_hom.hom_add of_int_of_int_mod_ring)


[STATEMENT]
lemma the_set_inter [simp]:
  "the_set (A \<inter> B) = the_set A \<inter> the_set B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_set (A \<inter> B) = the_set A \<inter> the_set B
[PROOF STEP]
by (fastforce simp: the_set_def)


[STATEMENT]
lemma rel_list_all2_antisym:
  "\<lbrakk> (\<And>x y. \<lbrakk>(x,y) \<in> S; (y,x) \<in> T\<rbrakk> \<Longrightarrow> x = y);
     list_all2 (fun_of S) xs ys; list_all2 (fun_of T) ys xs \<rbrakk> \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. \<lbrakk>(x, y) \<in> S; (y, x) \<in> T\<rbrakk> \<Longrightarrow> x = y; list_all2 (fun_of S) xs ys; list_all2 (fun_of T) ys xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. \<lbrakk>(x, y) \<in> S; (y, x) \<in> T\<rbrakk> \<Longrightarrow> x = y; list_all2 (fun_of S) xs ys; list_all2 (fun_of T) ys xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
by (rule list_all2_antisym) auto


[STATEMENT]
lemma "a < b \<and> b < (c::int) \<Longrightarrow> \<exists>A. a \<notin> A \<and> b \<in> A \<and> c \<notin> A"
  \<comment> \<open>Example 4.\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a < b \<and> b < c \<Longrightarrow> \<exists>A. a \<notin> A \<and> b \<in> A \<and> c \<notin> A
[PROOF STEP]
by auto \<comment> \<open>slow\<close>


[STATEMENT]
lemma minus_monom: "- monom a n = monom (- a) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - monom a n = monom (- a) n
[PROOF STEP]
by (rule poly_eqI) simp


[STATEMENT]
lemma list_ex_iff_not_all_inverval_int [code_unfold]:
  "list_ex P [i..j] \<longleftrightarrow> \<not> (all_interval_int (Not \<circ> P) i j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_ex P [i..j] = (\<not> all_interval_int (Not \<circ> P) i j)
[PROOF STEP]
by (simp add: list_ex_iff all_interval_int_def)


[STATEMENT]
lemma canonical_separator_distinguishing_transitions_left_containment :
  assumes "t \<in> (distinguishing_transitions_left M q1 q2)"
      and "q1 \<in> states M" and "q2 \<in> states M"
    shows "t \<in> transitions (canonical_separator M q1 q2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> FSM.transitions (canonical_separator M q1 q2)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
t \<in> distinguishing_transitions_left M q1 q2

goal (1 subgoal):
 1. t \<in> FSM.transitions (canonical_separator M q1 q2)
[PROOF STEP]
unfolding canonical_separator_transitions_def[OF assms(2,3)]
[PROOF STATE]
proof (prove)
using this:
t \<in> distinguishing_transitions_left M q1 q2

goal (1 subgoal):
 1. t \<in> {(Inl (q1', q2'), x, y, Inl (q1'', q2'')) |q1' q2' x y q1'' q2''. ((q1', q2'), x, y, q1'', q2'') \<in> FSM.transitions (Product_FSM.product (from_FSM M q1) (from_FSM M q2))} \<union> distinguishing_transitions_left M q1 q2 \<union> distinguishing_transitions_right M q1 q2
[PROOF STEP]
by blast


[STATEMENT]
lemma divide_pos_neg:
  "0 < x \<Longrightarrow> y < 0 \<Longrightarrow> x / y < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < x; y < (0::'a)\<rbrakk> \<Longrightarrow> x / y < (0::'a)
[PROOF STEP]
by(simp add:field_simps)


[STATEMENT]
lemma fpxs_X_power_add: "fpxs_X_power (a + b) = fpxs_X_power a * fpxs_X_power b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_X_power (a + b) = fpxs_X_power a * fpxs_X_power b
[PROOF STEP]
proof (transfer, goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (\<lambda>n. if n = a + b then 1::'a else (0::'a)) = (\<lambda>x. \<Sum>(y, z)\<in>{(y, z). y \<in> supp (\<lambda>n. if n = a then 1::'a else (0::'a)) \<and> z \<in> supp (\<lambda>n. if n = b then 1::'a else (0::'a)) \<and> x = y + z}. (if y = a then 1::'a else (0::'a)) * (if z = b then 1::'a else (0::'a)))
[PROOF STEP]
case (1 a b)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>a b. (\<lambda>n. if n = a + b then 1::'a else (0::'a)) = (\<lambda>x. \<Sum>(y, z)\<in>{(y, z). y \<in> supp (\<lambda>n. if n = a then 1::'a else (0::'a)) \<and> z \<in> supp (\<lambda>n. if n = b then 1::'a else (0::'a)) \<and> x = y + z}. (if y = a then 1::'a else (0::'a)) * (if z = b then 1::'a else (0::'a)))
[PROOF STEP]
have *: "{(y,z). y \<in> supp (\<lambda>n. if n=a then (1::'a) else 0) \<and>
               z \<in> supp (\<lambda>n. if n=b then (1::'a) else 0) \<and> x=y+z} =
           (if x = a + b then {(a, b)} else {})" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(y, z). y \<in> supp (\<lambda>n. if n = a then 1::'a else (0::'a)) \<and> z \<in> supp (\<lambda>n. if n = b then 1::'a else (0::'a)) \<and> x = y + z} = (if x = a + b then {(a, b)} else {})
[PROOF STEP]
by (auto simp: supp_def fun_eq_iff)
[PROOF STATE]
proof (state)
this:
{(y, z). y \<in> supp (\<lambda>n. if n = a then 1::'a else (0::'a)) \<and> z \<in> supp (\<lambda>n. if n = b then 1::'a else (0::'a)) \<and> ?x = y + z} = (if ?x = a + b then {(a, b)} else {})

goal (1 subgoal):
 1. \<And>a b. (\<lambda>n. if n = a + b then 1::'a else (0::'a)) = (\<lambda>x. \<Sum>(y, z)\<in>{(y, z). y \<in> supp (\<lambda>n. if n = a then 1::'a else (0::'a)) \<and> z \<in> supp (\<lambda>n. if n = b then 1::'a else (0::'a)) \<and> x = y + z}. (if y = a then 1::'a else (0::'a)) * (if z = b then 1::'a else (0::'a)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n = a + b then 1::'a else (0::'a)) = (\<lambda>x. \<Sum>(y, z)\<in>{(y, z). y \<in> supp (\<lambda>n. if n = a then 1::'a else (0::'a)) \<and> z \<in> supp (\<lambda>n. if n = b then 1::'a else (0::'a)) \<and> x = y + z}. (if y = a then 1::'a else (0::'a)) * (if z = b then 1::'a else (0::'a)))
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. if n = a + b then 1::'a else (0::'a)) = (\<lambda>x. \<Sum>(y, z)\<in>(if x = a + b then {(a, b)} else {}). (if y = a then 1::'a else (0::'a)) * (if z = b then 1::'a else (0::'a)))
[PROOF STEP]
by (auto simp: fun_eq_iff case_prod_unfold)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. if n = a + b then 1::'a else (0::'a)) = (\<lambda>x. \<Sum>(y, z)\<in>{(y, z). y \<in> supp (\<lambda>n. if n = a then 1::'a else (0::'a)) \<and> z \<in> supp (\<lambda>n. if n = b then 1::'a else (0::'a)) \<and> x = y + z}. (if y = a then 1::'a else (0::'a)) * (if z = b then 1::'a else (0::'a)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_mult_fds: "inverse (f * g :: 'a :: field fds) = inverse f * inverse g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (f * g) = inverse f * inverse g
[PROOF STEP]
proof (cases "fds_nth (f * g) (Suc 0) = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fds_nth (f * g) (Suc 0) = (0::'a) \<Longrightarrow> inverse (f * g) = inverse f * inverse g
 2. fds_nth (f * g) (Suc 0) \<noteq> (0::'a) \<Longrightarrow> inverse (f * g) = inverse f * inverse g
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
fds_nth (f * g) (Suc 0) \<noteq> (0::'a)

goal (2 subgoals):
 1. fds_nth (f * g) (Suc 0) = (0::'a) \<Longrightarrow> inverse (f * g) = inverse f * inverse g
 2. fds_nth (f * g) (Suc 0) \<noteq> (0::'a) \<Longrightarrow> inverse (f * g) = inverse f * inverse g
[PROOF STEP]
hence "(f * inverse f) * (g * inverse g) = 1"
[PROOF STATE]
proof (prove)
using this:
fds_nth (f * g) (Suc 0) \<noteq> (0::'a)

goal (1 subgoal):
 1. f * inverse f * (g * inverse g) = 1
[PROOF STEP]
by (subst (1 2) fds_right_inverse) auto
[PROOF STATE]
proof (state)
this:
f * inverse f * (g * inverse g) = 1

goal (2 subgoals):
 1. fds_nth (f * g) (Suc 0) = (0::'a) \<Longrightarrow> inverse (f * g) = inverse f * inverse g
 2. fds_nth (f * g) (Suc 0) \<noteq> (0::'a) \<Longrightarrow> inverse (f * g) = inverse f * inverse g
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f * inverse f * (g * inverse g) = 1

goal (1 subgoal):
 1. inverse (f * g) = inverse f * inverse g
[PROOF STEP]
by (intro fds_right_inverse_unique [symmetric]) (simp_all add: mult_ac)
[PROOF STATE]
proof (state)
this:
inverse (f * g) = inverse f * inverse g

goal (1 subgoal):
 1. fds_nth (f * g) (Suc 0) = (0::'a) \<Longrightarrow> inverse (f * g) = inverse f * inverse g
[PROOF STEP]
qed (auto simp: inverse_fds_nonunit)


[STATEMENT]
lemma greatest_is_MaxR_opt:
  assumes "x \<in> A \<inter> Field r"
  assumes "\<forall>y \<in> A \<inter> Field r. (y, x) \<in> r"
  shows "MaxR_opt A = Some x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MaxR_opt A = Some x
[PROOF STEP]
using finite[of A] assms
[PROOF STATE]
proof (prove)
using this:
finite A
x \<in> A \<inter> Field r
\<forall>y\<in>A \<inter> Field r. (y, x) \<in> r

goal (1 subgoal):
 1. MaxR_opt A = Some x
[PROOF STEP]
proof(induct arbitrary: x)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {} \<inter> Field r; \<forall>y\<in>{} \<inter> Field r. (y, x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt {} = Some x
 2. \<And>x F xa. \<lbrakk>finite F; x \<notin> F; \<And>x. \<lbrakk>x \<in> F \<inter> Field r; \<forall>y\<in>F \<inter> Field r. (y, x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt F = Some x; xa \<in> insert x F \<inter> Field r; \<forall>y\<in>insert x F \<inter> Field r. (y, xa) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt (insert x F) = Some xa
[PROOF STEP]
note ins = insert
[PROOF STATE]
proof (state)
this:
MaxR_opt (insert ?x ?A) = (if ?x \<in> Field r then Some (case MaxR_opt ?A of None \<Rightarrow> ?x | Some y \<Rightarrow> maxR ?x y) else MaxR_opt ?A)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {} \<inter> Field r; \<forall>y\<in>{} \<inter> Field r. (y, x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt {} = Some x
 2. \<And>x F xa. \<lbrakk>finite F; x \<notin> F; \<And>x. \<lbrakk>x \<in> F \<inter> Field r; \<forall>y\<in>F \<inter> Field r. (y, x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt F = Some x; xa \<in> insert x F \<inter> Field r; \<forall>y\<in>insert x F \<inter> Field r. (y, xa) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt (insert x F) = Some xa
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
\<lbrakk>?x \<in> A \<inter> Field r; \<forall>y\<in>A \<inter> Field r. (y, ?x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt A = Some ?x
x \<in> insert a A \<inter> Field r
\<forall>y\<in>insert a A \<inter> Field r. (y, x) \<in> r

goal (2 subgoals):
 1. \<And>x. \<lbrakk>x \<in> {} \<inter> Field r; \<forall>y\<in>{} \<inter> Field r. (y, x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt {} = Some x
 2. \<And>x F xa. \<lbrakk>finite F; x \<notin> F; \<And>x. \<lbrakk>x \<in> F \<inter> Field r; \<forall>y\<in>F \<inter> Field r. (y, x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt F = Some x; xa \<in> insert x F \<inter> Field r; \<forall>y\<in>insert x F \<inter> Field r. (y, xa) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt (insert x F) = Some xa
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
a \<notin> A
\<lbrakk>?x \<in> A \<inter> Field r; \<forall>y\<in>A \<inter> Field r. (y, ?x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt A = Some ?x
x \<in> insert a A \<inter> Field r
\<forall>y\<in>insert a A \<inter> Field r. (y, x) \<in> r
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A
\<lbrakk>?x \<in> A \<inter> Field r; \<forall>y\<in>A \<inter> Field r. (y, ?x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt A = Some ?x
x \<in> insert a A \<inter> Field r
\<forall>y\<in>insert a A \<inter> Field r. (y, x) \<in> r

goal (1 subgoal):
 1. MaxR_opt (insert a A) = Some x
[PROOF STEP]
using maxR_absorb1 maxR_absorb2
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A
\<lbrakk>?x \<in> A \<inter> Field r; \<forall>y\<in>A \<inter> Field r. (y, ?x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt A = Some ?x
x \<in> insert a A \<inter> Field r
\<forall>y\<in>insert a A \<inter> Field r. (y, x) \<in> r
(?y, ?x) \<in> r \<Longrightarrow> maxR ?x ?y = ?x
(?x, ?y) \<in> r \<Longrightarrow> maxR ?x ?y = ?y

goal (1 subgoal):
 1. MaxR_opt (insert a A) = Some x
[PROOF STEP]
by (fastforce simp: maxR_def ins dest: range_None range_Some split: option.splits)
[PROOF STATE]
proof (state)
this:
MaxR_opt (insert a A) = Some x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> {} \<inter> Field r; \<forall>y\<in>{} \<inter> Field r. (y, x) \<in> r\<rbrakk> \<Longrightarrow> MaxR_opt {} = Some x
[PROOF STEP]
qed simp


[STATEMENT]
theorem sturm_below:
  assumes "poly p b \<noteq> 0"
  shows "card {x. poly p x = 0 \<and> x < b} = changes_le_smods b p (pderiv p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (card {x. poly p x = 0 \<and> x < b}) = changes_le_smods b p (pderiv p)
[PROOF STEP]
using sturm_tarski_below[OF assms, unfolded taq_def,of 1]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x | poly p x = 0 \<and> x < b. sign (poly 1 x)) = changes_le_smods b p (pderiv p * 1)

goal (1 subgoal):
 1. int (card {x. poly p x = 0 \<and> x < b}) = changes_le_smods b p (pderiv p)
[PROOF STEP]
by force


[STATEMENT]
lemma sum_incoming_alt_flow:
  fixes g :: "edge \<Rightarrow> 'capacity"
  assumes "u\<in>V"
  shows "(\<Sum>e\<in>incoming u. f e) = (\<Sum>v\<in>V. f (v,u))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (incoming u) = (\<Sum>v\<in>V. f (v, u))
[PROOF STEP]
apply (subst sum_incoming_alt)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<forall>e. (0::'capacity) \<le> f e \<and> f e \<le> c e
 2. u \<in> V
 3. (\<Sum>ua\<in>V. f (ua, u)) = (\<Sum>v\<in>V. f (v, u))
[PROOF STEP]
using assms capacity_const
[PROOF STATE]
proof (prove)
using this:
u \<in> V
\<forall>e. (0::'capacity) \<le> f e \<and> f e \<le> c e

goal (3 subgoals):
 1. \<forall>e. (0::'capacity) \<le> f e \<and> f e \<le> c e
 2. u \<in> V
 3. (\<Sum>ua\<in>V. f (ua, u)) = (\<Sum>v\<in>V. f (v, u))
[PROOF STEP]
by auto


[STATEMENT]
lemma per2_col_eq:
  assumes "A \<noteq> P" and
    "A \<noteq> P'" and
    "Per A P B" and
    "Per A P' B" and
    "Col P A P'"
  shows "P = P'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P = P'
[PROOF STEP]
by (metis assms(1) assms(2) assms(3) assms(4) assms(5) col_per2_cases l6_16_1 l8_2 not_col_permutation_3)


[STATEMENT]
lemma f_Exec_Stream_Pre_Post2: "
  \<lbrakk> n < length xs;
    c_n = (f_Exec_Comp_Stream trans_fun xs c)\<^bsup>\<leftarrow>' c\<^esup> n; x_n = xs ! n \<rbrakk> \<Longrightarrow>
  (P c_n \<longrightarrow> Q (xs ! n) (f_Exec_Comp_Stream trans_fun xs c ! n)) =
  (P c_n \<longrightarrow> Q x_n (trans_fun x_n c_n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs; c_n = (f_Exec_Comp_Stream trans_fun xs c)\<^bsup>\<leftarrow>' c\<^esup> n; x_n = xs ! n\<rbrakk> \<Longrightarrow> (P c_n \<longrightarrow> Q (xs ! n) (f_Exec_Comp_Stream trans_fun xs c ! n)) = (P c_n \<longrightarrow> Q x_n (trans_fun x_n c_n))
[PROOF STEP]
by (simp add: f_Exec_Stream_nth_calc_Previous)


[STATEMENT]
theorem Knaster_Tarski_idem:
  assumes "complete_lattice L" "f \<in> carrier L \<rightarrow> carrier L" "isotone L L f" "idempotent L f"
  shows "complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
interpret L: complete_lattice L
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complete_lattice L
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
have "fps L f = f ` carrier L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps L f = f ` carrier L
[PROOF STEP]
using L.weak.fps_idem[OF assms(2) assms(4)]
[PROOF STATE]
proof (prove)
using this:
fps L f {.=}\<^bsub>L\<^esub> f ` carrier L

goal (1 subgoal):
 1. fps L f = f ` carrier L
[PROOF STEP]
by (simp add: L.set_eq_is_eq)
[PROOF STATE]
proof (state)
this:
fps L f = f ` carrier L

goal (1 subgoal):
 1. complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
fps L f = f ` carrier L
[PROOF STEP]
interpret L': weak_complete_lattice "(L\<lparr>carrier := f ` carrier L\<rparr>)"
[PROOF STATE]
proof (prove)
using this:
fps L f = f ` carrier L

goal (1 subgoal):
 1. weak_complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
by (metis Knaster_Tarski L.weak.weak_complete_lattice_axioms assms(2) assms(3))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
using L'.sup_exists L'.inf_exists
[PROOF STATE]
proof (prove)
using this:
?A \<subseteq> carrier (L\<lparr>carrier := f ` carrier L\<rparr>) \<Longrightarrow> \<exists>s. is_lub (L\<lparr>carrier := f ` carrier L\<rparr>) s ?A
?A \<subseteq> carrier (L\<lparr>carrier := f ` carrier L\<rparr>) \<Longrightarrow> \<exists>i. is_glb (L\<lparr>carrier := f ` carrier L\<rparr>) i ?A

goal (1 subgoal):
 1. complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)
[PROOF STEP]
by (unfold_locales, auto simp add: L.eq_is_equal)
[PROOF STATE]
proof (state)
this:
complete_lattice (L\<lparr>carrier := f ` carrier L\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma NS_DERIV_D: "DERIV f x :> D \<Longrightarrow> (\<lambda>h. (f (x + h) - f x) / h) \<midarrow>0\<rightarrow>\<^sub>N\<^sub>S D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_field_derivative D) (at x) \<Longrightarrow> (\<lambda>h. (f (x + h) - f x) / h) \<midarrow>0::'a\<rightarrow>\<^sub>N\<^sub>S D
[PROOF STEP]
by (simp add: DERIV_def LIM_NSLIM_iff)


[STATEMENT]
lemma lfp_fusion_sup_pres:
  fixes f :: "'a::complete_lattice_with_dual \<Rightarrow> 'a"
  and g :: "'b::complete_lattice_with_dual \<Rightarrow> 'b"
  assumes "Sup_pres h"
  and "mono f"
  and "mono g"
  and "h \<circ> f = g \<circ> h"
shows "h (lfp f) = lfp g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. h (lfp f) = lfp g
[PROOF STEP]
by (simp add: Sup_pres_ladj assms lfp_fusion)


[STATEMENT]
lemma filterlim_inverse_at_top_iff:
  "eventually (\<lambda>x. 0 < f x) F \<Longrightarrow> (LIM x F. inverse (f x) :> at_top) \<longleftrightarrow> (f \<longlongrightarrow> (0 :: real)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. 0 < f x \<Longrightarrow> (LIM x F. inverse (f x) :> at_top) = (f \<longlongrightarrow> 0) F
[PROOF STEP]
by (auto dest: tendsto_inverse_0_at_top filterlim_inverse_at_top)


[STATEMENT]
lemma sum_infsum:
  fixes f :: "'a \<Rightarrow> 'b::{topological_comm_monoid_add, t2_space}"
  assumes finite: \<open>finite A\<close>
  assumes conv: \<open>\<And>a. a \<in> A \<Longrightarrow> f summable_on (B a)\<close>
  assumes disj: \<open>\<And>a a'. a\<in>A \<Longrightarrow> a'\<in>A \<Longrightarrow> a\<noteq>a' \<Longrightarrow> B a \<inter> B a' = {}\<close>
  shows \<open>sum (\<lambda>a. infsum f (B a)) A = infsum f (\<Union>a\<in>A. B a)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>A. infsum f (B a)) = infsum f (\<Union> (B ` A))
[PROOF STEP]
by (rule sym, rule infsumI)
     (use sum_has_sum[of A f B \<open>\<lambda>a. infsum f (B a)\<close>] assms in auto)


[STATEMENT]
lemma padic_no_zero_divisors:
assumes "prime p"
assumes "a \<in> carrier (padic_int p)"
assumes "b \<in>carrier (padic_int p)"
assumes "a \<noteq>\<zero>\<^bsub>padic_int p\<^esub> "
assumes "b \<noteq>\<zero>\<^bsub>padic_int p\<^esub> "
shows "a \<otimes>\<^bsub>padic_int p\<^esub> b \<noteq> \<zero>\<^bsub>padic_int p\<^esub> "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<otimes>\<^bsub>padic_int p\<^esub> b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<otimes>\<^bsub>padic_int p\<^esub> b = \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> False
[PROOF STEP]
assume C: "a \<otimes>\<^bsub>padic_int p\<^esub> b = \<zero>\<^bsub>padic_int p\<^esub>"
[PROOF STATE]
proof (state)
this:
a \<otimes>\<^bsub>padic_int p\<^esub> b = \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. a \<otimes>\<^bsub>padic_int p\<^esub> b = \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
have 0: "a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
proof(cases "a = \<zero>\<^bsub>padic_int p\<^esub>")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. a = \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
 2. a \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
a = \<zero>\<^bsub>padic_int p\<^esub>

goal (2 subgoals):
 1. a = \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
 2. a \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a = \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. a \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
a \<noteq> \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. a \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
have "\<not> b  \<noteq>\<zero>\<^bsub>padic_int p\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> False
[PROOF STEP]
assume "b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>"
[PROOF STATE]
proof (state)
this:
b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. b \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> False
[PROOF STEP]
have "padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) = (padic_val p a) + (padic_val p b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) = padic_val p a + padic_val p b
[PROOF STEP]
using False assms(1) assms(2) assms(3) assms(5) val_prod padic_int_simps
[PROOF STATE]
proof (prove)
using this:
a \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
prime p
a \<in> carrier (padic_int p)
b \<in> carrier (padic_int p)
b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
\<lbrakk>prime ?p; ?f \<in> padic_set ?p; ?g \<in> padic_set ?p; ?f \<noteq> padic_zero ?p; ?g \<noteq> padic_zero ?p\<rbrakk> \<Longrightarrow> padic_val ?p (padic_mult ?p ?f ?g) = padic_val ?p ?f + padic_val ?p ?g
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p

goal (1 subgoal):
 1. padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) = padic_val p a + padic_val p b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) = padic_val p a + padic_val p b

goal (1 subgoal):
 1. b \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) = padic_val p a + padic_val p b
[PROOF STEP]
have "padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) \<noteq> -1"
[PROOF STATE]
proof (prove)
using this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) = padic_val p a + padic_val p b

goal (1 subgoal):
 1. padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) \<noteq> - 1
[PROOF STEP]
using False \<open>b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>\<close> padic_val_def padic_int_simps
[PROOF STATE]
proof (prove)
using this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) = padic_val p a + padic_val p b
a \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
padic_val ?p ?f \<equiv> if ?f = padic_zero ?p then - 1 else int (LEAST k. ?f (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ Suc k)\<^esub>)
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p

goal (1 subgoal):
 1. padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) \<noteq> - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) \<noteq> - 1

goal (1 subgoal):
 1. b \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) \<noteq> - 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) \<noteq> - 1

goal (1 subgoal):
 1. False
[PROOF STEP]
using C padic_val_def padic_int_simps
[PROOF STATE]
proof (prove)
using this:
padic_val p (a \<otimes>\<^bsub>padic_int p\<^esub> b) \<noteq> - 1
a \<otimes>\<^bsub>padic_int p\<^esub> b = \<zero>\<^bsub>padic_int p\<^esub>
padic_val ?p ?f \<equiv> if ?f = padic_zero ?p then - 1 else int (LEAST k. ?f (Suc k) \<noteq> \<zero>\<^bsub>residue_ring (?p ^ Suc k)\<^esub>)
\<one>\<^bsub>padic_int ?p\<^esub> = padic_one ?p
\<zero>\<^bsub>padic_int ?p\<^esub> = padic_zero ?p
(\<oplus>\<^bsub>padic_int ?p\<^esub>) = padic_add ?p
(\<otimes>\<^bsub>padic_int ?p\<^esub>) = padic_mult ?p
carrier (padic_int ?p) = padic_set ?p

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. a \<noteq> \<zero>\<^bsub>padic_int p\<^esub> \<Longrightarrow> a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>

goal (1 subgoal):
 1. False
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
using "0" assms(4) assms(5)
[PROOF STATE]
proof (prove)
using this:
a = \<zero>\<^bsub>padic_int p\<^esub> \<or> b = \<zero>\<^bsub>padic_int p\<^esub>
a \<noteq> \<zero>\<^bsub>padic_int p\<^esub>
b \<noteq> \<zero>\<^bsub>padic_int p\<^esub>

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vifunion_vintersection_single: "B \<inter>\<^sub>\<circ> (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i) = (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. B \<inter>\<^sub>\<circ> f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<inter>\<^sub>\<circ> \<Union>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I) = \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. B \<inter>\<^sub>\<circ> f a) `\<^sub>\<circ> I)
[PROOF STEP]
by (force simp: vrange_VLambda vimage_VLambda_vrange_rep)


[STATEMENT]
lemma token_succeeds_alt_def:
  "token_succeeds x = (\<forall>\<^sub>\<infinity>n. token_run x n \<in> F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. token_succeeds x = (\<forall>\<^sub>\<infinity>n. token_run x n \<in> F)
[PROOF STEP]
unfolding token_succeeds_def MOST_nat_le le_iff_add
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>n. token_run x n \<in> F) = (\<exists>m. \<forall>n. (\<exists>c. n = m + c) \<longrightarrow> token_run x n \<in> F)
[PROOF STEP]
using token_stays_in_final_states
[PROOF STATE]
proof (prove)
using this:
token_run ?x ?n \<in> F \<Longrightarrow> token_run ?x (?n + ?m) \<in> F

goal (1 subgoal):
 1. (\<exists>n. token_run x n \<in> F) = (\<exists>m. \<forall>n. (\<exists>c. n = m + c) \<longrightarrow> token_run x n \<in> F)
[PROOF STEP]
by blast


[STATEMENT]
lemma polyfun_diff: (*COMPLEX_SUB_POLYFUN in HOL Light*)
  fixes x :: "'a::idom"
  assumes "1 \<le> n"
  shows "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) =
    (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - j - 1)) * x^j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have h: "bij_betw (\<lambda>(i,j). (j,i)) ((SIGMA i : atMost n. lessThan i)) (SIGMA j : lessThan n. {Suc j..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (\<lambda>(i, j). (j, i)) (Sigma {..n} lessThan) (SIGMA j:{..<n}. {Suc j..n})
[PROOF STEP]
by (auto simp: bij_betw_def inj_on_def)
[PROOF STATE]
proof (state)
this:
bij_betw (\<lambda>(i, j). (j, i)) (Sigma {..n} lessThan) (SIGMA j:{..<n}. {Suc j..n})

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have "(\<Sum>i\<le>n. a i * x^i) - (\<Sum>i\<le>n. a i * y^i) = (\<Sum>i\<le>n. a i * (x^i - y^i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (\<Sum>i\<le>n. a i * (x ^ i - y ^ i))
[PROOF STEP]
by (simp add: right_diff_distrib sum_subtractf)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (\<Sum>i\<le>n. a i * (x ^ i - y ^ i))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (\<Sum>i\<le>n. a i * (x ^ i - y ^ i))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y^(i - Suc j) * x^j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * (x ^ i - y ^ i)) = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y ^ (i - Suc j) * x ^ j))
[PROOF STEP]
by (simp add: power_diff_sumr2 mult.assoc)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. a i * (x ^ i - y ^ i)) = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. a i * (x ^ i - y ^ i)) = (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have "\<dots> = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y^(i - Suc j) * x^j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y ^ (i - Suc j) * x ^ j)) = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))
[PROOF STEP]
by (simp add: sum_distrib_left)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y ^ (i - Suc j) * x ^ j)) = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. a i * (x - y) * (\<Sum>j<i. y ^ (i - Suc j) * x ^ j)) = (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have "\<dots> = (\<Sum>(i,j) \<in> (SIGMA i : atMost n. lessThan i). a i * (x - y) * (y^(i - Suc j) * x^j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>(i, j)\<in>Sigma {..n} lessThan. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))
[PROOF STEP]
by (simp add: sum.Sigma)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>(i, j)\<in>Sigma {..n} lessThan. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. \<Sum>j<i. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>(i, j)\<in>Sigma {..n} lessThan. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have "\<dots> = (\<Sum>(j,i) \<in> (SIGMA j : lessThan n. {Suc j..n}). a i * (x - y) * (y^(i - Suc j) * x^j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(i, j)\<in>Sigma {..n} lessThan. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>(j, i)\<in>(SIGMA j:{..<n}. {Suc j..n}). a i * (x - y) * (y ^ (i - Suc j) * x ^ j))
[PROOF STEP]
by (auto simp: sum.reindex_bij_betw [OF h, symmetric] intro: sum.cong_simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, j)\<in>Sigma {..n} lessThan. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>(j, i)\<in>(SIGMA j:{..<n}. {Suc j..n}). a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(i, j)\<in>Sigma {..n} lessThan. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>(j, i)\<in>(SIGMA j:{..<n}. {Suc j..n}). a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have "\<dots> = (\<Sum>j<n. \<Sum>i=Suc j..n. a i * (x - y) * (y^(i - Suc j) * x^j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(j, i)\<in>(SIGMA j:{..<n}. {Suc j..n}). a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>j<n. \<Sum>i = Suc j..n. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))
[PROOF STEP]
by (simp add: sum.Sigma)
[PROOF STATE]
proof (state)
this:
(\<Sum>(j, i)\<in>(SIGMA j:{..<n}. {Suc j..n}). a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>j<n. \<Sum>i = Suc j..n. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>(j, i)\<in>(SIGMA j:{..<n}. {Suc j..n}). a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (\<Sum>j<n. \<Sum>i = Suc j..n. a i * (x - y) * (y ^ (i - Suc j) * x ^ j))

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
have "\<dots> = (x - y) * (\<Sum>j<n. (\<Sum>i=Suc j..n. a i * y^(i - j - 1)) * x^j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j<n. \<Sum>i = Suc j..n. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
by (simp add: sum_distrib_left mult_ac)
[PROOF STATE]
proof (state)
this:
(\<Sum>j<n. \<Sum>i = Suc j..n. a i * (x - y) * (y ^ (i - Suc j) * x ^ j)) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)

goal (1 subgoal):
 1. (\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<le>n. a i * x ^ i) - (\<Sum>i\<le>n. a i * y ^ i) = (x - y) * (\<Sum>j<n. (\<Sum>i = Suc j..n. a i * y ^ (i - j - 1)) * x ^ j)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma invertible_mat_1: "invertible (mat (1::'a::comm_ring_1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (mat (1::'a))
[PROOF STEP]
unfolding invertible_iff_is_unit
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat (1::'a)) dvd (1::'a)
[PROOF STEP]
by simp


[STATEMENT]
lemma poly_complex_to_real: "(poly (complex_of_int_poly p) (complex_of_real x) = 0)
  = (poly (real_of_int_poly p) x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (complex_of_int_poly p) (complex_of_real x) = 0) = (poly (real_of_int_poly p) x = 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (poly (complex_of_int_poly p) (complex_of_real x) = 0) = (poly (real_of_int_poly p) x = 0)
[PROOF STEP]
have id: "of_int = complex_of_real o real_of_int"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_int = complex_of_real \<circ> real_of_int
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
complex_of_int = complex_of_real \<circ> real_of_int

goal (1 subgoal):
 1. (poly (complex_of_int_poly p) (complex_of_real x) = 0) = (poly (real_of_int_poly p) x = 0)
[PROOF STEP]
interpret cr: semiring_hom complex_of_real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. semiring_hom complex_of_real
[PROOF STEP]
by (unfold_locales, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (poly (complex_of_int_poly p) (complex_of_real x) = 0) = (poly (real_of_int_poly p) x = 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (complex_of_int_poly p) (complex_of_real x) = 0) = (poly (real_of_int_poly p) x = 0)
[PROOF STEP]
unfolding id
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (poly (map_poly (complex_of_real \<circ> real_of_int) p) (complex_of_real x) = 0) = (poly (real_of_int_poly p) x = 0)
[PROOF STEP]
by (subst map_poly_map_poly[symmetric], force+)
[PROOF STATE]
proof (state)
this:
(poly (complex_of_int_poly p) (complex_of_real x) = 0) = (poly (real_of_int_poly p) x = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma source_list_lens: "\<S>\<^bsub>list_lens i\<^esub> = {xs. length xs > i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<S>\<^bsub>list_lens i\<^esub> = {xs. i < length xs}
[PROOF STEP]
apply (auto simp add: lens_source_def list_lens_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>v s'. i < length (list_augment s' i v)
 2. \<And>x. i < length x \<Longrightarrow> \<exists>v s'. x = list_augment s' i v
[PROOF STEP]
apply (metis length_list_augment_1 length_list_augment_2 lessI not_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. i < length x \<Longrightarrow> \<exists>v s'. x = list_augment s' i v
[PROOF STEP]
apply (metis list_augment_idem)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma SafeGlobMono_preserves_vacant:
  assumes "\<forall>t'\<le>t. zcount (c_glob c0 q) t' = 0"
    and   "(\<lambda>c0 c1. SafeGlobMono c0 c1)\<^sup>*\<^sup>* c0 c1"
  shows   "\<forall>t'\<le>t. zcount (c_glob c1 q) t' = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>t'\<le>t. zcount (c_glob c1 q) t' = 0
[PROOF STEP]
using assms(2,1)
[PROOF STATE]
proof (prove)
using this:
SafeGlobMono\<^sup>*\<^sup>* c0 c1
\<forall>t'\<le>t. zcount (c_glob c0 q) t' = 0

goal (1 subgoal):
 1. \<forall>t'\<le>t. zcount (c_glob c1 q) t' = 0
[PROOF STEP]
by (induct rule: rtranclp_induct)(auto simp: SafeGlobMono_def vacant_upto_def)


[STATEMENT]
lemma replicate_iff:
    "(\<forall>i<length l. l ! i = R) \<longleftrightarrow> (\<exists> n. l = replicate n R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<length l. l ! i = R) = (\<exists>n. l = replicate n R)
[PROOF STEP]
by auto (metis (full_types) in_set_conv_nth replicate_eqI)


[STATEMENT]
lemma AD_aux:
  "AllowPortFromTo a b po \<in> set p \<Longrightarrow>  DenyAllFromTo c d \<in> set p \<Longrightarrow>
   allNetsDistinct p \<Longrightarrow>  singleCombinators p \<Longrightarrow> a \<noteq> c \<or> b \<noteq> d \<Longrightarrow>
   dom (C (AllowPortFromTo a b po)) \<inter> dom (C (DenyAllFromTo c d)) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>AllowPortFromTo a b po \<in> set p; DenyAllFromTo c d \<in> set p; allNetsDistinct p; singleCombinators p; a \<noteq> c \<or> b \<noteq> d\<rbrakk> \<Longrightarrow> dom (C (AllowPortFromTo a b po)) \<inter> dom (C (DenyAllFromTo c d)) = {}
[PROOF STEP]
by (rule aux26,rule_tac x ="AllowPortFromTo a b po" and y = "DenyAllFromTo c d" in tND, auto)


[STATEMENT]
lemma face_of_slice: "\<lbrakk>F face_of S; convex T\<rbrakk> \<Longrightarrow> (F \<inter> T) face_of (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F face_of S; convex T\<rbrakk> \<Longrightarrow> F \<inter> T face_of S \<inter> T
[PROOF STEP]
unfolding face_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<subseteq> S \<and> convex F \<and> (\<forall>a\<in>S. \<forall>b\<in>S. \<forall>x\<in>F. x \<in> open_segment a b \<longrightarrow> a \<in> F \<and> b \<in> F); convex T\<rbrakk> \<Longrightarrow> F \<inter> T \<subseteq> S \<inter> T \<and> convex (F \<inter> T) \<and> (\<forall>a\<in>S \<inter> T. \<forall>b\<in>S \<inter> T. \<forall>x\<in>F \<inter> T. x \<in> open_segment a b \<longrightarrow> a \<in> F \<inter> T \<and> b \<in> F \<inter> T)
[PROOF STEP]
by (blast intro: convex_Int)


[STATEMENT]
lemma mset_le_not_refl: "\<not> M < (M::'a::preorder multiset)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> M < M
[PROOF STEP]
by (fact less_irrefl)


[STATEMENT]
theorem yoneda_lemma:
    shows "bij_betw \<T> (F.SET a) {\<tau>. natural_transformation Cop.comp S (Y a) F \<tau>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw \<T> (F.SET a) {\<tau>. natural_transformation (\<cdot>\<^sup>o\<^sup>p) (\<cdot>\<^sub>S) (Y a) F \<tau>}
[PROOF STEP]
using \<E>\<tau>_mapsto \<T>_is_injection \<T>_is_surjection
[PROOF STATE]
proof (prove)
using this:
natural_transformation (\<cdot>\<^sup>o\<^sup>p) (\<cdot>\<^sub>S) (Y a) F ?\<tau> \<Longrightarrow> \<E> ?\<tau> \<in> F.SET a
?e \<in> F.SET a \<Longrightarrow> natural_transformation (\<cdot>\<^sup>o\<^sup>p) (\<cdot>\<^sub>S) (Y a) F (\<T> ?e)
?e \<in> F.SET a \<Longrightarrow> \<E> (\<T> ?e) = ?e
natural_transformation (\<cdot>\<^sup>o\<^sup>p) (\<cdot>\<^sub>S) (Y a) F ?\<tau> \<Longrightarrow> \<T> (\<E> ?\<tau>) = ?\<tau>

goal (1 subgoal):
 1. bij_betw \<T> (F.SET a) {\<tau>. natural_transformation (\<cdot>\<^sup>o\<^sup>p) (\<cdot>\<^sub>S) (Y a) F \<tau>}
[PROOF STEP]
by (intro bij_betwI, auto)


[STATEMENT]
lemma from_nat_to_nat_greatest:
  fixes A::"'a::{zero}^'columns::{mod_type}^'rows::{mod_type}"
  shows "from_nat (Suc (to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A))) = (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat (Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A))) = (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows)
[PROOF STEP]
unfolding Suc_eq_plus1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1) = (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows)
[PROOF STEP]
unfolding to_nat_1[where ?'a='rows, symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + mod_type_class.to_nat (1::'rows)) = (GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows)
[PROOF STEP]
unfolding add_to_nat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mod_type_class.from_nat (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + mod_type_class.to_nat (1::'rows)) = mod_type_class.from_nat (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + mod_type_class.to_nat (1::'rows))
[PROOF STEP]
..


[STATEMENT]
lemma scalar_prod_left_unit[simp]: assumes v: "(v :: 'a :: semiring_1 vec) \<in> carrier_vec n" and i: "i < n"
  shows "unit_vec n i \<bullet> v = v $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_vec n i \<bullet> v = v $ i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unit_vec n i \<bullet> v = v $ i
[PROOF STEP]
let ?f = "\<lambda> k. unit_vec n i $ k * v $ k"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unit_vec n i \<bullet> v = v $ i
[PROOF STEP]
have id: "(\<Sum>k\<in>{0..<n}. ?f k) = unit_vec n i $ i * v $ i + (\<Sum>k\<in>{0..<n} - {i}. ?f k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k = 0..<n. unit_vec n i $ k * v $ k) = unit_vec n i $ i * v $ i + (\<Sum>k\<in>{0..<n} - {i}. unit_vec n i $ k * v $ k)
[PROOF STEP]
by (rule sum.remove, insert i, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. unit_vec n i $ k * v $ k) = unit_vec n i $ i * v $ i + (\<Sum>k\<in>{0..<n} - {i}. unit_vec n i $ k * v $ k)

goal (1 subgoal):
 1. unit_vec n i \<bullet> v = v $ i
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k = 0..<n. unit_vec n i $ k * v $ k) = unit_vec n i $ i * v $ i + (\<Sum>k\<in>{0..<n} - {i}. unit_vec n i $ k * v $ k)

goal (1 subgoal):
 1. unit_vec n i \<bullet> v = v $ i
[PROOF STEP]
have "(\<Sum> k\<in>{0..<n} - {i}. ?f k) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>{0..<n} - {i}. unit_vec n i $ k * v $ k) = (0::'a)
[PROOF STEP]
by (rule sum.neutral, insert i, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<in>{0..<n} - {i}. unit_vec n i $ k * v $ k) = (0::'a)

goal (1 subgoal):
 1. unit_vec n i \<bullet> v = v $ i
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k = 0..<n. unit_vec n i $ k * v $ k) = unit_vec n i $ i * v $ i + (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<n. unit_vec n i $ k * v $ k) = unit_vec n i $ i * v $ i + (0::'a)

goal (1 subgoal):
 1. unit_vec n i \<bullet> v = v $ i
[PROOF STEP]
unfolding scalar_prod_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<n. unit_vec n i $ k * v $ k) = unit_vec n i $ i * v $ i + (0::'a)

goal (1 subgoal):
 1. (\<Sum>ia = 0..<dim_vec v. unit_vec n i $ ia * v $ ia) = v $ i
[PROOF STEP]
using i v
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k = 0..<n. unit_vec n i $ k * v $ k) = unit_vec n i $ i * v $ i + (0::'a)
i < n
v \<in> carrier_vec n

goal (1 subgoal):
 1. (\<Sum>ia = 0..<dim_vec v. unit_vec n i $ ia * v $ ia) = v $ i
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unit_vec n i \<bullet> v = v $ i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma holomorphic_on_chain_UNIV:
  "g holomorphic_on UNIV \<Longrightarrow> f holomorphic_on s\<Longrightarrow>
    (\<lambda>x. g (f x)) holomorphic_on s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g holomorphic_on UNIV; f holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) holomorphic_on s
[PROOF STEP]
using holomorphic_on_compose_gen[of f s g UNIV]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>f holomorphic_on s; g holomorphic_on UNIV; f ` s \<subseteq> UNIV\<rbrakk> \<Longrightarrow> g \<circ> f holomorphic_on s

goal (1 subgoal):
 1. \<lbrakk>g holomorphic_on UNIV; f holomorphic_on s\<rbrakk> \<Longrightarrow> (\<lambda>x. g (f x)) holomorphic_on s
[PROOF STEP]
by (simp add: o_def)


[STATEMENT]
lemma zmod_imp_ZMod:
  assumes modeq: "a mod m = b mod m"
  shows "ZMod m a = ZMod m b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
have "ZMod m a = ZMod m (a mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZMod m a = ZMod m (a mod m)
[PROOF STEP]
by (rule ZMod_mod)
[PROOF STATE]
proof (state)
this:
ZMod m a = ZMod m (a mod m)

goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ZMod m a = ZMod m (a mod m)

goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
have "\<dots> = ZMod m (b mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZMod m (a mod m) = ZMod m (b mod m)
[PROOF STEP]
by (simp add: modeq[symmetric])
[PROOF STATE]
proof (state)
this:
ZMod m (a mod m) = ZMod m (b mod m)

goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ZMod m (a mod m) = ZMod m (b mod m)

goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
have "\<dots> = ZMod m b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZMod m (b mod m) = ZMod m b
[PROOF STEP]
by (rule ZMod_mod[symmetric])
[PROOF STATE]
proof (state)
this:
ZMod m (b mod m) = ZMod m b

goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ZMod m a = ZMod m b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
ZMod m a = ZMod m b

goal (1 subgoal):
 1. ZMod m a = ZMod m b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
ZMod m a = ZMod m b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma forall_vector_2: "(\<forall>v::'a::zero^2. P v) \<longleftrightarrow> (\<forall>x y. P(vector[x, y]))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>v. P v) = (\<forall>x y. P (vector [x, y]))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<forall>x y. P (vector [x, y]) \<Longrightarrow> P v
[PROOF STEP]
apply (erule_tac x="v$1" in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<forall>y. P (vector [v $ 1, y]) \<Longrightarrow> P v
[PROOF STEP]
apply (erule_tac x="v$2" in allE)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. P (vector [v $ 1, v $ 2]) \<Longrightarrow> P v
[PROOF STEP]
apply (subgoal_tac "vector [v$1, v$2] = v")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>v. \<lbrakk>P (vector [v $ 1, v $ 2]); vector [v $ 1, v $ 2] = v\<rbrakk> \<Longrightarrow> P v
 2. \<And>v. P (vector [v $ 1, v $ 2]) \<Longrightarrow> vector [v $ 1, v $ 2] = v
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. P (vector [v $ 1, v $ 2]) \<Longrightarrow> vector [v $ 1, v $ 2] = v
[PROOF STEP]
apply (vector vector_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. P (\<chi>i. if i = 1 then v $ 1 else ((\<lambda>x. 0::'a)(2 := v $ 2)) i) \<Longrightarrow> \<forall>i. i \<noteq> 2 \<longrightarrow> i \<noteq> 1 \<longrightarrow> v $ i = (0::'a)
[PROOF STEP]
apply (simp add: forall_2)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma invertible_matrix_mult_right_rank:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
    and Q::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
  assumes invertible_Q: "invertible Q"
  shows "rank (A**Q) = rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
define TQ where "TQ x = Q *v x" for x
[PROOF STATE]
proof (state)
this:
TQ ?x = Q *v ?x

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
define TA where "TA x = A *v x" for x
[PROOF STATE]
proof (state)
this:
TA ?x = A *v ?x

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
define TAQ where "TAQ x = (A**Q) *v x" for x
[PROOF STATE]
proof (state)
this:
TAQ ?x = A ** Q *v ?x

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
have "invertible_lf ((*s)) ((*s)) TQ"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible_lf (*s) (*s) TQ
[PROOF STEP]
using invertible_matrix_imp_invertible_lf[OF invertible_Q]
[PROOF STATE]
proof (prove)
using this:
invertible_lf (*s) (*s) ((*v) Q)

goal (1 subgoal):
 1. invertible_lf (*s) (*s) TQ
[PROOF STEP]
unfolding TQ_def
[PROOF STATE]
proof (prove)
using this:
invertible_lf (*s) (*s) ((*v) Q)

goal (1 subgoal):
 1. invertible_lf (*s) (*s) ((*v) Q)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
invertible_lf (*s) (*s) TQ

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
hence bij_TQ: "bij TQ"
[PROOF STATE]
proof (prove)
using this:
invertible_lf (*s) (*s) TQ

goal (1 subgoal):
 1. bij TQ
[PROOF STEP]
using invertible_imp_bijective
[PROOF STATE]
proof (prove)
using this:
invertible_lf (*s) (*s) TQ
invertible_lf ?scaleB ?scaleC ?f \<Longrightarrow> bij ?f

goal (1 subgoal):
 1. bij TQ
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
bij TQ

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
have "range TAQ = range (TA \<circ> TQ)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range TAQ = range (TA \<circ> TQ)
[PROOF STEP]
unfolding TQ_def TA_def TAQ_def o_def matrix_vector_mul_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range ((*v) (A ** Q)) = range ((*v) (A ** Q))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
range TAQ = range (TA \<circ> TQ)

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
range TAQ = range (TA \<circ> TQ)

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
have "... = TA `(range TQ)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. range (TA \<circ> TQ) = TA ` range TQ
[PROOF STEP]
unfolding fun.set_map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TA ` range TQ = TA ` range TQ
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
range (TA \<circ> TQ) = TA ` range TQ

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
range (TA \<circ> TQ) = TA ` range TQ

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
have "... = TA ` (UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. TA ` range TQ = range TA
[PROOF STEP]
using bij_is_surj[OF bij_TQ]
[PROOF STATE]
proof (prove)
using this:
surj TQ

goal (1 subgoal):
 1. TA ` range TQ = range TA
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
TA ` range TQ = range TA

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
range TAQ = range TA
[PROOF STEP]
have "range TAQ = range TA"
[PROOF STATE]
proof (prove)
using this:
range TAQ = range TA

goal (1 subgoal):
 1. range TAQ = range TA
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
range TAQ = range TA

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
range TAQ = range TA

goal (1 subgoal):
 1. rank (A ** Q) = rank A
[PROOF STEP]
unfolding rank_eq_dim_image
[PROOF STATE]
proof (prove)
using this:
range TAQ = range TA

goal (1 subgoal):
 1. vec.dim (range ((*v) (A ** Q))) = vec.dim (range ((*v) A))
[PROOF STEP]
using TAQ_def [abs_def] TA_def [abs_def]
[PROOF STATE]
proof (prove)
using this:
range TAQ = range TA
TAQ \<equiv> (*v) (A ** Q)
TA \<equiv> (*v) A

goal (1 subgoal):
 1. vec.dim (range ((*v) (A ** Q))) = vec.dim (range ((*v) A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rank (A ** Q) = rank A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma \<beta>_boundedness_le:
  fixes m :: int
  assumes "m \<le> k x" "x \<in> X"
  shows "\<exists> U \<subseteq> \<R>. \<Union> U = {u \<in> V. u x \<le> m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x \<le> real_of_int m}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x \<le> real_of_int m}
[PROOF STEP]
from \<beta>_boundedness_lt[OF assms] \<beta>_boundedness_eq[OF assms]
[PROOF STATE]
proof (chain)
picking this:
\<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x < real_of_int m}
\<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x = real_of_int m}
[PROOF STEP]
obtain U1 U2 where A:
    "U1 \<subseteq> \<R>" "\<Union> U1 = {u \<in> V. u x  < m}" "U2 \<subseteq> \<R>" "\<Union> U2 = {u \<in> V. u x = m}"
[PROOF STATE]
proof (prove)
using this:
\<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x < real_of_int m}
\<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x = real_of_int m}

goal (1 subgoal):
 1. (\<And>U1 U2. \<lbrakk>U1 \<subseteq> \<R>; \<Union> U1 = {u \<in> V. u x < real_of_int m}; U2 \<subseteq> \<R>; \<Union> U2 = {u \<in> V. u x = real_of_int m}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
U1 \<subseteq> \<R>
\<Union> U1 = {u \<in> V. u x < real_of_int m}
U2 \<subseteq> \<R>
\<Union> U2 = {u \<in> V. u x = real_of_int m}

goal (1 subgoal):
 1. \<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x \<le> real_of_int m}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
U1 \<subseteq> \<R>
\<Union> U1 = {u \<in> V. u x < real_of_int m}
U2 \<subseteq> \<R>
\<Union> U2 = {u \<in> V. u x = real_of_int m}
[PROOF STEP]
have "{u \<in> V. u x \<le> m} = \<Union> (U1 \<union> U2)" "U1 \<union> U2 \<subseteq> \<R>"
[PROOF STATE]
proof (prove)
using this:
U1 \<subseteq> \<R>
\<Union> U1 = {u \<in> V. u x < real_of_int m}
U2 \<subseteq> \<R>
\<Union> U2 = {u \<in> V. u x = real_of_int m}

goal (1 subgoal):
 1. {u \<in> V. u x \<le> real_of_int m} = \<Union> (U1 \<union> U2) &&& U1 \<union> U2 \<subseteq> \<R>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{u \<in> V. u x \<le> real_of_int m} = \<Union> (U1 \<union> U2)
U1 \<union> U2 \<subseteq> \<R>

goal (1 subgoal):
 1. \<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x \<le> real_of_int m}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{u \<in> V. u x \<le> real_of_int m} = \<Union> (U1 \<union> U2)
U1 \<union> U2 \<subseteq> \<R>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{u \<in> V. u x \<le> real_of_int m} = \<Union> (U1 \<union> U2)
U1 \<union> U2 \<subseteq> \<R>

goal (1 subgoal):
 1. \<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x \<le> real_of_int m}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>U\<subseteq>\<R>. \<Union> U = {u \<in> V. u x \<le> real_of_int m}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_list_dementum:
  assumes "sorted (xs@[n])"
  shows "\<sigma> (dementum (xs@[n])) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<sigma> (dementum (xs @ [n])) = n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<sigma> (dementum (xs @ [n])) = n
[PROOF STEP]
have "dementum (xs@[n]) = (xs@[n]) - (0 # xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dementum (xs @ [n]) = xs @ [n] - (0 # xs)
[PROOF STEP]
by (rule nth_equalityI; simp add: nth_append dementum_def nth_Cons')
[PROOF STATE]
proof (state)
this:
dementum (xs @ [n]) = xs @ [n] - (0 # xs)

goal (1 subgoal):
 1. \<sigma> (dementum (xs @ [n])) = n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
dementum (xs @ [n]) = xs @ [n] - (0 # xs)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dementum (xs @ [n]) = xs @ [n] - (0 # xs)

goal (1 subgoal):
 1. \<sigma> (dementum (xs @ [n])) = n
[PROOF STEP]
by (simp add: sum_list_minus sorted_imp_pointwise assms)
[PROOF STATE]
proof (state)
this:
\<sigma> (dementum (xs @ [n])) = n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma base_case_sgas_alt_R:
  fixes p:: "real poly"
  fixes qs:: "real poly list"
  assumes len1: "length qs = 1"
  assumes nonzero: "p \<noteq> 0"
  shows "set (characterize_consistent_signs_at_roots p qs) \<subseteq> {[1], [0], [- 1]}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots p qs) \<subseteq> {[1], [0], [- 1]}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots p qs) \<subseteq> {[1], [0], [- 1]}
[PROOF STEP]
have ex_q: "\<exists>(q::real poly). qs = [q]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q. qs = [q]
[PROOF STEP]
using len1
[PROOF STATE]
proof (prove)
using this:
length qs = 1

goal (1 subgoal):
 1. \<exists>q. qs = [q]
[PROOF STEP]
using length_Suc_conv[of qs 0]
[PROOF STATE]
proof (prove)
using this:
length qs = 1
(length qs = Suc 0) = (\<exists>y ys. qs = y # ys \<and> length ys = 0)

goal (1 subgoal):
 1. \<exists>q. qs = [q]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>q. qs = [q]

goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots p qs) \<subseteq> {[1], [0], [- 1]}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>q. qs = [q]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<exists>q. qs = [q]

goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots p qs) \<subseteq> {[1], [0], [- 1]}
[PROOF STEP]
using base_case_sgas_R nonzero
[PROOF STATE]
proof (prove)
using this:
\<exists>q. qs = [q]
?p \<noteq> 0 \<Longrightarrow> set (characterize_consistent_signs_at_roots ?p [?q]) \<subseteq> {[1], [0], [- 1]}
p \<noteq> 0

goal (1 subgoal):
 1. set (characterize_consistent_signs_at_roots p qs) \<subseteq> {[1], [0], [- 1]}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set (characterize_consistent_signs_at_roots p qs) \<subseteq> {[1], [0], [- 1]}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_respects_domain_and_range_permutation:
  "(\<lambda>f. bij_betw f A B) respects domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>f. bij_betw f A B) respects domain_and_range_permutation A B
[PROOF STEP]
proof (rule congruentI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
fix f f'
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
assume "(f, f') \<in> domain_and_range_permutation A B"
[PROOF STATE]
proof (state)
this:
(f, f') \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
(f, f') \<in> domain_and_range_permutation A B
[PROOF STEP]
obtain p\<^sub>A p\<^sub>B where "p\<^sub>A permutes A" "p\<^sub>B permutes B"
    and "\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))" and "f' \<in> A \<rightarrow>\<^sub>E B"
[PROOF STATE]
proof (prove)
using this:
(f, f') \<in> domain_and_range_permutation A B

goal (1 subgoal):
 1. (\<And>p\<^sub>A p\<^sub>B. \<lbrakk>p\<^sub>A permutes A; p\<^sub>B permutes B; \<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x)); f' \<in> A \<rightarrow>\<^sub>E B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding domain_and_range_permutation_def
[PROOF STATE]
proof (prove)
using this:
(f, f') \<in> {(f, f'). (f, f') \<in> (A \<rightarrow>\<^sub>E B) \<times> (A \<rightarrow>\<^sub>E B) \<and> (\<exists>p\<^sub>A p\<^sub>B. p\<^sub>A permutes A \<and> p\<^sub>B permutes B \<and> (\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))))}

goal (1 subgoal):
 1. (\<And>p\<^sub>A p\<^sub>B. \<lbrakk>p\<^sub>A permutes A; p\<^sub>B permutes B; \<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x)); f' \<in> A \<rightarrow>\<^sub>E B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p\<^sub>A permutes A
p\<^sub>B permutes B
\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))
f' \<in> A \<rightarrow>\<^sub>E B

goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
have "bij_betw f A B \<longleftrightarrow> bij_betw (p\<^sub>B o f' o p\<^sub>A) A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f A B = bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B
[PROOF STEP]
using \<open>\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))\<close> bij_betw_congI
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>A. f x = p\<^sub>B (f' (p\<^sub>A x))
\<lbrakk>bij_betw ?f ?A ?A'; \<forall>a\<in>?A. ?f a = ?g a\<rbrakk> \<Longrightarrow> bij_betw ?g ?A ?A'

goal (1 subgoal):
 1. bij_betw f A B = bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
bij_betw f A B = bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B

goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bij_betw f A B = bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B

goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
have "... \<longleftrightarrow> bij_betw (p\<^sub>B o f')  A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B = bij_betw (p\<^sub>B \<circ> f') A B
[PROOF STEP]
using \<open>p\<^sub>A permutes A\<close>
[PROOF STATE]
proof (prove)
using this:
p\<^sub>A permutes A

goal (1 subgoal):
 1. bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B = bij_betw (p\<^sub>B \<circ> f') A B
[PROOF STEP]
by (auto intro!: bij_betw_comp_iff[symmetric] permutes_imp_bij)
[PROOF STATE]
proof (state)
this:
bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B = bij_betw (p\<^sub>B \<circ> f') A B

goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bij_betw (p\<^sub>B \<circ> f' \<circ> p\<^sub>A) A B = bij_betw (p\<^sub>B \<circ> f') A B

goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
have "... \<longleftrightarrow> bij_betw f' A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (p\<^sub>B \<circ> f') A B = bij_betw f' A B
[PROOF STEP]
using \<open>f' \<in> A \<rightarrow>\<^sub>E B\<close> \<open>p\<^sub>B permutes B\<close>
[PROOF STATE]
proof (prove)
using this:
f' \<in> A \<rightarrow>\<^sub>E B
p\<^sub>B permutes B

goal (1 subgoal):
 1. bij_betw (p\<^sub>B \<circ> f') A B = bij_betw f' A B
[PROOF STEP]
by (auto intro!: bij_betw_comp_iff2[symmetric] permutes_imp_bij)
[PROOF STATE]
proof (state)
this:
bij_betw (p\<^sub>B \<circ> f') A B = bij_betw f' A B

goal (1 subgoal):
 1. \<And>y z. (y, z) \<in> domain_and_range_permutation A B \<Longrightarrow> bij_betw y A B = bij_betw z A B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bij_betw f A B = bij_betw f' A B
[PROOF STEP]
show "bij_betw f A B \<longleftrightarrow> bij_betw f' A B"
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B = bij_betw f' A B

goal (1 subgoal):
 1. bij_betw f A B = bij_betw f' A B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
bij_betw f A B = bij_betw f' A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SA_units_not_zero:
  assumes "f \<in> Units (SA n)"
  shows "f \<noteq> \<zero>\<^bsub> SA n\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<noteq> \<zero>\<^bsub>SA n\<^esub>
[PROOF STEP]
using SA_one_not_zero
[PROOF STATE]
proof (prove)
using this:
\<one>\<^bsub>SA ?n\<^esub> \<noteq> \<zero>\<^bsub>SA ?n\<^esub>

goal (1 subgoal):
 1. f \<noteq> \<zero>\<^bsub>SA n\<^esub>
[PROOF STEP]
by (metis assms padic_fields.SA_is_ring padic_fields_axioms ring.ring_in_Units_imp_not_zero)


[STATEMENT]
lemma mpoly_coeff_power_0: "coeff (p ^ n) 0 = coeff p 0 ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeff (p ^ n) 0 = MPoly_Type.coeff p 0 ^ n
[PROOF STEP]
by (induction n) (auto simp: mpoly_coeff_times_0 mpoly_coeff_1)


[STATEMENT]
lemma llength_prepend[simp]: "llength (prepend xs ys) = length xs + llength ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llength (prepend xs ys) = enat (length xs) + llength ys
[PROOF STEP]
by (induct xs) (auto simp: enat_0 iadd_Suc eSuc_enat[symmetric])


[STATEMENT]
lemma P_sup_lfp:
  assumes Q: "sup_continuous Q"
  assumes f: "f \<in> measurable St M"
  assumes Q_m: "\<And>P. Measurable.pred M P \<Longrightarrow> Measurable.pred M (Q P)"
  shows "P_sup s (\<lambda>x. lfp Q (f x)) = (\<Squnion>i. P_sup s (\<lambda>x. (Q ^^ i) \<bottom> (f x)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_sup s (\<lambda>x. lfp Q (f x)) = (\<Squnion>i. P_sup s (\<lambda>x. (Q ^^ i) \<bottom> (f x)))
[PROOF STEP]
unfolding sup_continuous_lfp[OF Q]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_sup s (\<lambda>x. (\<Squnion>i. (Q ^^ i) \<bottom>) (f x)) = (\<Squnion>i. P_sup s (\<lambda>x. (Q ^^ i) \<bottom> (f x)))
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_sup s (\<lambda>x. \<exists>fa. (Q ^^ fa) \<bottom> (f x)) = (\<Squnion>i. P_sup s (\<lambda>x. (Q ^^ i) \<bottom> (f x)))
[PROOF STEP]
proof (rule P_sup_SUP)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. incseq (\<lambda>i x. (Q ^^ i) \<bottom> (f x))
 2. \<And>fa. Measurable.pred St (\<lambda>x. (Q ^^ fa) \<bottom> (f x))
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. incseq (\<lambda>i x. (Q ^^ i) \<bottom> (f x))
 2. \<And>fa. Measurable.pred St (\<lambda>x. (Q ^^ fa) \<bottom> (f x))
[PROOF STEP]
show "Measurable.pred St (\<lambda>x. (Q ^^ i) \<bottom> (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred St (\<lambda>x. (Q ^^ i) \<bottom> (f x))
[PROOF STEP]
apply (intro measurable_compose[OF f])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Measurable.pred M ((Q ^^ i) \<bottom>)
[PROOF STEP]
by (induct i) (auto intro!: Q_m)
[PROOF STATE]
proof (state)
this:
Measurable.pred St (\<lambda>x. (Q ^^ i) \<bottom> (f x))

goal (1 subgoal):
 1. incseq (\<lambda>i x. (Q ^^ i) \<bottom> (f x))
[PROOF STEP]
qed (intro mono_funpow sup_continuous_mono[OF Q] mono_compose[where f=f])


[STATEMENT]
lemma length_repeat: "length (repeat n a) = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (repeat n a) = n
[PROOF STEP]
proof(induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. length (repeat 0 a) = 0
 2. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. length (repeat 0 a) = 0
 2. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (repeat 0 a) = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (repeat 0 a) = 0

goal (1 subgoal):
 1. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
case (Suc a)
[PROOF STATE]
proof (state)
this:
length (repeat a a) = a

goal (1 subgoal):
 1. \<And>n. length (repeat n a) = n \<Longrightarrow> length (repeat (Suc n) a) = Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (repeat a a) = a
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
length (repeat a a) = a

goal (1 subgoal):
 1. length (repeat (Suc a) a) = Suc a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (repeat (Suc a) a) = Suc a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pi_approx2':
  fixes n :: nat assumes n: "even n" and "n > 0" and "k \<le> 46*n - 1"
  shows   "\<bar>pi - pi_approx2 n\<bar> \<le> inverse (2^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>pi - pi_approx2 n\<bar> \<le> inverse (2 ^ k)
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
k \<le> 46 * n - 1

goal (1 subgoal):
 1. \<bar>pi - pi_approx2 n\<bar> \<le> inverse (2 ^ k)
[PROOF STEP]
by (intro order.trans[OF pi_approx2[OF assms(1,2)]]) (simp_all add: field_simps)