[STATEMENT]
lemma thermostat:
  assumes "a > 0" and "0 < Tmin" and "Tmax < L"
  shows "\<lceil>\<lambda>s. Tmin \<le> s$1 \<and> s$1 \<le> Tmax \<and> s$4 = 0\<rceil> \<le> wp
  (LOOP
    \<comment> \<open>control\<close>
    ((2 ::= (\<lambda>s. 0));(3 ::= (\<lambda>s. s$1));
    (IF (\<lambda>s. s$4 = 0 \<and> s$3 \<le> Tmin + 1) THEN (4 ::= (\<lambda>s.1)) ELSE
    (IF (\<lambda>s. s$4 = 1 \<and> s$3 \<ge> Tmax - 1) THEN (4 ::= (\<lambda>s.0)) ELSE skip));
    \<comment> \<open>dynamics\<close>
    (IF (\<lambda>s. s$4 = 0) THEN (x\<acute>= f a 0 & (\<lambda>s. s$2 \<le> - (ln (Tmin/s$3))/a))
    ELSE (x\<acute>= f a L & (\<lambda>s. s$2 \<le> - (ln ((L-Tmax)/(L-s$3)))/a))) )
  INV (\<lambda>s. Tmin \<le>s$1 \<and> s$1 \<le> Tmax \<and> (s$4 = 0 \<or> s$4 = 1)))
  \<lceil>\<lambda>s. Tmin \<le> s$1 \<and> s$1 \<le> Tmax\<rceil>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lceil>\<lambda>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> s $ 4 = 0\<rceil> \<subseteq> wp (LOOP (2 ::= (\<lambda>s. 0)) ; (3 ::= (\<lambda>s. s $ 1)) ; (IF (\<lambda>s. s $ 4 = 0 \<and> s $ 3 \<le> Tmin + 1) THEN (4 ::= (\<lambda>s. 1)) ELSE IF (\<lambda>s. s $ 4 = 1 \<and> Tmax - 1 \<le> s $ 3) THEN (4 ::= (\<lambda>s. 0)) ELSE skip) ; (IF (\<lambda>s. s $ 4 = 0) THEN x\<acute>=\<lambda>t. f a 0 & \<lambda>s. s $ 2 \<le> - ln (Tmin / s $ 3) / a on \<lambda>s. {t. 0 \<le> t} UNIV @ 0 ELSE x\<acute>=\<lambda>t. f a L & \<lambda>s. s $ 2 \<le> - ln ((L - Tmax) / (L - s $ 3)) / a on \<lambda>s. {t. 0 \<le> t} UNIV @ 0) INV (\<lambda>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> (s $ 4 = 0 \<or> s $ 4 = 1)) ) \<lceil>\<lambda>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax\<rceil>
[PROOF STEP]
apply(rule wp_loopI, simp_all add: fbox_temp_dyn[OF assms(1)])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> (s $ 4 = 0 \<or> s $ 4 = 1) \<longrightarrow> (s $ 4 = 0 \<longrightarrow> s $ 1 \<le> Tmin + 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax)) \<and> (s $ 4 = 0 \<and> s $ 1 \<le> Tmin + 1 \<or> (s $ 4 = 1 \<longrightarrow> Tmax - 1 \<le> s $ 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 1 \<and> Tmax - 1 \<le> s $ 1 \<or> (s $ 4 = 0 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 0 \<or> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax))))
[PROOF STEP]
using temp_dyn_up_real_arith[OF assms(1) _ _ assms(3), of Tmin]
    and temp_dyn_down_real_arith[OF assms(1,2), of _ Tmax]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> L - Tmax \<le> exp (- (a \<cdot> ?t)) \<cdot> (L - ?T)
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> L - exp (- (a \<cdot> ?t)) \<cdot> (L - ?T) \<le> Tmax
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> Tmin \<le> L - exp (- (a \<cdot> ?t)) \<cdot> (L - ?T)
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln (Tmin / ?T) / a)\<rbrakk> \<Longrightarrow> Tmin \<le> exp (- a \<cdot> ?t) \<cdot> ?T
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?t; \<forall>\<tau>\<in>{0..?t}. \<tau> \<le> - (ln (Tmin / ?T) / a)\<rbrakk> \<Longrightarrow> exp (- a \<cdot> ?t) \<cdot> ?T \<le> Tmax

goal (1 subgoal):
 1. \<forall>s. Tmin \<le> s $ 1 \<and> s $ 1 \<le> Tmax \<and> (s $ 4 = 0 \<or> s $ 4 = 1) \<longrightarrow> (s $ 4 = 0 \<longrightarrow> s $ 1 \<le> Tmin + 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax)) \<and> (s $ 4 = 0 \<and> s $ 1 \<le> Tmin + 1 \<or> (s $ 4 = 1 \<longrightarrow> Tmax - 1 \<le> s $ 1 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 1 \<and> Tmax - 1 \<le> s $ 1 \<or> (s $ 4 = 0 \<longrightarrow> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln (Tmin / s $ 1) / a)) \<longrightarrow> Tmin \<le> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<and> exp (- (a \<cdot> t)) \<cdot> s $ 1 \<le> Tmax)) \<and> (s $ 4 = 0 \<or> (\<forall>t\<ge>0. (\<forall>\<tau>. 0 \<le> \<tau> \<and> \<tau> \<le> t \<longrightarrow> \<tau> \<le> - (ln ((L - Tmax) / (L - s $ 1)) / a)) \<longrightarrow> Tmin \<le> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<and> L - exp (- (a \<cdot> t)) \<cdot> (L - s $ 1) \<le> Tmax))))
[PROOF STEP]
by auto


[STATEMENT]
lemma llist_all2_inf_llist [simp]:
  "llist_all2 P (inf_llist f) (inf_llist g) \<longleftrightarrow> (\<forall>n. P (f n) (g n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. llist_all2 P (inf_llist f) (inf_llist g) = (\<forall>n. P (f n) (g n))
[PROOF STEP]
by(simp add: llist_all2_conv_lzip)


[STATEMENT]
lemma sum_less_suminf: "summable f \<Longrightarrow> (\<And>m. m\<ge>n \<Longrightarrow> 0 < f m) \<Longrightarrow> sum f {..<n} < suminf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>m. n \<le> m \<Longrightarrow> (0::'a) < f m\<rbrakk> \<Longrightarrow> sum f {..<n} < suminf f
[PROOF STEP]
using sum_less_suminf2[of n n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>summable f; \<And>m. n \<le> m \<Longrightarrow> (0::'a) \<le> f m; n \<le> n; (0::'a) < f n\<rbrakk> \<Longrightarrow> sum f {..<n} < suminf f

goal (1 subgoal):
 1. \<lbrakk>summable f; \<And>m. n \<le> m \<Longrightarrow> (0::'a) < f m\<rbrakk> \<Longrightarrow> sum f {..<n} < suminf f
[PROOF STEP]
by (simp add: less_imp_le)


[STATEMENT]
lemma isDERIV_inner_iff:
  assumes "length xs = length ys"
  shows "isDERIV i (inner_floatariths xs ys) vs \<longleftrightarrow>
    (\<forall>k < length xs. isDERIV i (xs ! k) vs) \<and> (\<forall>k < length ys. isDERIV i (ys ! k) vs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isDERIV i (inner_floatariths xs ys) vs = ((\<forall>k<length xs. isDERIV i (xs ! k) vs) \<and> (\<forall>k<length ys. isDERIV i (ys ! k) vs))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length xs = length ys

goal (1 subgoal):
 1. isDERIV i (inner_floatariths xs ys) vs = ((\<forall>k<length xs. isDERIV i (xs ! k) vs) \<and> (\<forall>k<length ys. isDERIV i (ys ! k) vs))
[PROOF STEP]
by (induction xs ys rule: list_induct2) (auto simp: nth_Cons split: nat.splits)


[STATEMENT]
theorem while_rule2:
  "[| P s;
      !!s. [| P s; b s  |] ==> P (c s) \<and> (c s, s) \<in> r;
      !!s. [| P s; \<not> b s  |] ==> Q s;
      wf r |] ==>
   Q (while b c s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>P s; \<And>s. \<lbrakk>P s; b s\<rbrakk> \<Longrightarrow> P (c s) \<and> (c s, s) \<in> r; \<And>s. \<lbrakk>P s; \<not> b s\<rbrakk> \<Longrightarrow> Q s; wf r\<rbrakk> \<Longrightarrow> Q (while b c s)
[PROOF STEP]
using while_rule[of P]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>P ?s; \<And>s. \<lbrakk>P s; ?b s\<rbrakk> \<Longrightarrow> P (?c s); \<And>s. \<lbrakk>P s; \<not> ?b s\<rbrakk> \<Longrightarrow> ?Q s; wf ?r; \<And>s. \<lbrakk>P s; ?b s\<rbrakk> \<Longrightarrow> (?c s, s) \<in> ?r\<rbrakk> \<Longrightarrow> ?Q (while ?b ?c ?s)

goal (1 subgoal):
 1. \<lbrakk>P s; \<And>s. \<lbrakk>P s; b s\<rbrakk> \<Longrightarrow> P (c s) \<and> (c s, s) \<in> r; \<And>s. \<lbrakk>P s; \<not> b s\<rbrakk> \<Longrightarrow> Q s; wf r\<rbrakk> \<Longrightarrow> Q (while b c s)
[PROOF STEP]
by metis


[STATEMENT]
theorem HEndPhase0_valueChosen:
  assumes act: "HEndPhase0 s s' q"
  and vc: "valueChosen s v"
  and v_input: "v \<in> Inputs"
  and inv1: "Inv1 s"
  shows "valueChosen s' v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
from vc
[PROOF STATE]
proof (chain)
picking this:
valueChosen s v
[PROOF STEP]
obtain b p D where
        asm1: "b \<in> (UN p. Ballot p)"
    and asm2: "D\<in>MajoritySet"
    and asm3: "maxBalInp s b v"
    and asm4: "\<forall>d\<in>D.  b \<le> bal(disk s d p)
                   \<and>(\<forall>q.(   phase s q = 1
                          \<and> b \<le>mbal(dblock s q)
                          \<and> hasRead s q d p
                         ) \<longrightarrow> (\<exists>br\<in>blocksRead s q d. b \<le> bal(block br)))"
[PROOF STATE]
proof (prove)
using this:
valueChosen s v

goal (1 subgoal):
 1. (\<And>b D p. \<lbrakk>b \<in> \<Union> (range Ballot); D \<in> MajoritySet; maxBalInp s b v; \<forall>d\<in>D. b \<le> bal (disk s d p) \<and> (\<forall>q. phase s q = 1 \<and> b \<le> mbal (dblock s q) \<and> hasRead s q d p \<longrightarrow> (\<exists>br\<in>blocksRead s q d. b \<le> bal (block br)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto simp add: valueChosen_def)
[PROOF STATE]
proof (state)
this:
b \<in> \<Union> (range Ballot)
D \<in> MajoritySet
maxBalInp s b v
\<forall>d\<in>D. b \<le> bal (disk s d p) \<and> (\<forall>q. phase s q = 1 \<and> b \<le> mbal (dblock s q) \<and> hasRead s q d p \<longrightarrow> (\<exists>br\<in>blocksRead s q d. b \<le> bal (block br)))

goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
from HEndPhase0_maxBalInp[OF act asm3 inv1]
[PROOF STATE]
proof (chain)
picking this:
maxBalInp s' b v
[PROOF STEP]
have "maxBalInp s' b v"
[PROOF STATE]
proof (prove)
using this:
maxBalInp s' b v

goal (1 subgoal):
 1. maxBalInp s' b v
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
maxBalInp s' b v

goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
with HEndPhase0_valueChosen2[OF act asm4] asm1 asm2
[PROOF STATE]
proof (chain)
picking this:
\<forall>d\<in>D. b \<le> bal (disk s' d p) \<and> (\<forall>q. phase s' q = 1 \<and> b \<le> mbal (dblock s' q) \<and> hasRead s' q d p \<longrightarrow> (\<exists>br\<in>blocksRead s' q d. b \<le> bal (block br)))
b \<in> \<Union> (range Ballot)
D \<in> MajoritySet
maxBalInp s' b v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>d\<in>D. b \<le> bal (disk s' d p) \<and> (\<forall>q. phase s' q = 1 \<and> b \<le> mbal (dblock s' q) \<and> hasRead s' q d p \<longrightarrow> (\<exists>br\<in>blocksRead s' q d. b \<le> bal (block br)))
b \<in> \<Union> (range Ballot)
D \<in> MajoritySet
maxBalInp s' b v

goal (1 subgoal):
 1. valueChosen s' v
[PROOF STEP]
by(auto simp add: valueChosen_def)
[PROOF STATE]
proof (state)
this:
valueChosen s' v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma distinct_rels_alt':
  "distinct_relations t \<longleftrightarrow> (let multi=relations_mset t in \<forall>x\<in># multi. count multi x = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct_relations t = (let multi = relations_mset t in \<forall>x\<in>#multi. count multi x = 1)
[PROOF STEP]
using distinct_relations_def inorder_eq_mset distinct_alt
[PROOF STATE]
proof (prove)
using this:
distinct_relations ?t = distinct (inorder ?t)
mset (inorder ?t) = relations_mset ?t
(\<forall>x\<in>#mset ?xs. count (mset ?xs) x = 1) = distinct ?xs

goal (1 subgoal):
 1. distinct_relations t = (let multi = relations_mset t in \<forall>x\<in>#multi. count multi x = 1)
[PROOF STEP]
by metis


[STATEMENT]
lemma dghm_dag_Rel_ArrMap_app_vrange[dg_cs_simps]:
  assumes "T : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B"
  shows "\<R>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<D>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<D>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<D>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
T : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B
[PROOF STEP]
interpret T: arr_Rel \<alpha> T
[PROOF STATE]
proof (prove)
using this:
T : A \<mapsto>\<^bsub>dg_Rel \<alpha>\<^esub> B

goal (1 subgoal):
 1. arr_Rel \<alpha> T
[PROOF STEP]
by (simp add: dg_Rel_is_arrD)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<D>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
from dg_Rel_is_arrD(1)[OF assms]
[PROOF STATE]
proof (chain)
picking this:
arr_Rel \<alpha> T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
arr_Rel \<alpha> T

goal (1 subgoal):
 1. \<R>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<D>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)
[PROOF STEP]
by (cs_concl cs_simp: dg_Rel_cs_simps V_cs_simps converse_Rel_components(1))
[PROOF STATE]
proof (state)
this:
\<R>\<^sub>\<circ> (\<dagger>\<^sub>D\<^sub>G\<^sub>.\<^sub>R\<^sub>e\<^sub>l \<alpha>\<lparr>ArrMap\<rparr>\<lparr>T\<rparr>\<lparr>ArrVal\<rparr>) = \<D>\<^sub>\<circ> (T\<lparr>ArrVal\<rparr>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Re_stereographic:
  shows "Re (2 * z / (1 + z * cnj z)) = 2 * Re z / (1 + (cmod z)\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re (2 * z / (1 + z * cnj z)) = 2 * Re z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
using one_plus_square_neq_zero
[PROOF STATE]
proof (prove)
using this:
1 + (cor ?x)\<^sup>2 \<noteq> 0

goal (1 subgoal):
 1. Re (2 * z / (1 + z * cnj z)) = 2 * Re z / (1 + (cmod z)\<^sup>2)
[PROOF STEP]
by (subst complex_mult_cnj_cmod, subst Re_divide_real) (auto simp add: power2_eq_square)


[STATEMENT]
lemma Joints_imp_length_eq: "xs \<in> Joints XS \<Longrightarrow> length xs = length XS"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> Joints XS \<Longrightarrow> length xs = length XS
[PROOF STEP]
by (auto simp: Joints_def valuate_def)


[STATEMENT]
lemma exp_fdiffs:
  "diffs (\<lambda>n. inverse (fact n)) = (\<lambda>n. inverse (fact n :: 'a::{real_normed_field,banach}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diffs (\<lambda>n. inverse (fact n)) = (\<lambda>n. inverse (fact n))
[PROOF STEP]
by (simp add: diffs_def mult_ac nonzero_inverse_mult_distrib nonzero_of_real_inverse
      del: mult_Suc of_nat_Suc)


[STATEMENT]
lemma finite_vars_of_a_eq :
  assumes "finite (Aexp.vars e1)"
  assumes "finite (Aexp.vars e2)"
  shows   "finite (vars (\<lambda> \<sigma>. e1 \<sigma> = e2 \<sigma>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (Bexp.vars (\<lambda>\<sigma>. e1 \<sigma> = e2 \<sigma>))
[PROOF STEP]
using assms vars_of_eq_a[of e1 e2]
[PROOF STATE]
proof (prove)
using this:
finite (Aexp.vars e1)
finite (Aexp.vars e2)
Bexp.vars (\<lambda>\<sigma>. e1 \<sigma> = e2 \<sigma>) \<subseteq> Aexp.vars e1 \<union> Aexp.vars e2

goal (1 subgoal):
 1. finite (Bexp.vars (\<lambda>\<sigma>. e1 \<sigma> = e2 \<sigma>))
[PROOF STEP]
by (rule_tac rev_finite_subset, auto)


[STATEMENT]
lemma sort_mergesort_by_rel:
  "sort = mergesort_by_rel (\<le>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sort = mergesort_by_rel (\<le>)
[PROOF STEP]
apply (rule ext, rule properties_for_sort)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. mset (mergesort_by_rel (\<le>) x) = mset x
 2. \<And>x. sorted (mergesort_by_rel (\<le>) x)
[PROOF STEP]
apply(simp_all add: sorted_mergesort_by_rel)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma suc_not_zero:
  assumes "to_nat a + 1 \<noteq> CARD('a)"
  shows "a+1 \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + (1::'a) \<noteq> (0::'a)
[PROOF STEP]
proof (rule ccontr, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a + (1::'a) = (0::'a) \<Longrightarrow> False
[PROOF STEP]
assume a_plus_one_zero: "a + 1 = 0"
[PROOF STATE]
proof (state)
this:
a + (1::'a) = (0::'a)

goal (1 subgoal):
 1. a + (1::'a) = (0::'a) \<Longrightarrow> False
[PROOF STEP]
hence rep_eq_card: "Rep a + 1 = CARD('a)"
[PROOF STATE]
proof (prove)
using this:
a + (1::'a) = (0::'a)

goal (1 subgoal):
 1. Rep a + 1 = int CARD('a)
[PROOF STEP]
using assms to_nat_0 Suc_eq_plus1 Suc_lessI Zero_not_Suc to_nat_less_card to_nat_suc
[PROOF STATE]
proof (prove)
using this:
a + (1::'a) = (0::'a)
mod_type_class.to_nat a + 1 \<noteq> CARD('a)
mod_type_class.to_nat (0::'a) = 0
Suc ?n = ?n + 1
\<lbrakk>?m < ?n; Suc ?m \<noteq> ?n\<rbrakk> \<Longrightarrow> Suc ?m < ?n
0 \<noteq> Suc ?m
mod_type_class.to_nat ?j < CARD('a)
mod_type_class.to_nat ?x + 1 < CARD('a) \<Longrightarrow> mod_type_class.to_nat (?x + (1::'a)) = mod_type_class.to_nat ?x + 1

goal (1 subgoal):
 1. Rep a + 1 = int CARD('a)
[PROOF STEP]
by (metis (opaque_lifting, mono_tags))
[PROOF STATE]
proof (state)
this:
Rep a + 1 = int CARD('a)

goal (1 subgoal):
 1. a + (1::'a) = (0::'a) \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Rep a + 1 = int CARD('a)

goal (1 subgoal):
 1. a + (1::'a) = (0::'a) \<Longrightarrow> False
[PROOF STEP]
have "Rep a + 1 < CARD('a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep a + 1 < int CARD('a)
[PROOF STEP]
using Abs'_0 Rep_1 Suc_eq_plus1 Suc_lessI Suc_neq_Zero add_def' assms
    rep_eq_card to_nat_0 to_nat_less_card to_nat_suc
[PROOF STATE]
proof (prove)
using this:
Abs' (int CARD('a)) = (0::'a)
Rep (1::'a) = 1
Suc ?n = ?n + 1
\<lbrakk>?m < ?n; Suc ?m \<noteq> ?n\<rbrakk> \<Longrightarrow> Suc ?m < ?n
Suc ?m = 0 \<Longrightarrow> ?R
?x + ?y = Abs' (Rep ?x + Rep ?y)
mod_type_class.to_nat a + 1 \<noteq> CARD('a)
Rep a + 1 = int CARD('a)
mod_type_class.to_nat (0::'a) = 0
mod_type_class.to_nat ?j < CARD('a)
mod_type_class.to_nat ?x + 1 < CARD('a) \<Longrightarrow> mod_type_class.to_nat (?x + (1::'a)) = mod_type_class.to_nat ?x + 1

goal (1 subgoal):
 1. Rep a + 1 < int CARD('a)
[PROOF STEP]
by (metis (opaque_lifting, mono_tags))
[PROOF STATE]
proof (state)
this:
Rep a + 1 < int CARD('a)

goal (1 subgoal):
 1. a + (1::'a) = (0::'a) \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Rep a + 1 = int CARD('a)
Rep a + 1 < int CARD('a)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
Rep a + 1 = int CARD('a)
Rep a + 1 < int CARD('a)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma map_plus[simp]: "map (plus n) [i ..< j] = [i + n ..< j + n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((+) n) [i..<j] = [i + n..<j + n]
[PROOF STEP]
proof (induct n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. map ((+) 0) [i..<j] = [i + 0..<j + 0]
 2. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. map ((+) 0) [i..<j] = [i + 0..<j + 0]
 2. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((+) 0) [i..<j] = [i + 0..<j + 0]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map ((+) 0) [i..<j] = [i + 0..<j + 0]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
map ((+) n) [i..<j] = [i + n..<j + n]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
have "map (plus (Suc n)) [i ..< j] = map (Suc \<circ> plus n) [i ..< j]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((+) (Suc n)) [i..<j] = map (Suc \<circ> (+) n) [i..<j]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map ((+) (Suc n)) [i..<j] = map (Suc \<circ> (+) n) [i..<j]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map ((+) (Suc n)) [i..<j] = map (Suc \<circ> (+) n) [i..<j]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
have "\<dots> = (map Suc \<circ> map (plus n)) [i ..< j]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (Suc \<circ> (+) n) [i..<j] = (map Suc \<circ> map ((+) n)) [i..<j]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map (Suc \<circ> (+) n) [i..<j] = (map Suc \<circ> map ((+) n)) [i..<j]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map (Suc \<circ> (+) n) [i..<j] = (map Suc \<circ> map ((+) n)) [i..<j]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
have "\<dots> = map Suc (map (plus n) [i ..< j])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map Suc \<circ> map ((+) n)) [i..<j] = map Suc (map ((+) n) [i..<j])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(map Suc \<circ> map ((+) n)) [i..<j] = map Suc (map ((+) n) [i..<j])

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(map Suc \<circ> map ((+) n)) [i..<j] = map Suc (map ((+) n) [i..<j])

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
have "\<dots> = map Suc [i + n ..< j + n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map Suc (map ((+) n) [i..<j]) = map Suc [i + n..<j + n]
[PROOF STEP]
unfolding Suc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map Suc [i + n..<j + n] = map Suc [i + n..<j + n]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map Suc (map ((+) n) [i..<j]) = map Suc [i + n..<j + n]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map Suc (map ((+) n) [i..<j]) = map Suc [i + n..<j + n]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
have "\<dots> = [Suc (i + n) ..< Suc (j + n)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map Suc [i + n..<j + n] = [Suc (i + n)..<Suc (j + n)]
[PROOF STEP]
unfolding map_Suc_upt
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [Suc (i + n)..<Suc (j + n)] = [Suc (i + n)..<Suc (j + n)]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
map Suc [i + n..<j + n] = [Suc (i + n)..<Suc (j + n)]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map Suc [i + n..<j + n] = [Suc (i + n)..<Suc (j + n)]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
have "\<dots> = [i + Suc n ..< j + Suc n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [Suc (i + n)..<Suc (j + n)] = [i + Suc n..<j + Suc n]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[Suc (i + n)..<Suc (j + n)] = [i + Suc n..<j + Suc n]

goal (1 subgoal):
 1. \<And>n. map ((+) n) [i..<j] = [i + n..<j + n] \<Longrightarrow> map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]

goal (1 subgoal):
 1. map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]
[PROOF STEP]
by this
[PROOF STATE]
proof (state)
this:
map ((+) (Suc n)) [i..<j] = [i + Suc n..<j + Suc n]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma translation_inverse_subset:
  assumes "((\<lambda>x. - a + x) ` V) \<le> (S :: 'n::ab_group_add set)"
  shows "V \<le> ((\<lambda>x. a + x) ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
assume "x \<in> V"
[PROOF STATE]
proof (state)
this:
x \<in> V

goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> V
[PROOF STEP]
have "x-a \<in> S"
[PROOF STATE]
proof (prove)
using this:
x \<in> V

goal (1 subgoal):
 1. x - a \<in> S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> V
(+) (- a) ` V \<subseteq> S

goal (1 subgoal):
 1. x - a \<in> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x - a \<in> S

goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x - a \<in> S
[PROOF STEP]
have "x \<in> {a + v |v. v \<in> S}"
[PROOF STATE]
proof (prove)
using this:
x - a \<in> S

goal (1 subgoal):
 1. x \<in> {a + v |v. v \<in> S}
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x - a \<in> S \<Longrightarrow> \<exists>v. x = a + v \<and> v \<in> S
[PROOF STEP]
apply (rule exI[of _ "x-a"], simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
x \<in> {a + v |v. v \<in> S}

goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {a + v |v. v \<in> S}
[PROOF STEP]
have "x \<in> ((\<lambda>x. a+x) ` S)"
[PROOF STATE]
proof (prove)
using this:
x \<in> {a + v |v. v \<in> S}

goal (1 subgoal):
 1. x \<in> (+) a ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> (+) a ` S

goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?x2 \<in> V \<Longrightarrow> ?x2 \<in> (+) a ` S

goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x2 \<in> V \<Longrightarrow> ?x2 \<in> (+) a ` S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?x2 \<in> V \<Longrightarrow> ?x2 \<in> (+) a ` S

goal (1 subgoal):
 1. V \<subseteq> (+) a ` S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V \<subseteq> (+) a ` S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutes_inverses:
  shows "p (inv p x) = x"
    and "inv p (p x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p (inv p x) = x &&& inv p (p x) = x
[PROOF STEP]
using permutes_inv_o [unfolded fun_eq_iff o_def]
[PROOF STATE]
proof (prove)
using this:
\<forall>x. p (inv p x) = id x
\<forall>x. inv p (p x) = id x

goal (1 subgoal):
 1. p (inv p x) = x &&& inv p (p x) = x
[PROOF STEP]
by auto


[STATEMENT]
lemma O_subset_trans:
assumes "r O r \<subseteq> r"
shows "trans r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trans r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r O r \<subseteq> r

goal (1 subgoal):
 1. trans r
[PROOF STEP]
unfolding trans_def
[PROOF STATE]
proof (prove)
using this:
r O r \<subseteq> r

goal (1 subgoal):
 1. \<forall>x y z. (x, y) \<in> r \<longrightarrow> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r
[PROOF STEP]
by blast


[STATEMENT]
lemma clinear_times: "clinear (\<lambda>x. c * x)"
  for c :: "'a::complex_algebra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clinear ((*) c)
[PROOF STEP]
by (auto simp: clinearI distrib_left)


[STATEMENT]
lemma strict_mono_o: "strict_mono r \<Longrightarrow> strict_mono s \<Longrightarrow> strict_mono (r \<circ> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>strict_mono r; strict_mono s\<rbrakk> \<Longrightarrow> strict_mono (r \<circ> s)
[PROOF STEP]
unfolding strict_mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x y. x < y \<longrightarrow> r x < r y; \<forall>x y. x < y \<longrightarrow> s x < s y\<rbrakk> \<Longrightarrow> \<forall>x y. x < y \<longrightarrow> (r \<circ> s) x < (r \<circ> s) y
[PROOF STEP]
by simp


[STATEMENT]
lemma convolution_symm :
  fixes f g :: "'a::group_add \<Rightarrow> 'b::{comm_monoid_add,times}"
  shows "convolution f g
              = (\<lambda>x. \<Sum>y|y \<in> supp f \<and> -y + x \<in> supp g. (f y) * g (-y + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convolution f g = (\<lambda>x. \<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
fix x::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
define c1 c2 i S1 S2
    where "c1 y = (f (x - y)) * g y"
      and "c2 y = (f y) * g (-y + x)"
      and "i y = -y + x"
      and "S1 = {y. x - y \<in> supp f \<and> y \<in> supp g}"
      and "S2 = {y. y \<in> supp f \<and> -y + x \<in> supp g}"
    for y
[PROOF STATE]
proof (state)
this:
c1 ?y = f (x - ?y) * g ?y
c2 ?y = f ?y * g (- ?y + x)
i ?y = - ?y + x
S1 = {y. x - y \<in> supp f \<and> y \<in> supp g}
S2 = {y \<in> supp f. - y + x \<in> supp g}

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
have "inj_on i S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on i S2
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>S2. \<forall>y\<in>S2. i x = i y \<longrightarrow> x = y
[PROOF STEP]
using i_def
[PROOF STATE]
proof (prove)
using this:
i ?y = - ?y + x

goal (1 subgoal):
 1. \<forall>x\<in>S2. \<forall>y\<in>S2. i x = i y \<longrightarrow> x = y
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inj_on i S2

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
hence "(\<Sum>y\<in>(i ` S2). c1 y) = (\<Sum>y\<in>S2. (c1 \<circ> i) y)"
[PROOF STATE]
proof (prove)
using this:
inj_on i S2

goal (1 subgoal):
 1. sum c1 (i ` S2) = sum (c1 \<circ> i) S2
[PROOF STEP]
using sum.reindex
[PROOF STATE]
proof (prove)
using this:
inj_on i S2
inj_on ?h ?A \<Longrightarrow> sum ?g (?h ` ?A) = sum (?g \<circ> ?h) ?A

goal (1 subgoal):
 1. sum c1 (i ` S2) = sum (c1 \<circ> i) S2
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
sum c1 (i ` S2) = sum (c1 \<circ> i) S2

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sum c1 (i ` S2) = sum (c1 \<circ> i) S2

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
have S1_iS2: "S1 = i ` S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S1 = i ` S2
[PROOF STEP]
proof (rule seteqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
assume y_S1: "y \<in> S1"
[PROOF STATE]
proof (state)
this:
y \<in> S1

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
define z where "z = x - y"
[PROOF STATE]
proof (state)
this:
z = x - y

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
hence y_eq: "-z + x = y"
[PROOF STATE]
proof (prove)
using this:
z = x - y

goal (1 subgoal):
 1. - z + x = y
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
- z + x = y

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
hence "-z + x \<in> supp g"
[PROOF STATE]
proof (prove)
using this:
- z + x = y

goal (1 subgoal):
 1. - z + x \<in> supp g
[PROOF STEP]
using y_S1 S1_def
[PROOF STATE]
proof (prove)
using this:
- z + x = y
y \<in> S1
S1 = {y. x - y \<in> supp f \<and> y \<in> supp g}

goal (1 subgoal):
 1. - z + x \<in> supp g
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
- z + x \<in> supp g

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
- z + x \<in> supp g

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
have "z \<in> supp f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<in> supp f
[PROOF STEP]
using z_def y_S1 S1_def
[PROOF STATE]
proof (prove)
using this:
z = x - y
y \<in> S1
S1 = {y. x - y \<in> supp f \<and> y \<in> supp g}

goal (1 subgoal):
 1. z \<in> supp f
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
z \<in> supp f

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
- z + x \<in> supp g
z \<in> supp f
[PROOF STEP]
have "z \<in> S2"
[PROOF STATE]
proof (prove)
using this:
- z + x \<in> supp g
z \<in> supp f

goal (1 subgoal):
 1. z \<in> S2
[PROOF STEP]
using S2_def
[PROOF STATE]
proof (prove)
using this:
- z + x \<in> supp g
z \<in> supp f
S2 = {y \<in> supp f. - y + x \<in> supp g}

goal (1 subgoal):
 1. z \<in> S2
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
z \<in> S2

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
z \<in> S2

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
have "y = i z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = i z
[PROOF STEP]
using i_def [abs_def] y_eq
[PROOF STATE]
proof (prove)
using this:
i \<equiv> \<lambda>y. - y + x
- z + x = y

goal (1 subgoal):
 1. y = i z
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
y = i z

goal (2 subgoals):
 1. \<And>a. a \<in> S1 \<Longrightarrow> a \<in> i ` S2
 2. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
z \<in> S2
y = i z
[PROOF STEP]
show "y \<in> i ` S2"
[PROOF STATE]
proof (prove)
using this:
z \<in> S2
y = i z

goal (1 subgoal):
 1. y \<in> i ` S2
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
y \<in> i ` S2

goal (1 subgoal):
 1. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
fix y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
assume "y \<in> i ` S2"
[PROOF STATE]
proof (state)
this:
y \<in> i ` S2

goal (1 subgoal):
 1. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
y \<in> i ` S2
[PROOF STEP]
obtain z where z_S2: "z \<in> S2" and y_eq: "y = -z + x"
[PROOF STATE]
proof (prove)
using this:
y \<in> i ` S2

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> S2; y = - z + x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using i_def
[PROOF STATE]
proof (prove)
using this:
y \<in> i ` S2
i ?y = - ?y + x

goal (1 subgoal):
 1. (\<And>z. \<lbrakk>z \<in> S2; y = - z + x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
z \<in> S2
y = - z + x

goal (1 subgoal):
 1. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
from y_eq
[PROOF STATE]
proof (chain)
picking this:
y = - z + x
[PROOF STEP]
have "x - y = z"
[PROOF STATE]
proof (prove)
using this:
y = - z + x

goal (1 subgoal):
 1. x - y = z
[PROOF STEP]
by (auto simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
x - y = z

goal (1 subgoal):
 1. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
hence "x - y \<in> supp f \<and> y \<in> supp g"
[PROOF STATE]
proof (prove)
using this:
x - y = z

goal (1 subgoal):
 1. x - y \<in> supp f \<and> y \<in> supp g
[PROOF STEP]
using y_eq z_S2 S2_def
[PROOF STATE]
proof (prove)
using this:
x - y = z
y = - z + x
z \<in> S2
S2 = {y \<in> supp f. - y + x \<in> supp g}

goal (1 subgoal):
 1. x - y \<in> supp f \<and> y \<in> supp g
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x - y \<in> supp f \<and> y \<in> supp g

goal (1 subgoal):
 1. \<And>b. b \<in> i ` S2 \<Longrightarrow> b \<in> S1
[PROOF STEP]
thus "y \<in> S1"
[PROOF STATE]
proof (prove)
using this:
x - y \<in> supp f \<and> y \<in> supp g

goal (1 subgoal):
 1. y \<in> S1
[PROOF STEP]
using S1_def
[PROOF STATE]
proof (prove)
using this:
x - y \<in> supp f \<and> y \<in> supp g
S1 = {y. x - y \<in> supp f \<and> y \<in> supp g}

goal (1 subgoal):
 1. y \<in> S1
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
y \<in> S1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
S1 = i ` S2

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sum c1 (i ` S2) = sum (c1 \<circ> i) S2
S1 = i ` S2
[PROOF STEP]
have "(\<Sum>y\<in>S1. c1 y) = (\<Sum>y\<in>S2. (c1 \<circ> i) y)"
[PROOF STATE]
proof (prove)
using this:
sum c1 (i ` S2) = sum (c1 \<circ> i) S2
S1 = i ` S2

goal (1 subgoal):
 1. sum c1 S1 = sum (c1 \<circ> i) S2
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
sum c1 S1 = sum (c1 \<circ> i) S2

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
with i_def c1_def c2_def
[PROOF STATE]
proof (chain)
picking this:
i ?y = - ?y + x
c1 ?y = f (x - ?y) * g ?y
c2 ?y = f ?y * g (- ?y + x)
sum c1 S1 = sum (c1 \<circ> i) S2
[PROOF STEP]
have "(\<Sum>y\<in>S1. c1 y) = (\<Sum>y\<in>S2. c2 y)"
[PROOF STATE]
proof (prove)
using this:
i ?y = - ?y + x
c1 ?y = f (x - ?y) * g ?y
c2 ?y = f ?y * g (- ?y + x)
sum c1 S1 = sum (c1 \<circ> i) S2

goal (1 subgoal):
 1. sum c1 S1 = sum c2 S2
[PROOF STEP]
using diff_add_eq_diff_diff_swap[of x _ x]
[PROOF STATE]
proof (prove)
using this:
i ?y = - ?y + x
c1 ?y = f (x - ?y) * g ?y
c2 ?y = f ?y * g (- ?y + x)
sum c1 S1 = sum (c1 \<circ> i) S2
x - (?b + x) = x - x - ?b

goal (1 subgoal):
 1. sum c1 S1 = sum c2 S2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum c1 S1 = sum c2 S2

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
thus "convolution f g x
              = (\<Sum>y|y \<in> supp f \<and> -y + x \<in> supp g. (f y) * g (-y + x))"
[PROOF STATE]
proof (prove)
using this:
sum c1 S1 = sum c2 S2

goal (1 subgoal):
 1. convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
unfolding S1_def c1_def S2_def c2_def convolution_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>y | x - y \<in> supp f \<and> y \<in> supp g. f (x - y) * g y) = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))

goal (1 subgoal):
 1. (\<Sum>y | x - y \<in> supp f \<and> y \<in> supp g. f (x - y) * g y) = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
convolution f g x = (\<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ab_semigroup_add_0) sum_image_gen_0:
  assumes fin: "finite S"
  shows "sum_0 g S = sum_0 (\<lambda>y. sum_0 g {x. x \<in> S \<and> f x = y}) (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
have "{y. y\<in> f`S \<and> f x = y} = {f x}" if "x \<in> S" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y \<in> f ` S. f x = y} = {f x}
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x \<in> S

goal (1 subgoal):
 1. {y \<in> f ` S. f x = y} = {f x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x1 \<in> S \<Longrightarrow> {y \<in> f ` S. f ?x1 = y} = {f ?x1}

goal (1 subgoal):
 1. sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?x1 \<in> S \<Longrightarrow> {y \<in> f ` S. f ?x1 = y} = {f ?x1}
[PROOF STEP]
have "sum_0 g S = sum_0 (\<lambda>x. sum_0 (\<lambda>y. g x) {y. y\<in> f`S \<and> f x = y}) S"
[PROOF STATE]
proof (prove)
using this:
?x1 \<in> S \<Longrightarrow> {y \<in> f ` S. f ?x1 = y} = {f ?x1}

goal (1 subgoal):
 1. sum_0 g S = (\<Sum>x\<in>S. \<Sum>y | y \<in> f ` S \<and> f x = y. g x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sum_0 g S = (\<Sum>x\<in>S. \<Sum>y | y \<in> f ` S \<and> f x = y. g x)

goal (1 subgoal):
 1. sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_0 g S = (\<Sum>x\<in>S. \<Sum>y | y \<in> f ` S \<and> f x = y. g x)

goal (1 subgoal):
 1. sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
have "\<dots> = sum_0 (\<lambda>y. sum_0 g {x. x \<in> S \<and> f x = y}) (f ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>S. \<Sum>y | y \<in> f ` S \<and> f x = y. g x) = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
by (rule sum_0.swap_restrict [OF fin finite_imageI [OF fin]])
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>S. \<Sum>y | y \<in> f ` S \<and> f x = y. g x) = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})

goal (1 subgoal):
 1. sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})

goal (1 subgoal):
 1. sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_0 g S = (\<Sum>y\<in>f ` S. sum_0 g {x \<in> S. f x = y})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvdnumcoeff_trans:
  assumes gdg: "g dvd g'" and dgt':"dvdnumcoeff t g'"
  shows "dvdnumcoeff t g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dvdnumcoeff t g
[PROOF STEP]
using dgt' gdg
[PROOF STATE]
proof (prove)
using this:
dvdnumcoeff t g'
g dvd g'

goal (1 subgoal):
 1. dvdnumcoeff t g
[PROOF STEP]
by (induct t rule: dvdnumcoeff.induct) (simp_all add: gdg dvd_trans[OF gdg])


[STATEMENT]
lemma (in idom) idom_finite_lemma:
  assumes "\<forall>x. P x \<longrightarrow> (\<exists>n. n < length j \<and> x = j!n)"
  shows "finite {x. P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {x. P x}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {x. P x}
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. P x \<longrightarrow> (\<exists>n<length j. x = j ! n)
[PROOF STEP]
have "{x. P x} \<subseteq> set j"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. P x \<longrightarrow> (\<exists>n<length j. x = j ! n)

goal (1 subgoal):
 1. {x. P x} \<subseteq> set j
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. P x} \<subseteq> set j

goal (1 subgoal):
 1. finite {x. P x}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x. P x} \<subseteq> set j
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x. P x} \<subseteq> set j

goal (1 subgoal):
 1. finite {x. P x}
[PROOF STEP]
using finite_subset
[PROOF STATE]
proof (prove)
using this:
{x. P x} \<subseteq> set j
\<lbrakk>?A \<subseteq> ?B; finite ?B\<rbrakk> \<Longrightarrow> finite ?A

goal (1 subgoal):
 1. finite {x. P x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {x. P x}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reduced_GB_D3:
  assumes "is_reduced_GB G"
  shows "is_monic_set G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_monic_set G
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_reduced_GB G

goal (1 subgoal):
 1. is_monic_set G
[PROOF STEP]
unfolding is_reduced_GB_def
[PROOF STATE]
proof (prove)
using this:
is_Groebner_basis G \<and> is_auto_reduced G \<and> is_monic_set G \<and> 0 \<notin> G

goal (1 subgoal):
 1. is_monic_set G
[PROOF STEP]
by simp


[STATEMENT]
lemma asymptotics6: "eventually (\<lambda>x. hb / ln x powr (1 + e) < b/2) at_top"
  and asymptotics7: "eventually (\<lambda>x. hb / ln x powr (1 + e) < (1 - b) / 2) at_top"
  and asymptotics8: "eventually (\<lambda>x. x*(1 - b - hb / ln x powr (1 + e)) > 1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < b / 2 &&& \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < (1 - b) / 2 &&& \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < b / 2
 2. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < (1 - b) / 2
 3. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from bep
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
[PROOF STEP]
have A: "(\<lambda>x. hb / ln x powr (1 + e)) \<in> o(\<lambda>_. 1)"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb

goal (1 subgoal):
 1. (\<lambda>x. hb / ln x powr (1 + e)) \<in> o(\<lambda>_. 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. hb / ln x powr (1 + e)) \<in> o(\<lambda>_. 1)

goal (3 subgoals):
 1. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < b / 2
 2. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < (1 - b) / 2
 3. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from bep
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
[PROOF STEP]
have B: "b/3 > 0" and C: "(1 - b)/3 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb

goal (1 subgoal):
 1. 0 < b / 3 &&& 0 < (1 - b) / 3
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
0 < b / 3
0 < (1 - b) / 3

goal (3 subgoals):
 1. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < b / 2
 2. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < (1 - b) / 2
 3. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from landau_o.smallD[OF A B]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. norm (hb / ln x powr (1 + e)) \<le> b / 3 * norm 1
[PROOF STEP]
show "eventually (\<lambda>x. hb / ln x powr (1+e) < b/2) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. norm (hb / ln x powr (1 + e)) \<le> b / 3 * norm 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < b / 2
[PROOF STEP]
by eventually_elim (insert bep, simp)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < b / 2

goal (2 subgoals):
 1. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < (1 - b) / 2
 2. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from landau_o.smallD[OF A C]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. norm (hb / ln x powr (1 + e)) \<le> (1 - b) / 3 * norm 1
[PROOF STEP]
show "eventually (\<lambda>x. hb / ln x powr (1 + e) < (1 - b)/2) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. norm (hb / ln x powr (1 + e)) \<le> (1 - b) / 3 * norm 1

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < (1 - b) / 2
[PROOF STEP]
by eventually_elim (insert bep, simp)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. hb / ln x powr (1 + e) < (1 - b) / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from bep
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
[PROOF STEP]
have "(\<lambda>x. hb / ln x powr (1 + e)) \<in> o(\<lambda>_. 1)" "(1 - b) / 2 > 0"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb

goal (1 subgoal):
 1. (\<lambda>x. hb / ln x powr (1 + e)) \<in> o(\<lambda>_. 1) &&& 0 < (1 - b) / 2
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>x. hb / ln x powr (1 + e)) \<in> o(\<lambda>_. 1)
0 < (1 - b) / 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from landau_o.smallD[OF this] eventually_gt_at_top[of "1::real"]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. norm (hb / ln x powr (1 + e)) \<le> (1 - b) / 2 * norm 1
eventually ((<) 1) at_top
[PROOF STEP]
have A: "eventually (\<lambda>x. 1 - b - hb / ln x powr (1 + e) > 0) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. norm (hb / ln x powr (1 + e)) \<le> (1 - b) / 2 * norm 1
eventually ((<) 1) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < 1 - b - hb / ln x powr (1 + e)
[PROOF STEP]
by eventually_elim (insert bep, simp add: field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < 1 - b - hb / ln x powr (1 + e)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from bep
[PROOF STATE]
proof (chain)
picking this:
0 < b
b < 1
0 < e
0 < hb
[PROOF STEP]
have "(\<lambda>x. x * (1 - b - hb / ln x powr (1+e))) \<in> \<omega>(\<lambda>_. 1)" "(0::real) < 2"
[PROOF STATE]
proof (prove)
using this:
0 < b
b < 1
0 < e
0 < hb

goal (1 subgoal):
 1. (\<lambda>x. x * (1 - b - hb / ln x powr (1 + e))) \<in> \<omega>(\<lambda>_. 1) &&& 0 < 2
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * (1 - b - hb / ln x powr (1 + e))) \<in> \<omega>(\<lambda>_. 1)
0 < 2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
from landau_omega.smallD[OF this] A eventually_gt_at_top[of "0::real"]
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in at_top. 2 * norm 1 \<le> norm (x * (1 - b - hb / ln x powr (1 + e)))
\<forall>\<^sub>F x in at_top. 0 < 1 - b - hb / ln x powr (1 + e)
eventually ((<) 0) at_top
[PROOF STEP]
show "eventually (\<lambda>x. x*(1 - b - hb / ln x powr (1 + e)) > 1) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 2 * norm 1 \<le> norm (x * (1 - b - hb / ln x powr (1 + e)))
\<forall>\<^sub>F x in at_top. 0 < 1 - b - hb / ln x powr (1 + e)
eventually ((<) 0) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))
[PROOF STEP]
by eventually_elim (simp_all add: abs_mult)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 1 < x * (1 - b - hb / ln x powr (1 + e))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pell_square_solution_nat_aux:
  fixes x y :: nat
  assumes "D > 0" and "x ^ 2 = 1 + D * y ^ 2"
  shows "(x, y) = (1, 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < D
x\<^sup>2 = 1 + D * y\<^sup>2
[PROOF STEP]
have x_nz: "x > 0"
[PROOF STATE]
proof (prove)
using this:
0 < D
x\<^sup>2 = 1 + D * y\<^sup>2

goal (1 subgoal):
 1. 0 < x
[PROOF STEP]
by (auto intro!: Nat.gr0I)
[PROOF STATE]
proof (state)
this:
0 < x

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
from square_D
[PROOF STATE]
proof (chain)
picking this:
is_square D
[PROOF STEP]
obtain d where [simp]: "D = d\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
is_square D

goal (1 subgoal):
 1. (\<And>d. D = d\<^sup>2 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: is_nth_powerE)
[PROOF STATE]
proof (state)
this:
D = d\<^sup>2

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
have "int x ^ 2 = int (x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (int x)\<^sup>2 = int (x\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(int x)\<^sup>2 = int (x\<^sup>2)

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(int x)\<^sup>2 = int (x\<^sup>2)

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
note assms(2)
[PROOF STATE]
proof (state)
this:
x\<^sup>2 = 1 + D * y\<^sup>2

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

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
have "int (1 + D * y ^ 2) = 1 + int D * int y ^ 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int (1 + D * y\<^sup>2) = 1 + int D * (int y)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
int (1 + D * y\<^sup>2) = 1 + int D * (int y)\<^sup>2

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(int x)\<^sup>2 = 1 + int D * (int y)\<^sup>2
[PROOF STEP]
have "(int x + int d * int y) * (int x - int d * int y) = 1"
[PROOF STATE]
proof (prove)
using this:
(int x)\<^sup>2 = 1 + int D * (int y)\<^sup>2

goal (1 subgoal):
 1. (int x + int d * int y) * (int x - int d * int y) = 1
[PROOF STEP]
by (simp add: algebra_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
(int x + int d * int y) * (int x - int d * int y) = 1

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
hence *: "int x + int d * int y = 1 \<and> int x - int d * int y = 1"
[PROOF STATE]
proof (prove)
using this:
(int x + int d * int y) * (int x - int d * int y) = 1

goal (1 subgoal):
 1. int x + int d * int y = 1 \<and> int x - int d * int y = 1
[PROOF STEP]
using x_nz
[PROOF STATE]
proof (prove)
using this:
(int x + int d * int y) * (int x - int d * int y) = 1
0 < x

goal (1 subgoal):
 1. int x + int d * int y = 1 \<and> int x - int d * int y = 1
[PROOF STEP]
by (subst (asm) pos_zmult_eq_1_iff) (auto intro: add_pos_nonneg)
[PROOF STATE]
proof (state)
this:
int x + int d * int y = 1 \<and> int x - int d * int y = 1

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
int x + int d * int y = 1 \<and> int x - int d * int y = 1
[PROOF STEP]
have [simp]: "x = 1"
[PROOF STATE]
proof (prove)
using this:
int x + int d * int y = 1 \<and> int x - int d * int y = 1

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

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = 1

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
from * and assms(1)
[PROOF STATE]
proof (chain)
picking this:
int x + int d * int y = 1 \<and> int x - int d * int y = 1
0 < D
[PROOF STEP]
have "y = 0"
[PROOF STATE]
proof (prove)
using this:
int x + int d * int y = 1 \<and> int x - int d * int y = 1
0 < D

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

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = 1
y = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = 1
y = 0

goal (1 subgoal):
 1. (x, y) = (1, 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x, y) = (1, 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_weak_mono_all: fixes p :: "('v :: linorder,'a :: poly_carrier)poly"
  assumes p: "poly_weak_mono_all p"
  shows "poly_weak_mono p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_weak_mono p v
[PROOF STEP]
unfolding poly_weak_mono_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<alpha> \<beta>. (\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x) \<longrightarrow> pos_assign \<beta> \<longrightarrow> \<beta> v \<le> \<alpha> v \<longrightarrow> eval_poly \<beta> p \<le> eval_poly \<alpha> p
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha> \<beta>. \<lbrakk>\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x; pos_assign \<beta>; \<beta> v \<le> \<alpha> v\<rbrakk> \<Longrightarrow> eval_poly \<beta> p \<le> eval_poly \<alpha> p
[PROOF STEP]
fix \<alpha> \<beta> :: "('v,'a)assign"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha> \<beta>. \<lbrakk>\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x; pos_assign \<beta>; \<beta> v \<le> \<alpha> v\<rbrakk> \<Longrightarrow> eval_poly \<beta> p \<le> eval_poly \<alpha> p
[PROOF STEP]
assume all: "\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x"
[PROOF STATE]
proof (state)
this:
\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x

goal (1 subgoal):
 1. \<And>\<alpha> \<beta>. \<lbrakk>\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x; pos_assign \<beta>; \<beta> v \<le> \<alpha> v\<rbrakk> \<Longrightarrow> eval_poly \<beta> p \<le> eval_poly \<alpha> p
[PROOF STEP]
assume pos: "pos_assign \<beta>"
[PROOF STATE]
proof (state)
this:
pos_assign \<beta>

goal (1 subgoal):
 1. \<And>\<alpha> \<beta>. \<lbrakk>\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x; pos_assign \<beta>; \<beta> v \<le> \<alpha> v\<rbrakk> \<Longrightarrow> eval_poly \<beta> p \<le> eval_poly \<alpha> p
[PROOF STEP]
assume v: "\<alpha> v \<ge> \<beta> v"
[PROOF STATE]
proof (state)
this:
\<beta> v \<le> \<alpha> v

goal (1 subgoal):
 1. \<And>\<alpha> \<beta>. \<lbrakk>\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x; pos_assign \<beta>; \<beta> v \<le> \<alpha> v\<rbrakk> \<Longrightarrow> eval_poly \<beta> p \<le> eval_poly \<alpha> p
[PROOF STEP]
show "eval_poly \<alpha> p \<ge> eval_poly \<beta> p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_poly \<beta> p \<le> eval_poly \<alpha> p
[PROOF STEP]
proof (rule p[unfolded poly_weak_mono_all_def, rule_format, OF _ pos])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<beta> x \<le> \<alpha> x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<beta> x \<le> \<alpha> x
[PROOF STEP]
show "\<alpha> x \<ge> \<beta> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<beta> x \<le> \<alpha> x
[PROOF STEP]
using v all ge_refl[of "\<beta> x"]
[PROOF STATE]
proof (prove)
using this:
\<beta> v \<le> \<alpha> v
\<forall>x. v \<noteq> x \<longrightarrow> \<alpha> x = \<beta> x
\<beta> x \<le> \<beta> x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
eval_poly \<beta> p \<le> eval_poly \<alpha> p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma irreducible_hom_imp_irreducible:
    assumes irr: "irreducible (hom a)" shows "irreducible a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. irreducible a
[PROOF STEP]
proof (intro irreducibleI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. a \<noteq> (0::'a)
 2. \<not> a dvd (1::'a)
 3. \<And>aa b. a = aa * b \<Longrightarrow> aa dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
from irr
[PROOF STATE]
proof (chain)
picking this:
irreducible (hom a)
[PROOF STEP]
show "a \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
irreducible (hom a)

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

goal (2 subgoals):
 1. \<not> a dvd (1::'a)
 2. \<And>aa b. a = aa * b \<Longrightarrow> aa dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
from irr
[PROOF STATE]
proof (chain)
picking this:
irreducible (hom a)
[PROOF STEP]
show "\<not> a dvd 1"
[PROOF STATE]
proof (prove)
using this:
irreducible (hom a)

goal (1 subgoal):
 1. \<not> a dvd (1::'a)
[PROOF STEP]
by (auto dest: irreducible_not_unit)
[PROOF STATE]
proof (state)
this:
\<not> a dvd (1::'a)

goal (1 subgoal):
 1. \<And>aa b. a = aa * b \<Longrightarrow> aa dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
fix b c
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa b. a = aa * b \<Longrightarrow> aa dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
assume "a = b * c"
[PROOF STATE]
proof (state)
this:
a = b * c

goal (1 subgoal):
 1. \<And>aa b. a = aa * b \<Longrightarrow> aa dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a = b * c
[PROOF STEP]
have "hom a = hom b * hom c"
[PROOF STATE]
proof (prove)
using this:
a = b * c

goal (1 subgoal):
 1. hom a = hom b * hom c
[PROOF STEP]
by (simp add: hom_distribs)
[PROOF STATE]
proof (state)
this:
hom a = hom b * hom c

goal (1 subgoal):
 1. \<And>aa b. a = aa * b \<Longrightarrow> aa dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
with irr
[PROOF STATE]
proof (chain)
picking this:
irreducible (hom a)
hom a = hom b * hom c
[PROOF STEP]
have "hom b dvd 1 \<or> hom c dvd 1"
[PROOF STATE]
proof (prove)
using this:
irreducible (hom a)
hom a = hom b * hom c

goal (1 subgoal):
 1. hom b dvd (1::'b) \<or> hom c dvd (1::'b)
[PROOF STEP]
by (auto dest: irreducibleD)
[PROOF STATE]
proof (state)
this:
hom b dvd (1::'b) \<or> hom c dvd (1::'b)

goal (1 subgoal):
 1. \<And>aa b. a = aa * b \<Longrightarrow> aa dvd (1::'a) \<or> b dvd (1::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hom b dvd (1::'b) \<or> hom c dvd (1::'b)
[PROOF STEP]
show "b dvd 1 \<or> c dvd 1"
[PROOF STATE]
proof (prove)
using this:
hom b dvd (1::'b) \<or> hom c dvd (1::'b)

goal (1 subgoal):
 1. b dvd (1::'a) \<or> c dvd (1::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
b dvd (1::'a) \<or> c dvd (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_LIMSEQ': "summable f \<Longrightarrow> (\<lambda>n. \<Sum>i\<le>n. f i) \<longlonglongrightarrow> suminf f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<lambda>n. sum f {..n}) \<longlonglongrightarrow> suminf f
[PROOF STEP]
using sums_def_le
[PROOF STATE]
proof (prove)
using this:
?f sums ?s = (\<lambda>n. sum ?f {..n}) \<longlonglongrightarrow> ?s

goal (1 subgoal):
 1. summable f \<Longrightarrow> (\<lambda>n. sum f {..n}) \<longlonglongrightarrow> suminf f
[PROOF STEP]
by blast


[STATEMENT]
lemma sequentially_even_odd:
  assumes E: "eventually (\<lambda>n. P (2 * n)) sequentially" and O: "eventually (\<lambda>n. P (2 * n + 1)) sequentially"
  shows "eventually P sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P sequentially
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. eventually P sequentially
[PROOF STEP]
from E
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. P (2 * n)
[PROOF STEP]
obtain n_e where [intro]: "\<And>n. n \<ge> n_e \<Longrightarrow> P (2 * n)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. P (2 * n)

goal (1 subgoal):
 1. (\<And>n_e. (\<And>n. n_e \<le> n \<Longrightarrow> P (2 * n)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_sequentially)
[PROOF STATE]
proof (state)
this:
n_e \<le> ?n \<Longrightarrow> P (2 * ?n)

goal (1 subgoal):
 1. eventually P sequentially
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
n_e \<le> ?n \<Longrightarrow> P (2 * ?n)

goal (1 subgoal):
 1. eventually P sequentially
[PROOF STEP]
from O
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. P (2 * n + 1)
[PROOF STEP]
obtain n_o where [intro]: "\<And>n. n \<ge> n_o \<Longrightarrow> P (Suc (2 * n))"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. P (2 * n + 1)

goal (1 subgoal):
 1. (\<And>n_o. (\<And>n. n_o \<le> n \<Longrightarrow> P (Suc (2 * n))) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_sequentially)
[PROOF STATE]
proof (state)
this:
n_o \<le> ?n \<Longrightarrow> P (Suc (2 * ?n))

goal (1 subgoal):
 1. eventually P sequentially
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P sequentially
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. P n
[PROOF STEP]
proof (intro exI allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> P n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> P n
[PROOF STEP]
assume "max (2 * n_e) (2 * n_o + 1) \<le> n"
[PROOF STATE]
proof (state)
this:
max (2 * n_e) (2 * n_o + 1) \<le> n

goal (1 subgoal):
 1. \<And>n. ?N \<le> n \<Longrightarrow> P n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
max (2 * n_e) (2 * n_o + 1) \<le> n
[PROOF STEP]
show "P n"
[PROOF STATE]
proof (prove)
using this:
max (2 * n_e) (2 * n_o + 1) \<le> n

goal (1 subgoal):
 1. P n
[PROOF STEP]
by (cases "even n") (auto elim!: evenE oddE )
[PROOF STATE]
proof (state)
this:
P n

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma foldr_elem_check:
  assumes "list.set xs \<subseteq> A"
  shows "foldr (\<lambda> x y . if x \<notin> A then y else f x y) xs v = foldr f xs v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldr (\<lambda>x y. if x \<notin> A then y else f x y) xs v = foldr f xs v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> A

goal (1 subgoal):
 1. foldr (\<lambda>x y. if x \<notin> A then y else f x y) xs v = foldr f xs v
[PROOF STEP]
by (induction xs; auto)


[STATEMENT]
lemma set_sublist_list_eq_set_sublist: "
  list_all (\<lambda>i. i < length xs) ys \<Longrightarrow>
  set (sublist_list xs ys) = set (nths xs (set ys))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all (\<lambda>i. i < length xs) ys \<Longrightarrow> set (sublist_list xs ys) = set (nths xs (set ys))
[PROOF STEP]
by (simp add: sublist_list_if_sublist_list_eq[symmetric] set_sublist_list_if_eq_set_sublist)


[STATEMENT]
lemma geodesic_subsetI:
  assumes "\<And>x y. x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S"
  shows "geodesic_subset S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geodesic_subset S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> \<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> S

goal (1 subgoal):
 1. geodesic_subset S
[PROOF STEP]
unfolding geodesic_subset_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> S; ?y \<in> S\<rbrakk> \<Longrightarrow> \<exists>G. geodesic_segment_between G ?x ?y \<and> G \<subseteq> S

goal (1 subgoal):
 1. \<forall>x\<in>S. \<forall>y\<in>S. \<exists>G. geodesic_segment_between G x y \<and> G \<subseteq> S
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_indicator_disjoint_family:
  fixes f :: "'d \<Rightarrow> 'e::semiring_1"
  assumes d: "disjoint_family_on A P" and "x \<in> A j" and "finite P" and "j \<in> P"
  shows "(\<Sum>i\<in>P. f i * indicator (A i) x) = f j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>P. f i * indicator (A i) x) = f j
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>P. f i * indicator (A i) x) = f j
[PROOF STEP]
have "P \<inter> {i. x \<in> A i} = {j}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<inter> {i. x \<in> A i} = {j}
[PROOF STEP]
using d \<open>x \<in> A j\<close> \<open>j \<in> P\<close>
[PROOF STATE]
proof (prove)
using this:
disjoint_family_on A P
x \<in> A j
j \<in> P

goal (1 subgoal):
 1. P \<inter> {i. x \<in> A i} = {j}
[PROOF STEP]
unfolding disjoint_family_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<in>P. \<forall>n\<in>P. m \<noteq> n \<longrightarrow> A m \<inter> A n = {}
x \<in> A j
j \<in> P

goal (1 subgoal):
 1. P \<inter> {i. x \<in> A i} = {j}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P \<inter> {i. x \<in> A i} = {j}

goal (1 subgoal):
 1. (\<Sum>i\<in>P. f i * indicator (A i) x) = f j
[PROOF STEP]
with \<open>finite P\<close>
[PROOF STATE]
proof (chain)
picking this:
finite P
P \<inter> {i. x \<in> A i} = {j}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite P
P \<inter> {i. x \<in> A i} = {j}

goal (1 subgoal):
 1. (\<Sum>i\<in>P. f i * indicator (A i) x) = f j
[PROOF STEP]
by (simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>P. f i * indicator (A i) x) = f j

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unstream_tl_trans_True: "unstream (tl_trans g) (True, s) = unstream g s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unstream (tl_trans g) (True, s) = unstream g s
[PROOF STEP]
proof(induction s taking: g rule: unstream.induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator g s = Skip x2 \<Longrightarrow> unstream (tl_trans g) (True, x2) = unstream g x2; \<And>x31 x32. generator g s = Yield x31 x32 \<Longrightarrow> unstream (tl_trans g) (True, x32) = unstream g x32\<rbrakk> \<Longrightarrow> unstream (tl_trans g) (True, s) = unstream g s
[PROOF STEP]
case (1 s)
[PROOF STATE]
proof (state)
this:
generator g s = Skip ?x2.0 \<Longrightarrow> unstream (tl_trans g) (True, ?x2.0) = unstream g ?x2.0
generator g s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (tl_trans g) (True, ?x32.0) = unstream g ?x32.0

goal (1 subgoal):
 1. \<And>s. \<lbrakk>\<And>x2. generator g s = Skip x2 \<Longrightarrow> unstream (tl_trans g) (True, x2) = unstream g x2; \<And>x31 x32. generator g s = Yield x31 x32 \<Longrightarrow> unstream (tl_trans g) (True, x32) = unstream g x32\<rbrakk> \<Longrightarrow> unstream (tl_trans g) (True, s) = unstream g s
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unstream (tl_trans g) (True, s) = unstream g s
[PROOF STEP]
using "1.IH"
[PROOF STATE]
proof (prove)
using this:
generator g s = Skip ?x2.0 \<Longrightarrow> unstream (tl_trans g) (True, ?x2.0) = unstream g ?x2.0
generator g s = Yield ?x31.0 ?x32.0 \<Longrightarrow> unstream (tl_trans g) (True, ?x32.0) = unstream g ?x32.0

goal (1 subgoal):
 1. unstream (tl_trans g) (True, s) = unstream g s
[PROOF STEP]
by (cases "generator g s")(simp_all add: tl_trans.rep_eq)
[PROOF STATE]
proof (state)
this:
unstream (tl_trans g) (True, s) = unstream g s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deg_fun_plus:
  assumes "finite (supp_fun s)" and "finite (supp_fun t)"
  shows "deg_fun (s + t) = deg_fun s + deg_fun (t::'a \<Rightarrow> 'b::comm_monoid_add)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
finite (supp_fun s)
finite (supp_fun t)
[PROOF STEP]
have fin: "finite (supp_fun s \<union> supp_fun t)"
[PROOF STATE]
proof (prove)
using this:
finite (supp_fun s)
finite (supp_fun t)

goal (1 subgoal):
 1. finite (supp_fun s \<union> supp_fun t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
have "deg_fun (s + t) = (\<Sum>x\<in>(supp_fun (s + t)). s x + t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_fun (s + t) = (\<Sum>x\<in>supp_fun (s + t). s x + t x)
[PROOF STEP]
by (simp add: deg_fun_def)
[PROOF STATE]
proof (state)
this:
deg_fun (s + t) = (\<Sum>x\<in>supp_fun (s + t). s x + t x)

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deg_fun (s + t) = (\<Sum>x\<in>supp_fun (s + t). s x + t x)

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite (supp_fun s \<union> supp_fun t)
[PROOF STEP]
have "... = (\<Sum>x\<in>(supp_fun s \<union> supp_fun t). s x + t x)"
[PROOF STATE]
proof (prove)
using this:
finite (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. (\<Sum>x\<in>supp_fun (s + t). s x + t x) = (\<Sum>x\<in>supp_fun s \<union> supp_fun t. s x + t x)
[PROOF STEP]
proof (rule sum.mono_neutral_cong_left)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. supp_fun (s + t) \<subseteq> supp_fun s \<union> supp_fun t
 2. \<forall>i\<in>supp_fun s \<union> supp_fun t - supp_fun (s + t). s i + t i = (0::'b)
 3. \<And>x. x \<in> supp_fun (s + t) \<Longrightarrow> s x + t x = s x + t x
[PROOF STEP]
show "\<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun (s + t). s x + t x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun (s + t). s x + t x = (0::'b)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun (s + t) \<Longrightarrow> s x + t x = (0::'b)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun (s + t) \<Longrightarrow> s x + t x = (0::'b)
[PROOF STEP]
assume "x \<in> supp_fun s \<union> supp_fun t - supp_fun (s + t)"
[PROOF STATE]
proof (state)
this:
x \<in> supp_fun s \<union> supp_fun t - supp_fun (s + t)

goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun (s + t) \<Longrightarrow> s x + t x = (0::'b)
[PROOF STEP]
hence "x \<notin> supp_fun (s + t)"
[PROOF STATE]
proof (prove)
using this:
x \<in> supp_fun s \<union> supp_fun t - supp_fun (s + t)

goal (1 subgoal):
 1. x \<notin> supp_fun (s + t)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<notin> supp_fun (s + t)

goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun (s + t) \<Longrightarrow> s x + t x = (0::'b)
[PROOF STEP]
thus "s x + t x = 0"
[PROOF STATE]
proof (prove)
using this:
x \<notin> supp_fun (s + t)

goal (1 subgoal):
 1. s x + t x = (0::'b)
[PROOF STEP]
by (simp add: supp_fun_def)
[PROOF STATE]
proof (state)
this:
s x + t x = (0::'b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun (s + t). s x + t x = (0::'b)

goal (2 subgoals):
 1. supp_fun (s + t) \<subseteq> supp_fun s \<union> supp_fun t
 2. \<And>x. x \<in> supp_fun (s + t) \<Longrightarrow> s x + t x = s x + t x
[PROOF STEP]
qed (rule supp_fun_plus_subset, rule)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>supp_fun (s + t). s x + t x) = (\<Sum>x\<in>supp_fun s \<union> supp_fun t. s x + t x)

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>supp_fun (s + t). s x + t x) = (\<Sum>x\<in>supp_fun s \<union> supp_fun t. s x + t x)

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>(supp_fun s \<union> supp_fun t). s x) + (\<Sum>x\<in>(supp_fun s \<union> supp_fun t). t x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>supp_fun s \<union> supp_fun t. s x + t x) = sum s (supp_fun s \<union> supp_fun t) + sum t (supp_fun s \<union> supp_fun t)
[PROOF STEP]
by (rule sum.distrib)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>supp_fun s \<union> supp_fun t. s x + t x) = sum s (supp_fun s \<union> supp_fun t) + sum t (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>supp_fun s \<union> supp_fun t. s x + t x) = sum s (supp_fun s \<union> supp_fun t) + sum t (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite (supp_fun s \<union> supp_fun t)
[PROOF STEP]
have "(\<Sum>x\<in>(supp_fun s \<union> supp_fun t). s x) = deg_fun s"
[PROOF STATE]
proof (prove)
using this:
finite (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. sum s (supp_fun s \<union> supp_fun t) = deg_fun s
[PROOF STEP]
unfolding deg_fun_def
[PROOF STATE]
proof (prove)
using this:
finite (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. sum s (supp_fun s \<union> supp_fun t) = sum s (supp_fun s)
[PROOF STEP]
proof (rule sum.mono_neutral_cong_right)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. supp_fun s \<subseteq> supp_fun s \<union> supp_fun t
 2. \<forall>i\<in>supp_fun s \<union> supp_fun t - supp_fun s. s i = (0::'b)
 3. \<And>x. x \<in> supp_fun s \<Longrightarrow> s x = s x
[PROOF STEP]
show "\<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun s. s x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun s. s x = (0::'b)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun s \<Longrightarrow> s x = (0::'b)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun s \<Longrightarrow> s x = (0::'b)
[PROOF STEP]
assume "x \<in> supp_fun s \<union> supp_fun t - supp_fun s"
[PROOF STATE]
proof (state)
this:
x \<in> supp_fun s \<union> supp_fun t - supp_fun s

goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun s \<Longrightarrow> s x = (0::'b)
[PROOF STEP]
hence "x \<notin> supp_fun s"
[PROOF STATE]
proof (prove)
using this:
x \<in> supp_fun s \<union> supp_fun t - supp_fun s

goal (1 subgoal):
 1. x \<notin> supp_fun s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<notin> supp_fun s

goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun s \<Longrightarrow> s x = (0::'b)
[PROOF STEP]
thus "s x = 0"
[PROOF STATE]
proof (prove)
using this:
x \<notin> supp_fun s

goal (1 subgoal):
 1. s x = (0::'b)
[PROOF STEP]
by (simp add: supp_fun_def)
[PROOF STATE]
proof (state)
this:
s x = (0::'b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun s. s x = (0::'b)

goal (2 subgoals):
 1. supp_fun s \<subseteq> supp_fun s \<union> supp_fun t
 2. \<And>x. x \<in> supp_fun s \<Longrightarrow> s x = s x
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
sum s (supp_fun s \<union> supp_fun t) = deg_fun s

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum s (supp_fun s \<union> supp_fun t) = deg_fun s

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
from fin
[PROOF STATE]
proof (chain)
picking this:
finite (supp_fun s \<union> supp_fun t)
[PROOF STEP]
have "(\<Sum>x\<in>(supp_fun s \<union> supp_fun t). t x) = deg_fun t"
[PROOF STATE]
proof (prove)
using this:
finite (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. sum t (supp_fun s \<union> supp_fun t) = deg_fun t
[PROOF STEP]
unfolding deg_fun_def
[PROOF STATE]
proof (prove)
using this:
finite (supp_fun s \<union> supp_fun t)

goal (1 subgoal):
 1. sum t (supp_fun s \<union> supp_fun t) = sum t (supp_fun t)
[PROOF STEP]
proof (rule sum.mono_neutral_cong_right)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. supp_fun t \<subseteq> supp_fun s \<union> supp_fun t
 2. \<forall>i\<in>supp_fun s \<union> supp_fun t - supp_fun t. t i = (0::'b)
 3. \<And>x. x \<in> supp_fun t \<Longrightarrow> t x = t x
[PROOF STEP]
show "\<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun t. t x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun t. t x = (0::'b)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun t \<Longrightarrow> t x = (0::'b)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun t \<Longrightarrow> t x = (0::'b)
[PROOF STEP]
assume "x \<in> supp_fun s \<union> supp_fun t - supp_fun t"
[PROOF STATE]
proof (state)
this:
x \<in> supp_fun s \<union> supp_fun t - supp_fun t

goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun t \<Longrightarrow> t x = (0::'b)
[PROOF STEP]
hence "x \<notin> supp_fun t"
[PROOF STATE]
proof (prove)
using this:
x \<in> supp_fun s \<union> supp_fun t - supp_fun t

goal (1 subgoal):
 1. x \<notin> supp_fun t
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<notin> supp_fun t

goal (1 subgoal):
 1. \<And>x. x \<in> supp_fun s \<union> supp_fun t - supp_fun t \<Longrightarrow> t x = (0::'b)
[PROOF STEP]
thus "t x = 0"
[PROOF STATE]
proof (prove)
using this:
x \<notin> supp_fun t

goal (1 subgoal):
 1. t x = (0::'b)
[PROOF STEP]
by (simp add: supp_fun_def)
[PROOF STATE]
proof (state)
this:
t x = (0::'b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>supp_fun s \<union> supp_fun t - supp_fun t. t x = (0::'b)

goal (2 subgoals):
 1. supp_fun t \<subseteq> supp_fun s \<union> supp_fun t
 2. \<And>x. x \<in> supp_fun t \<Longrightarrow> t x = t x
[PROOF STEP]
qed simp_all
[PROOF STATE]
proof (state)
this:
sum t (supp_fun s \<union> supp_fun t) = deg_fun t

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deg_fun (s + t) = deg_fun s + deg_fun t

goal (1 subgoal):
 1. deg_fun (s + t) = deg_fun s + deg_fun t
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
deg_fun (s + t) = deg_fun s + deg_fun t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma image_sequence_of_inj:
  assumes "bij_betw enum {0..<card A} A"
  shows "sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<subseteq> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<subseteq> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
fix xs
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
assume "xs \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A}"
[PROOF STATE]
proof (state)
this:
xs \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A}

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
xs \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A}
[PROOF STEP]
obtain f where xs: "xs = sequence_of A enum f" and f: "f \<in> A \<rightarrow>\<^sub>E B" "inj_on f A"
[PROOF STATE]
proof (prove)
using this:
xs \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A}

goal (1 subgoal):
 1. (\<And>f. \<lbrakk>xs = sequence_of A enum f; f \<in> A \<rightarrow>\<^sub>E B; inj_on f A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
from xs f \<open>bij_betw _ _ _\<close>
[PROOF STATE]
proof (chain)
picking this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A
[PROOF STEP]
have "set xs \<subseteq> B"
[PROOF STATE]
proof (prove)
using this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A

goal (1 subgoal):
 1. set xs \<subseteq> B
[PROOF STEP]
using set_sequence_of subsetCE
[PROOF STATE]
proof (prove)
using this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A
\<lbrakk>bij_betw ?enum {0..<card ?A} ?A; ?f \<in> ?A \<rightarrow>\<^sub>E ?B\<rbrakk> \<Longrightarrow> set (sequence_of ?A ?enum ?f) \<subseteq> ?B
\<lbrakk>?A \<subseteq> ?B; ?c \<notin> ?A \<Longrightarrow> ?P; ?c \<in> ?B \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P

goal (1 subgoal):
 1. set xs \<subseteq> B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> B

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set xs \<subseteq> B

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
from xs f \<open>bij_betw _ _ _\<close>
[PROOF STATE]
proof (chain)
picking this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A
[PROOF STEP]
have "length xs = card A"
[PROOF STATE]
proof (prove)
using this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A

goal (1 subgoal):
 1. length xs = card A
[PROOF STEP]
using length_sequence_of
[PROOF STATE]
proof (prove)
using this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A
\<lbrakk>bij_betw ?enum {0..<card ?A} ?A; ?f \<in> ?A \<rightarrow>\<^sub>E ?B\<rbrakk> \<Longrightarrow> length (sequence_of ?A ?enum ?f) = card ?A

goal (1 subgoal):
 1. length xs = card A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length xs = card A

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
length xs = card A

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
from xs f \<open>bij_betw _ _ _\<close>
[PROOF STATE]
proof (chain)
picking this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A
[PROOF STEP]
have "distinct xs"
[PROOF STATE]
proof (prove)
using this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A

goal (1 subgoal):
 1. distinct xs
[PROOF STEP]
using inj_on_implies_distinct
[PROOF STATE]
proof (prove)
using this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
bij_betw enum {0..<card A} A
\<lbrakk>bij_betw ?enum {0..<card ?A} ?A; ?f \<in> ?A \<rightarrow>\<^sub>E ?B; inj_on ?f ?A\<rbrakk> \<Longrightarrow> distinct (sequence_of ?A ?enum ?f)

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

goal (1 subgoal):
 1. \<And>x. x \<in> sequence_of A enum ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} \<Longrightarrow> x \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
set xs \<subseteq> B
length xs = card A
distinct xs
[PROOF STEP]
show "xs \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}"
[PROOF STATE]
proof (prove)
using this:
xs = sequence_of A enum f
f \<in> A \<rightarrow>\<^sub>E B
inj_on f A
set xs \<subseteq> B
length xs = card A
distinct xs

goal (1 subgoal):
 1. xs \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs \<in> {xs. set xs \<subseteq> B \<and> length xs = card A \<and> distinct xs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma liftablepE[elim]:
    assumes "liftablep r f"
    assumes "r x y"
    obtains "r (f x) (f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r (f x) (f y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
liftablep r f
r x y

goal (1 subgoal):
 1. (r (f x) (f y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding liftablep_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. r x y \<longrightarrow> r (f x) (f y)
r x y

goal (1 subgoal):
 1. (r (f x) (f y) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by simp