[STATEMENT]
lemma shortest_period_plus:
  "shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)"
  (is "_ \<le> ?MAX")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
proof (cases "\<forall> i . \<pi> (\<alpha> + \<beta>) i = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i. \<pi> (\<alpha> + \<beta>) i = 0 \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
 2. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0

goal (2 subgoals):
 1. \<forall>i. \<pi> (\<alpha> + \<beta>) i = 0 \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
 2. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0

goal (1 subgoal):
 1. shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
unfolding shortest_period_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0

goal (1 subgoal):
 1. (if \<forall>i. \<pi> (\<alpha> + \<beta>) i = 0 then 0 else Max {i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0}) \<le> max (if \<forall>i. \<pi> \<alpha> i = 0 then 0 else Max {i. \<pi> \<alpha> i \<noteq> 0}) (if \<forall>i. \<pi> \<beta> i = 0 then 0 else Max {i. \<pi> \<beta> i \<noteq> 0})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0)

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
have "shortest_period \<alpha> \<le> ?MAX" and "shortest_period \<beta> \<le> ?MAX"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. shortest_period \<alpha> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>) &&& shortest_period \<beta> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
shortest_period \<alpha> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
shortest_period \<beta> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
shortest_period \<alpha> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
shortest_period \<beta> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
have "\<forall> i > shortest_period \<alpha> . \<pi> \<alpha> i = 0"
  and "\<forall> i > shortest_period \<beta> . \<pi> \<beta> i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i>shortest_period \<alpha>. \<pi> \<alpha> i = 0 &&& \<forall>i>shortest_period \<beta>. \<pi> \<beta> i = 0
[PROOF STEP]
unfolding shortest_period_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i>if \<forall>i. \<pi> \<alpha> i = 0 then 0 else Max {i. \<pi> \<alpha> i \<noteq> 0}. \<pi> \<alpha> i = 0 &&& \<forall>i>if \<forall>i. \<pi> \<beta> i = 0 then 0 else Max {i. \<pi> \<beta> i \<noteq> 0}. \<pi> \<beta> i = 0
[PROOF STEP]
using finite_account_support Max.coboundedI leD Collect_cong
[PROOF STATE]
proof (prove)
using this:
finite {i. \<pi> ?\<alpha> i \<noteq> 0}
\<lbrakk>finite ?A; ?a \<in> ?A\<rbrakk> \<Longrightarrow> ?a \<le> Max ?A
?y \<le> ?x \<Longrightarrow> \<not> ?x < ?y
(\<And>x. ?P x = ?Q x) \<Longrightarrow> {x. ?P x} = {x. ?Q x}

goal (1 subgoal):
 1. \<forall>i>if \<forall>i. \<pi> \<alpha> i = 0 then 0 else Max {i. \<pi> \<alpha> i \<noteq> 0}. \<pi> \<alpha> i = 0 &&& \<forall>i>if \<forall>i. \<pi> \<beta> i = 0 then 0 else Max {i. \<pi> \<beta> i \<noteq> 0}. \<pi> \<beta> i = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i>shortest_period \<alpha>. \<pi> \<alpha> i = 0
\<forall>i>shortest_period \<beta>. \<pi> \<beta> i = 0

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
shortest_period \<alpha> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
shortest_period \<beta> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
\<forall>i>shortest_period \<alpha>. \<pi> \<alpha> i = 0
\<forall>i>shortest_period \<beta>. \<pi> \<beta> i = 0
[PROOF STEP]
have "\<forall> i > ?MAX . \<pi> \<alpha> i = 0"
  and "\<forall> i > ?MAX . \<pi> \<beta> i = 0"
[PROOF STATE]
proof (prove)
using this:
shortest_period \<alpha> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
shortest_period \<beta> \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
\<forall>i>shortest_period \<alpha>. \<pi> \<alpha> i = 0
\<forall>i>shortest_period \<beta>. \<pi> \<beta> i = 0

goal (1 subgoal):
 1. \<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> \<alpha> i = 0 &&& \<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> \<beta> i = 0
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
\<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> \<alpha> i = 0
\<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> \<beta> i = 0

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
hence "\<forall> i > ?MAX . \<pi> (\<alpha> + \<beta>) i = 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> \<alpha> i = 0
\<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> \<beta> i = 0

goal (1 subgoal):
 1. \<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> (\<alpha> + \<beta>) i = 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> (\<alpha> + \<beta>) i = 0

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
hence "\<forall> i . \<pi> (\<alpha> + \<beta>) i \<noteq> 0 \<longrightarrow> i \<le> ?MAX"
[PROOF STATE]
proof (prove)
using this:
\<forall>i>max (shortest_period \<alpha>) (shortest_period \<beta>). \<pi> (\<alpha> + \<beta>) i = 0

goal (1 subgoal):
 1. \<forall>i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0 \<longrightarrow> i \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
by (meson not_le)
[PROOF STATE]
proof (state)
this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0 \<longrightarrow> i \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)

goal (1 subgoal):
 1. \<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0) \<Longrightarrow> shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0 \<longrightarrow> i \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)

goal (1 subgoal):
 1. shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)
[PROOF STEP]
unfolding shortest_period_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0 \<longrightarrow> i \<le> max (if \<forall>i. \<pi> \<alpha> i = 0 then 0 else Max {i. \<pi> \<alpha> i \<noteq> 0}) (if \<forall>i. \<pi> \<beta> i = 0 then 0 else Max {i. \<pi> \<beta> i \<noteq> 0})

goal (1 subgoal):
 1. (if \<forall>i. \<pi> (\<alpha> + \<beta>) i = 0 then 0 else Max {i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0}) \<le> max (if \<forall>i. \<pi> \<alpha> i = 0 then 0 else Max {i. \<pi> \<alpha> i \<noteq> 0}) (if \<forall>i. \<pi> \<beta> i = 0 then 0 else Max {i. \<pi> \<beta> i \<noteq> 0})
[PROOF STEP]
using
      finite_account_support [where \<alpha> = "\<alpha> + \<beta>"]
      False
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0 \<longrightarrow> i \<le> max (if \<forall>i. \<pi> \<alpha> i = 0 then 0 else Max {i. \<pi> \<alpha> i \<noteq> 0}) (if \<forall>i. \<pi> \<beta> i = 0 then 0 else Max {i. \<pi> \<beta> i \<noteq> 0})
finite {i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0}
\<not> (\<forall>i. \<pi> (\<alpha> + \<beta>) i = 0)

goal (1 subgoal):
 1. (if \<forall>i. \<pi> (\<alpha> + \<beta>) i = 0 then 0 else Max {i. \<pi> (\<alpha> + \<beta>) i \<noteq> 0}) \<le> max (if \<forall>i. \<pi> \<alpha> i = 0 then 0 else Max {i. \<pi> \<alpha> i \<noteq> 0}) (if \<forall>i. \<pi> \<beta> i = 0 then 0 else Max {i. \<pi> \<beta> i \<noteq> 0})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
shortest_period (\<alpha> + \<beta>) \<le> max (shortest_period \<alpha>) (shortest_period \<beta>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma multiplicity_times_unit_left:
  assumes "is_unit c"
  shows   "multiplicity (c * p) x = multiplicity p x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity (c * p) x = multiplicity p x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity (c * p) x = multiplicity p x
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_unit c
[PROOF STEP]
have "{n. (c * p) ^ n dvd x} = {n. p ^ n dvd x}"
[PROOF STATE]
proof (prove)
using this:
is_unit c

goal (1 subgoal):
 1. {n. (c * p) ^ n dvd x} = {n. p ^ n dvd x}
[PROOF STEP]
by (subst mult.commute) (simp add: mult_unit_dvd_iff power_mult_distrib is_unit_power_iff)
[PROOF STATE]
proof (state)
this:
{n. (c * p) ^ n dvd x} = {n. p ^ n dvd x}

goal (1 subgoal):
 1. multiplicity (c * p) x = multiplicity p x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{n. (c * p) ^ n dvd x} = {n. p ^ n dvd x}

goal (1 subgoal):
 1. multiplicity (c * p) x = multiplicity p x
[PROOF STEP]
by (simp add: multiplicity_def)
[PROOF STATE]
proof (state)
this:
multiplicity (c * p) x = multiplicity p x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_bfun_def': "norm f = (\<Squnion>x. norm ((f :: 'a \<Rightarrow>\<^sub>b 'b :: real_normed_vector) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm f = (\<Squnion>x. norm (apply_bfun f x))
[PROOF STEP]
by(subst norm_conv_dist, simp add: dist_bfun.rep_eq)


[STATEMENT]
lemma NSLIMSEQ_const: "(\<lambda>n. k) \<longlonglongrightarrow>\<^sub>N\<^sub>S k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. k) \<longlonglongrightarrow>\<^sub>N\<^sub>S k
[PROOF STEP]
by (simp add: NSLIMSEQ_def)


[STATEMENT]
lemma cost_Copy_Ins: "cost(min_eds xs ys) \<le> cost (min_eds (x#xs) ys) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cost (min_eds xs ys) \<le> cost (min_eds (x # xs) ys) + 1
[PROOF STEP]
apply(induction xs ys rule: min_eds.induct)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. cost (min_eds [] []) \<le> cost (min_eds [x] []) + 1
 2. \<And>y ys. cost (min_eds [] ys) \<le> cost (min_eds [x] ys) + 1 \<Longrightarrow> cost (min_eds [] (y # ys)) \<le> cost (min_eds [x] (y # ys)) + 1
 3. \<And>xa xs. cost (min_eds xs []) \<le> cost (min_eds (x # xs) []) + 1 \<Longrightarrow> cost (min_eds (xa # xs) []) \<le> cost (min_eds (x # xa # xs) []) + 1
 4. \<And>xa xs y ys. \<lbrakk>cost (min_eds (xa # xs) ys) \<le> cost (min_eds (x # xa # xs) ys) + 1; cost (min_eds xs (y # ys)) \<le> cost (min_eds (x # xs) (y # ys)) + 1; cost (min_eds xs ys) \<le> cost (min_eds (x # xs) ys) + 1\<rbrakk> \<Longrightarrow> cost (min_eds (xa # xs) (y # ys)) \<le> cost (min_eds (x # xa # xs) (y # ys)) + 1
[PROOF STEP]
apply(auto simp del: filter_True filter_False split!: if_splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map_pref_conv [reversal_rule]: assumes "inj f" shows "map f u \<le>p map f v \<longleftrightarrow> u \<le>p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (map f u \<le>p map f v) = (u \<le>p v)
[PROOF STEP]
using map_mono_prefix[of "map f u" "map f v" "inv f"] map_mono_prefix
[PROOF STATE]
proof (prove)
using this:
map f u \<le>p map f v \<Longrightarrow> map (inv f) (map f u) \<le>p map (inv f) (map f v)
?xs \<le>p ?ys \<Longrightarrow> map ?f ?xs \<le>p map ?f ?ys

goal (1 subgoal):
 1. (map f u \<le>p map f v) = (u \<le>p v)
[PROOF STEP]
unfolding map_map inv_o_cancel[OF \<open>inj f\<close>] list.map_id
[PROOF STATE]
proof (prove)
using this:
map f u \<le>p map f v \<Longrightarrow> u \<le>p v
?xs \<le>p ?ys \<Longrightarrow> map ?f ?xs \<le>p map ?f ?ys

goal (1 subgoal):
 1. (map f u \<le>p map f v) = (u \<le>p v)
[PROOF STEP]
..


[STATEMENT]
lemma nprt_mono [simp, no_atp]: "a \<le> b \<Longrightarrow> nprt a \<le> nprt b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> nprt a \<le> nprt b
[PROOF STEP]
unfolding le_iff_inf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf a b = a \<Longrightarrow> inf (nprt a) (nprt b) = nprt a
[PROOF STEP]
by (simp add: nprt_def inf_aci inf_assoc [symmetric, of a])


[STATEMENT]
lemma word_cat_eq:
  \<open>(word_cat v w :: 'c::len word) = push_bit LENGTH('b) (ucast v) + ucast w\<close>
  for v :: \<open>'a::len word\<close> and w :: \<open>'b::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. word_cat v w = push_bit LENGTH('b) (ucast v) + ucast w
[PROOF STEP]
by transfer (simp add: concat_bit_eq ac_simps)


[STATEMENT]
lemma fps_of_poly_cutoff [simp]:
  "fps_of_poly (poly_cutoff n p) = fps_cutoff n (fps_of_poly p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_of_poly (poly_cutoff n p) = fps_cutoff n (fps_of_poly p)
[PROOF STEP]
by (simp add: fps_eq_iff coeff_poly_cutoff)


[STATEMENT]
lemma rightUniqueInjectiveOnFirst: "(runiq P) = (inj_on fst P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. runiq P = inj_on fst P
[PROOF STEP]
using rightUniqueInjectiveOnFirstImplication lm05
[PROOF STATE]
proof (prove)
using this:
runiq ?P \<Longrightarrow> inj_on fst ?P
inj_on fst ?P \<Longrightarrow> runiq ?P

goal (1 subgoal):
 1. runiq P = inj_on fst P
[PROOF STEP]
by blast


[STATEMENT]
lemma subst_fm_NotInDom [simp]: "(NotInDom t r)(i::=x) = NotInDom (subst i x t) (subst i x r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (NotInDom t r)(i::=x) = NotInDom (subst i x t) (subst i x r)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (NotInDom t r)(i::=x) = NotInDom (subst i x t) (subst i x r)
[PROOF STEP]
obtain j::name where "atom j \<sharp> (i,x,t,r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>j. atom j \<sharp> (i, x, t, r) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (rule obtain_fresh)
[PROOF STATE]
proof (state)
this:
atom j \<sharp> (i, x, t, r)

goal (1 subgoal):
 1. (NotInDom t r)(i::=x) = NotInDom (subst i x t) (subst i x r)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
atom j \<sharp> (i, x, t, r)

goal (1 subgoal):
 1. (NotInDom t r)(i::=x) = NotInDom (subst i x t) (subst i x r)
[PROOF STEP]
by (auto simp: NotInDom.simps [of j])
[PROOF STATE]
proof (state)
this:
(NotInDom t r)(i::=x) = NotInDom (subst i x t) (subst i x r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in PolynRg) erh_rHom_coeff:"\<lbrakk>PolynRg A B Y; h \<in> rHom S B;
       pol_coeff S c\<rbrakk>  \<Longrightarrow>  erh R S X A B Y h 0 c = (cmp h (snd c)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>PolynRg A B Y; h \<in> rHom S B; pol_coeff S c\<rbrakk> \<Longrightarrow> erh R S X A B Y h 0 c = cmp h (snd c) 0
[PROOF STEP]
apply (cut_tac subring,
       frule subring_Ring,
       frule PolynRg.is_Ring[of A B Y],
       frule PolynRg.subring[of A B Y],
       frule Ring.subring_Ring[of A B], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>PolynRg A B Y; h \<in> rHom S B; pol_coeff S c; Subring R S; Ring S; Ring A; Subring A B; Ring B\<rbrakk> \<Longrightarrow> erh R S X A B Y h 0 c = cmp h (snd c) 0
[PROOF STEP]
apply (simp add:erh_def polyn_expr_def cf_h_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>PolynRg A B Y; h \<in> rHom S B; pol_coeff S c; Subring R S; Ring S; Ring A; Subring A B; Ring B\<rbrakk> \<Longrightarrow> cmp h (snd c) 0 \<cdot>\<^sub>r\<^bsub>A\<^esub> 1\<^sub>r\<^bsub>A\<^esub> = cmp h (snd c) 0
[PROOF STEP]
apply (frule pol_coeff_mem [of c 0], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>PolynRg A B Y; h \<in> rHom S B; pol_coeff S c; Subring R S; Ring S; Ring A; Subring A B; Ring B; snd c 0 \<in> carrier S\<rbrakk> \<Longrightarrow> cmp h (snd c) 0 \<cdot>\<^sub>r\<^bsub>A\<^esub> 1\<^sub>r\<^bsub>A\<^esub> = cmp h (snd c) 0
[PROOF STEP]
apply (simp add:cmp_def, frule rHom_mem[of h S B "snd c 0"], assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>PolynRg A B Y; h \<in> rHom S B; pol_coeff S c; Subring R S; Ring S; Ring A; Subring A B; Ring B; snd c 0 \<in> carrier S; h (snd c 0) \<in> carrier B\<rbrakk> \<Longrightarrow> h (snd c 0) \<cdot>\<^sub>r\<^bsub>A\<^esub> 1\<^sub>r\<^bsub>A\<^esub> = h (snd c 0)
[PROOF STEP]
apply (frule Ring.mem_subring_mem_ring[of A B "h (snd c 0)"], assumption+,
        simp add:Ring.ring_r_one)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma tensor_vec_dim [simp]:
  "dim_vec (tensor_vec v1 v2) = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (tensor_vec v1 v2) = d
[PROOF STEP]
unfolding tensor_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (Matrix.vec d (\<lambda>i. v1 $ encode1 i * v2 $ encode2 i)) = d
[PROOF STEP]
by auto


[STATEMENT]
lemma infinite_card_of_insert:
assumes "\<not>finite A"
shows "|insert a A| =o |A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |insert a A| =o |A|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |insert a A| =o |A|
[PROOF STEP]
have iA: "insert a A = A \<union> {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert a A = A \<union> {a}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
insert a A = A \<union> {a}

goal (1 subgoal):
 1. |insert a A| =o |A|
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |insert a A| =o |A|
[PROOF STEP]
using infinite_imp_bij_betw2[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<exists>h. bij_betw h A (A \<union> {?a})

goal (1 subgoal):
 1. |insert a A| =o |A|
[PROOF STEP]
unfolding iA
[PROOF STATE]
proof (prove)
using this:
\<exists>h. bij_betw h A (A \<union> {?a})

goal (1 subgoal):
 1. |A \<union> {a}| =o |A|
[PROOF STEP]
by (metis bij_betw_inv card_of_ordIso)
[PROOF STATE]
proof (state)
this:
|insert a A| =o |A|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subst_fv:  assumes fv_e: "FV e \<subseteq> {x}" and fv_v: "FV v = {}"
  shows "FV (subst x v e) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FV (subst x v e) = {}
[PROOF STEP]
using fv_e fv_v subst_fv_aux
[PROOF STATE]
proof (prove)
using this:
FV e \<subseteq> {x}
FV v = {}
FV ?v = {} \<Longrightarrow> FV (subst ?x ?v ?e) \<subseteq> FV ?e - {?x}

goal (1 subgoal):
 1. FV (subst x v e) = {}
[PROOF STEP]
by blast


[STATEMENT]
lemma lex_ext_total:
  assumes "\<forall>(s, t)\<in>set (zip ss ts). s = t \<or> fst (f s t) \<or> fst (f t s)"
    and "\<And> t. snd (f t t)"
    and len: "length ss = length ts"
  shows "ss = ts \<or> fst (lex_ext f n ss ts) \<or> fst (lex_ext f n ts ss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ss = ts \<or> fst (lex_ext f n ss ts) \<or> fst (lex_ext f n ts ss)
[PROOF STEP]
using lex_ext_unbounded_total[OF assms]
[PROOF STATE]
proof (prove)
using this:
ss = ts \<or> fst (lex_ext_unbounded f ss ts) \<or> fst (lex_ext_unbounded f ts ss)

goal (1 subgoal):
 1. ss = ts \<or> fst (lex_ext f n ss ts) \<or> fst (lex_ext f n ts ss)
[PROOF STEP]
unfolding lex_ext_def Let_def len
[PROOF STATE]
proof (prove)
using this:
ss = ts \<or> fst (lex_ext_unbounded f ss ts) \<or> fst (lex_ext_unbounded f ts ss)

goal (1 subgoal):
 1. ss = ts \<or> fst (if length ts = length ts \<or> length ts \<le> n then lex_ext_unbounded f ss ts else (False, False)) \<or> fst (if length ts = length ts \<or> length ts \<le> n then lex_ext_unbounded f ts ss else (False, False))
[PROOF STEP]
by auto


[STATEMENT]
theorem univ_for_pr_tot_rec: "total_recursive univ_for_pr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. total_recursive univ_for_pr
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. total_recursive univ_for_pr
[PROOF STEP]
have "c_graph univ_for_pr \<in> ce_sets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_graph univ_for_pr \<in> ce_sets
[PROOF STEP]
by (rule univ_for_pr_tot_rec_lm)
[PROOF STATE]
proof (state)
this:
c_graph univ_for_pr \<in> ce_sets

goal (1 subgoal):
 1. total_recursive univ_for_pr
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_graph univ_for_pr \<in> ce_sets
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
c_graph univ_for_pr \<in> ce_sets

goal (1 subgoal):
 1. total_recursive univ_for_pr
[PROOF STEP]
by (unfold total_recursive_def1, auto)
[PROOF STATE]
proof (state)
this:
total_recursive univ_for_pr

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  surj_at_map_var: "at_map \<circ> Sup \<circ> Rep_atoms = (id::'a::complete_boolean_algebra_alt atoms \<Rightarrow> 'a atoms)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_map \<circ> Sup \<circ> Rep_atoms = id
[PROOF STEP]
unfolding at_map_def comp_def fun_eq_iff id_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. Abs_atoms (atom_map (\<Squnion> Rep_atoms x)) = x
[PROOF STEP]
by (metis Rep_atoms Rep_atoms_inverse Sup_upper atom_map_atoms surj_atom_map)


[STATEMENT]
lemma yun_wrelD: assumes "yun_wrel F c f"
  shows "map_poly rat_of_int F = smult c f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_poly F = Polynomial.smult c f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
yun_wrel F c f

goal (1 subgoal):
 1. of_int_poly F = Polynomial.smult c f
[PROOF STEP]
unfolding yun_wrel_def
[PROOF STATE]
proof (prove)
using this:
of_int_poly F = Polynomial.smult c f

goal (1 subgoal):
 1. of_int_poly F = Polynomial.smult c f
[PROOF STEP]
by auto


[STATEMENT]
lemma concat_equal_length:
assumes "\<And>xs. xs\<in>set xss \<Longrightarrow> length xs = l"
shows "length (concat xss) = length xss*l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (concat xss) = length xss * l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?xs \<in> set xss \<Longrightarrow> length ?xs = l

goal (1 subgoal):
 1. length (concat xss) = length xss * l
[PROOF STEP]
by (induction xss;auto)


[STATEMENT]
lemma fun_ext:
  assumes "f \<in> elts (VPi A B)" "g \<in> elts (VPi A B)" "\<And>x. x \<in> elts A \<Longrightarrow> app f x = app g x"
  shows "f = g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = g
[PROOF STEP]
by (metis VPi_memberD V_equalityI apply_pair assms)


[STATEMENT]
lemma [code abstract]: "vec_nth (c *s x) = (\<lambda>i. c * (x$i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (c *s x) = (\<lambda>i. c * x $ i)
[PROOF STEP]
unfolding vector_scalar_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) (\<chi>i. c * x $ i) = (\<lambda>i. c * x $ i)
[PROOF STEP]
by auto


[STATEMENT]
lemma ipurge_tr_append:
 "ipurge_tr I D u (xs @ ys) =
  ipurge_tr I D u xs @ ipurge_tr_aux I D (insert u (sinks I D u xs)) ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipurge_tr I D u (xs @ ys) = ipurge_tr I D u xs @ ipurge_tr_aux I D (insert u (sinks I D u xs)) ys
[PROOF STEP]
proof (simp add: sinks_aux_single_dom [symmetric]
 ipurge_tr_aux_single_dom [symmetric])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ipurge_tr_aux I D {u} (xs @ ys) = ipurge_tr_aux I D {u} xs @ ipurge_tr_aux I D (sinks_aux I D {u} xs) ys
[PROOF STEP]
qed (simp add: ipurge_tr_aux_append)


[STATEMENT]
lemma wf_list_arcs_alt: "wf_list_arcs xs \<longleftrightarrow> distinct (map snd xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_list_arcs xs = distinct (map snd xs)
[PROOF STEP]
by (induction xs) force+


[STATEMENT]
lemma qelim_ci:
  assumes qe_inv: "\<forall> bs p. qfree p \<longrightarrow> qfree (qe p) \<and> (Ifm bs (qe p) = Ifm bs (E p))"
  shows "\<And> bs. qfree (qelim p qe) \<and> (Ifm bs (qelim p qe) = Ifm bs p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>bs. qfree (qelim p qe) \<and> Ifm bs (qelim p qe) = Ifm bs p
[PROOF STEP]
using qe_inv DJ_qe[OF CJNB_qe[OF qe_inv]]
[PROOF STATE]
proof (prove)
using this:
\<forall>bs p. qfree p \<longrightarrow> qfree (qe p) \<and> Ifm bs (qe p) = Ifm bs (E p)
\<forall>bs p. qfree p \<longrightarrow> qfree (DJ (CJNB qe) p) \<and> Ifm bs (DJ (CJNB qe) p) = Ifm bs (E p)

goal (1 subgoal):
 1. \<And>bs. qfree (qelim p qe) \<and> Ifm bs (qelim p qe) = Ifm bs p
[PROOF STEP]
by (induct p rule: qelim.induct) (auto simp del: simpfm.simps)


[STATEMENT]
lemma Iff_trans: "H \<turnstile> A IFF B \<Longrightarrow> H \<turnstile> B IFF C \<Longrightarrow> H \<turnstile> A IFF C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<turnstile> A IFF B; H \<turnstile> B IFF C\<rbrakk> \<Longrightarrow> H \<turnstile> A IFF C
[PROOF STEP]
unfolding Iff_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>H \<turnstile> (A IMP B) AND (B IMP A); H \<turnstile> (B IMP C) AND (C IMP B)\<rbrakk> \<Longrightarrow> H \<turnstile> (A IMP C) AND (C IMP A)
[PROOF STEP]
by (metis Conj_E1 Conj_E2 Conj_I Disj_Semicong_1 Disj_commute)


[STATEMENT]
lemma Suc_div_unat_helper:
  assumes szv: "sz < LENGTH('a :: len)"
  and   usszv: "us \<le> sz"
  shows "2 ^ (sz - us) = Suc (unat (((2::'a :: len word) ^ sz - 1) div 2 ^ us))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
note usv = order_le_less_trans [OF usszv szv]
[PROOF STATE]
proof (state)
this:
us < LENGTH('a)

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
from usszv
[PROOF STATE]
proof (chain)
picking this:
us \<le> sz
[PROOF STEP]
obtain q where qv: "sz = us + q"
[PROOF STATE]
proof (prove)
using this:
us \<le> sz

goal (1 subgoal):
 1. (\<And>q. sz = us + q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: le_iff_add)
[PROOF STATE]
proof (state)
this:
sz = us + q

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
have "Suc (unat (((2:: 'a word) ^ sz - 1) div 2 ^ us)) =
    (2 ^ us + unat ((2:: 'a word) ^ sz - 1)) div 2 ^ us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (unat ((2 ^ sz - 1) div 2 ^ us)) = (2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us
[PROOF STEP]
apply (subst unat_div unat_power_lower[OF usv])+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (unat (2 ^ sz - 1) div 2 ^ us) = (2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us
[PROOF STEP]
apply (subst div_add_self1, simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Suc (unat ((2 ^ sz - 1) div 2 ^ us)) = (2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc (unat ((2 ^ sz - 1) div 2 ^ us)) = (2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
have "\<dots> = ((2 ^ us - 1) + 2 ^ sz) div 2 ^ us"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us = (2 ^ us - 1 + 2 ^ sz) div 2 ^ us
[PROOF STEP]
using szv
[PROOF STATE]
proof (prove)
using this:
sz < LENGTH('a)

goal (1 subgoal):
 1. (2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us = (2 ^ us - 1 + 2 ^ sz) div 2 ^ us
[PROOF STEP]
by (simp add: unat_minus_one)
[PROOF STATE]
proof (state)
this:
(2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us = (2 ^ us - 1 + 2 ^ sz) div 2 ^ us

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2 ^ us + unat (2 ^ sz - 1)) div 2 ^ us = (2 ^ us - 1 + 2 ^ sz) div 2 ^ us

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
have "\<dots> = 2 ^ q + ((2 ^ us - 1) div 2 ^ us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ us - 1 + 2 ^ sz) div 2 ^ us = 2 ^ q + (2 ^ us - 1) div 2 ^ us
[PROOF STEP]
apply (subst qv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ us - 1 + 2 ^ (us + q)) div 2 ^ us = 2 ^ q + (2 ^ us - 1) div 2 ^ us
[PROOF STEP]
apply (subst power_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 ^ us - 1 + 2 ^ us * 2 ^ q) div 2 ^ us = 2 ^ q + (2 ^ us - 1) div 2 ^ us
[PROOF STEP]
apply (subst div_mult_self2; simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
(2 ^ us - 1 + 2 ^ sz) div 2 ^ us = 2 ^ q + (2 ^ us - 1) div 2 ^ us

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2 ^ us - 1 + 2 ^ sz) div 2 ^ us = 2 ^ q + (2 ^ us - 1) div 2 ^ us

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
have "\<dots> = 2 ^ (sz - us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ q + (2 ^ us - 1) div 2 ^ us = 2 ^ (sz - us)
[PROOF STEP]
using qv
[PROOF STATE]
proof (prove)
using this:
sz = us + q

goal (1 subgoal):
 1. 2 ^ q + (2 ^ us - 1) div 2 ^ us = 2 ^ (sz - us)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 ^ q + (2 ^ us - 1) div 2 ^ us = 2 ^ (sz - us)

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Suc (unat ((2 ^ sz - 1) div 2 ^ us)) = 2 ^ (sz - us)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Suc (unat ((2 ^ sz - 1) div 2 ^ us)) = 2 ^ (sz - us)

goal (1 subgoal):
 1. 2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
2 ^ (sz - us) = Suc (unat ((2 ^ sz - 1) div 2 ^ us))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in field) univ_poly_carrier_subfield_of_consts:
  "subfield (poly_of_const ` (carrier R)) ((carrier R)[X])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subfield (poly_of_const ` carrier R) (carrier R [X])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. subfield (poly_of_const ` carrier R) (carrier R [X])
[PROOF STEP]
have ring_hom: "ring_hom_ring R ((carrier R)[X]) poly_of_const"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ring_hom_ring R (carrier R [X]) poly_of_const
[PROOF STEP]
using canonical_embedding_ring_hom[OF carrier_is_subring]
[PROOF STATE]
proof (prove)
using this:
ring_hom_ring (R\<lparr>carrier := carrier R\<rparr>) (carrier R [X]) poly_of_const

goal (1 subgoal):
 1. ring_hom_ring R (carrier R [X]) poly_of_const
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ring_hom_ring R (carrier R [X]) poly_of_const

goal (1 subgoal):
 1. subfield (poly_of_const ` carrier R) (carrier R [X])
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
ring_hom_ring R (carrier R [X]) poly_of_const

goal (1 subgoal):
 1. subfield (poly_of_const ` carrier R) (carrier R [X])
[PROOF STEP]
using ring_hom_ring.img_is_subfield(2)[OF ring_hom carrier_is_subfield]
[PROOF STATE]
proof (prove)
using this:
ring_hom_ring R (carrier R [X]) poly_of_const
\<one>\<^bsub>carrier R [X]\<^esub> \<noteq> \<zero>\<^bsub>carrier R [X]\<^esub> \<Longrightarrow> subfield (poly_of_const ` carrier R) (carrier R [X])

goal (1 subgoal):
 1. subfield (poly_of_const ` carrier R) (carrier R [X])
[PROOF STEP]
unfolding univ_poly_def
[PROOF STATE]
proof (prove)
using this:
ring_hom_ring R \<lparr>carrier = Collect (polynomial (carrier R)), monoid.mult = poly_mult, one = [\<one>], zero = [], add = poly_add\<rparr> poly_of_const
\<one>\<^bsub>\<lparr>carrier = Collect (polynomial (carrier R)), monoid.mult = poly_mult, one = [\<one>], zero = [], add = poly_add\<rparr>\<^esub> \<noteq> \<zero>\<^bsub>\<lparr>carrier = Collect (polynomial (carrier R)), monoid.mult = poly_mult, one = [\<one>], zero = [], add = poly_add\<rparr>\<^esub> \<Longrightarrow> subfield (poly_of_const ` carrier R) \<lparr>carrier = Collect (polynomial (carrier R)), monoid.mult = poly_mult, one = [\<one>], zero = [], add = poly_add\<rparr>

goal (1 subgoal):
 1. subfield (poly_of_const ` carrier R) \<lparr>carrier = Collect (polynomial (carrier R)), monoid.mult = poly_mult, one = [\<one>], zero = [], add = poly_add\<rparr>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
subfield (poly_of_const ` carrier R) (carrier R [X])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reals_Archimedean2: "\<exists>n. x < of_nat n"
  for x :: "'a::archimedean_field"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
obtain z where "x < of_int z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>z. x < of_int z \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ex_less_of_int
[PROOF STATE]
proof (prove)
using this:
\<exists>z. ?x < of_int z

goal (1 subgoal):
 1. (\<And>z. x < of_int z \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
x < of_int z

goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x < of_int z

goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
have "\<dots> \<le> of_int (int (nat z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int z \<le> of_int (int (nat z))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
of_int z \<le> of_int (int (nat z))

goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
of_int z \<le> of_int (int (nat z))

goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
have "\<dots> = of_nat (nat z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (int (nat z)) = of_nat (nat z)
[PROOF STEP]
by (simp only: of_int_of_nat_eq)
[PROOF STATE]
proof (state)
this:
of_int (int (nat z)) = of_nat (nat z)

goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x < of_nat (nat z)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x < of_nat (nat z)

goal (1 subgoal):
 1. \<exists>n. x < of_nat n
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>n. x < of_nat n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma loc_imps_fw_M_nonneg[simp]:
  assumes "loc_imps_fw c loc1 loc2 M xs"
    and   "inv_implications_nonneg c"
  shows "0 \<le> zcount M t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> zcount M t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
loc_imps_fw c loc1 loc2 M xs
inv_implications_nonneg c

goal (1 subgoal):
 1. 0 \<le> zcount M t
[PROOF STEP]
by (induct arbitrary: t rule: loc_imps_fw.induct)
    (auto intro!: add_nonneg_nonneg sum_nonneg simp: zcount_image_zmset assms(2)[unfolded inv_implications_nonneg_def])


[STATEMENT]
lemma IJ_iff: "u \<in> IJ k \<longleftrightarrow> (\<exists>j i. u = (j,i) \<and> i<j \<and> j\<le>k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> IJ k) = (\<exists>j i. u = (j, i) \<and> i < j \<and> j \<le> k)
[PROOF STEP]
by (auto simp: IJ_def)


[STATEMENT]
lemma bigo_useful_intro: "A <= O(f) \<Longrightarrow> B <= O(f) \<Longrightarrow>
  A + B <= O(f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> O(f); B \<subseteq> O(f)\<rbrakk> \<Longrightarrow> A + B \<subseteq> O(f)
[PROOF STEP]
apply (subst bigo_plus_idemp [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> O(f); B \<subseteq> O(f)\<rbrakk> \<Longrightarrow> A + B \<subseteq> O(f) + O(f)
[PROOF STEP]
apply (rule set_plus_mono2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>A \<subseteq> O(f); B \<subseteq> O(f)\<rbrakk> \<Longrightarrow> A \<subseteq> O(f)
 2. \<lbrakk>A \<subseteq> O(f); B \<subseteq> O(f)\<rbrakk> \<Longrightarrow> B \<subseteq> O(f)
[PROOF STEP]
apply assumption+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma abs_Re_le_cmod: "\<bar>Re x\<bar> \<le> cmod x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>Re x\<bar> \<le> cmod x
[PROOF STEP]
by (simp add: norm_complex_def)


[STATEMENT]
lemma interval_extension_floor: "interval_extension1 (\<lambda>ivl. Some (floor_float_interval ivl)) floor"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_extension1 (\<lambda>ivl. Some (floor_float_interval ivl)) (\<lambda>x. real_of_int \<lfloor>x\<rfloor>)
[PROOF STEP]
by (auto simp: interval_extension1_def floor_float_intervalI)


[STATEMENT]
lemma "m = (MatchAnd (MatchAnd MatchAny MatchAny) (MatchAnd MatchAny MatchAny)) \<Longrightarrow>
  (opt_MatchAny_match_expr_once^^2) m \<noteq> opt_MatchAny_match_expr_once m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m = MatchAnd (MatchAnd MatchAny MatchAny) (MatchAnd MatchAny MatchAny) \<Longrightarrow> (opt_MatchAny_match_expr_once ^^ 2) m \<noteq> opt_MatchAny_match_expr_once m
[PROOF STEP]
by(simp add: funpow_def)


[STATEMENT]
lemma const_to_constant:
  assumes "a \<in> carrier R"
  shows "to_fun (monom P a 0) = constant_function (carrier R) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_fun (monom P a 0) = constant_function (carrier R) a
[PROOF STEP]
apply(rule ring_functions.function_ring_car_eqI[of R _ "carrier R"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. ring_functions R
 2. to_fun (monom P a 0) \<in> carrier (function_ring (carrier R) R)
 3. constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)
 4. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
unfolding ring_functions_def
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. ring R
 2. to_fun (monom P a 0) \<in> carrier (function_ring (carrier R) R)
 3. constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)
 4. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
apply(simp add: R.ring_axioms)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. to_fun (monom P a 0) \<in> carrier (function_ring (carrier R) R)
 2. constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)
 3. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
apply (simp add: assms to_fun_is_Fun)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)
 2. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
using assms ring_functions.constant_function_closed[of R a "carrier R"]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
\<lbrakk>ring_functions R; a \<in> carrier R\<rbrakk> \<Longrightarrow> constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)

goal (2 subgoals):
 1. constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)
 2. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
unfolding ring_functions_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
\<lbrakk>ring R; a \<in> carrier R\<rbrakk> \<Longrightarrow> constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)

goal (2 subgoals):
 1. constant_function (carrier R) a \<in> carrier (function_ring (carrier R) R)
 2. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
apply (simp add: R.ring_axioms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
using assms to_fun_const[of a ]
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
\<lbrakk>a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun (monom P a 0) ?b = a

goal (1 subgoal):
 1. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = constant_function (carrier R) a aa
[PROOF STEP]
unfolding constant_function_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
\<lbrakk>a \<in> carrier R; ?b \<in> carrier R\<rbrakk> \<Longrightarrow> to_fun (monom P a 0) ?b = a

goal (1 subgoal):
 1. \<And>aa. aa \<in> carrier R \<Longrightarrow> to_fun (monom P a 0) aa = (\<lambda>x\<in>carrier R. a) aa
[PROOF STEP]
by auto


[STATEMENT]
lemma measurable_THE_select_first[measurable]:
  "(\<lambda>p. The (select_first x p)) \<in> (\<Pi>\<^sub>M y\<in>I x. borel) \<rightarrow>\<^sub>M count_space UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>p. The (select_first x p)) \<in> Pi\<^sub>M (I x) (\<lambda>y. borel) \<rightarrow>\<^sub>M count_space UNIV
[PROOF STEP]
by (rule measurable_THE) (auto intro: select_first_unique I_countable dest: select_firstD1)


[STATEMENT]
lemma (in Group) PrSubg4_2:"\<lbrakk>G \<guillemotright> H; a \<in> carrier G; x \<in> H \<bullet> (\<rho> a)\<rbrakk> \<Longrightarrow>
       x \<in> {z. \<exists>v\<in>(H \<bullet> a). \<exists>h\<in>H. h \<cdot> (\<rho> v) = z}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<guillemotright> H ; a \<in> carrier G; x \<in> H \<bullet> \<rho> a\<rbrakk> \<Longrightarrow> x \<in> {z. \<exists>v\<in>H \<bullet> a. \<exists>h\<in>H. h \<cdot> \<rho> v = z}
[PROOF STEP]
apply (simp add:rcs_def[of _ "H" "\<rho> a"], erule bexE,
       frule_tac h = h in sg_subset_elem[of "H"], assumption+,
       frule i_closed[of "a"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>h. \<lbrakk>G \<guillemotright> H ; a \<in> carrier G; h \<in> H; h \<cdot> \<rho> a = x; h \<in> carrier G; \<rho> a \<in> carrier G\<rbrakk> \<Longrightarrow> \<exists>v\<in>H \<bullet> a. \<exists>h\<in>H. h \<cdot> \<rho> v = x
[PROOF STEP]
apply (frule a_in_rcs[of "H" "a"], assumption, blast)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma norm_prod_le:
  "norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a :: 'a :: {real_normed_algebra_1,comm_monoid_mult}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
[PROOF STEP]
proof (induct A rule: infinite_finite_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. norm (prod f {}) \<le> (\<Prod>a\<in>{}. norm (f a))
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. norm (prod f {}) \<le> (\<Prod>a\<in>{}. norm (f a))
 3. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (prod f {}) \<le> (\<Prod>a\<in>{}. norm (f a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (prod f {}) \<le> (\<Prod>a\<in>{}. norm (f a))

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite A
a \<notin> A
norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
[PROOF STEP]
have "norm (prod f (insert a A)) \<le> norm (f a) * norm (prod f A)"
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A
norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))

goal (1 subgoal):
 1. norm (prod f (insert a A)) \<le> norm (f a) * norm (prod f A)
[PROOF STEP]
by (simp add: norm_mult_ineq)
[PROOF STATE]
proof (state)
this:
norm (prod f (insert a A)) \<le> norm (f a) * norm (prod f A)

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (prod f (insert a A)) \<le> norm (f a) * norm (prod f A)

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
have "norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
[PROOF STEP]
by (rule insert)
[PROOF STATE]
proof (state)
this:
norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))

goal (2 subgoals):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; norm (prod f F) \<le> (\<Prod>a\<in>F. norm (f a))\<rbrakk> \<Longrightarrow> norm (prod f (insert x F)) \<le> (\<Prod>a\<in>insert x F. norm (f a))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> norm (f a) * x \<le> norm (f a) * y) \<Longrightarrow> norm (prod f (insert a A)) \<le> norm (f a) * (\<Prod>a\<in>A. norm (f a))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> norm (f a) * x \<le> norm (f a) * y) \<Longrightarrow> norm (prod f (insert a A)) \<le> norm (f a) * (\<Prod>a\<in>A. norm (f a))

goal (1 subgoal):
 1. norm (prod f (insert a A)) \<le> (\<Prod>a\<in>insert a A. norm (f a))
[PROOF STEP]
by (simp add: insert mult_left_mono)
[PROOF STATE]
proof (state)
this:
norm (prod f (insert a A)) \<le> (\<Prod>a\<in>insert a A. norm (f a))

goal (1 subgoal):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
[PROOF STEP]
case infinite
[PROOF STATE]
proof (state)
this:
infinite A_

goal (1 subgoal):
 1. \<And>A. infinite A \<Longrightarrow> norm (prod f A) \<le> (\<Prod>a\<in>A. norm (f a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite A_
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
infinite A_

goal (1 subgoal):
 1. norm (prod f A_) \<le> (\<Prod>a\<in>A_. norm (f a))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
norm (prod f A_) \<le> (\<Prod>a\<in>A_. norm (f a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inf_prefix_length_take_correct: "
  n \<le> inf_prefix_length xs ys \<Longrightarrow> xs \<down> n = ys \<down> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> inf_prefix_length xs ys \<Longrightarrow> xs \<down> n = ys \<down> n
[PROOF STEP]
apply (frule order_trans[OF _ inf_prefix_length_leL])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> inf_prefix_length xs ys; n \<le> length xs\<rbrakk> \<Longrightarrow> xs \<down> n = ys \<down> n
[PROOF STEP]
apply (frule order_trans[OF _ inf_prefix_length_leR])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> inf_prefix_length xs ys; n \<le> length xs; n \<le> length ys\<rbrakk> \<Longrightarrow> xs \<down> n = ys \<down> n
[PROOF STEP]
apply (simp add: list_eq_iff inf_prefix_length_correct)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma normalize_lcm [simp]: "normalize (lcm a b) = lcm a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (lcm a b) = lcm a b
[PROOF STEP]
by (simp add: lcm_gcd dvd_normalize_div)


[STATEMENT]
lemma count_subset_le:
  "xs |\<subseteq>| ys \<Longrightarrow> count (\<Sum>x \<in> fset xs. f x) a \<le> count (\<Sum>x \<in> fset ys. f x) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a
[PROOF STEP]
proof(induction ys arbitrary: xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs. xs |\<subseteq>| {||} \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset {||})) a
 2. \<And>x ys xs. \<lbrakk>x |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert x ys\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert x ys))) a
[PROOF STEP]
case (insert y ys)
[PROOF STATE]
proof (state)
this:
y |\<notin>| ys
?xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset ?xs)) a \<le> count (sum f (fset ys)) a
xs |\<subseteq>| finsert y ys

goal (2 subgoals):
 1. \<And>xs. xs |\<subseteq>| {||} \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset {||})) a
 2. \<And>x ys xs. \<lbrakk>x |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert x ys\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert x ys))) a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y |\<notin>| ys
?xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset ?xs)) a \<le> count (sum f (fset ys)) a
xs |\<subseteq>| finsert y ys
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
y |\<notin>| ys
?xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset ?xs)) a \<le> count (sum f (fset ys)) a
xs |\<subseteq>| finsert y ys

goal (1 subgoal):
 1. count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
proof(cases "y |\<in>| xs")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
y |\<in>| xs

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y |\<in>| xs
[PROOF STEP]
obtain xs' where xs'_def: "finsert y xs' = xs" "y |\<notin>| xs'"
[PROOF STATE]
proof (prove)
using this:
y |\<in>| xs

goal (1 subgoal):
 1. (\<And>xs'. \<lbrakk>finsert y xs' = xs; y |\<notin>| xs'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
finsert y xs' = xs
y |\<notin>| xs'

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finsert y xs' = xs
y |\<notin>| xs'
[PROOF STEP]
have "xs' |\<subseteq>| ys"
[PROOF STATE]
proof (prove)
using this:
finsert y xs' = xs
y |\<notin>| xs'

goal (1 subgoal):
 1. xs' |\<subseteq>| ys
[PROOF STEP]
using insert.prems
[PROOF STATE]
proof (prove)
using this:
finsert y xs' = xs
y |\<notin>| xs'
xs |\<subseteq>| finsert y ys

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

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
have "count (\<Sum>x \<in> fset xs. f x) a = count (\<Sum>x \<in> fset xs'. f x) a + count (f y) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (sum f (fset xs)) a = count (sum f (fset xs')) a + count (f y) a
[PROOF STEP]
using xs'_def
[PROOF STATE]
proof (prove)
using this:
finsert y xs' = xs
y |\<notin>| xs'

goal (1 subgoal):
 1. count (sum f (fset xs)) a = count (sum f (fset xs')) a + count (f y) a
[PROOF STEP]
by (auto simp: notin_fset)
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs)) a = count (sum f (fset xs')) a + count (f y) a

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs)) a = count (sum f (fset xs')) a + count (f y) a

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
have "\<dots> \<le> count (\<Sum>x \<in> fset ys. f x) a + count (f y) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (sum f (fset xs')) a + count (f y) a \<le> count (sum f (fset ys)) a + count (f y) a
[PROOF STEP]
using \<open>xs' |\<subseteq>| ys\<close> insert.IH
[PROOF STATE]
proof (prove)
using this:
xs' |\<subseteq>| ys
?xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset ?xs)) a \<le> count (sum f (fset ys)) a

goal (1 subgoal):
 1. count (sum f (fset xs')) a + count (f y) a \<le> count (sum f (fset ys)) a + count (f y) a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs')) a + count (f y) a \<le> count (sum f (fset ys)) a + count (f y) a

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs')) a + count (f y) a \<le> count (sum f (fset ys)) a + count (f y) a

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
have "\<dots> = count (\<Sum>x \<in> fset (finsert y ys). f x) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count (sum f (fset ys)) a + count (f y) a = count (sum f (fset (finsert y ys))) a
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
y |\<notin>| ys

goal (1 subgoal):
 1. count (sum f (fset ys)) a + count (f y) a = count (sum f (fset (finsert y ys))) a
[PROOF STEP]
by (auto simp: notin_fset)
[PROOF STATE]
proof (state)
this:
count (sum f (fset ys)) a + count (f y) a = count (sum f (fset (finsert y ys))) a

goal (2 subgoals):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<in>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
 2. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a

goal (1 subgoal):
 1. count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a

goal (1 subgoal):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
y |\<notin>| xs

goal (1 subgoal):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y |\<notin>| xs
[PROOF STEP]
have "count (\<Sum>x \<in> fset xs. f x) a \<le> count (\<Sum>x \<in> fset ys. f x) a"
[PROOF STATE]
proof (prove)
using this:
y |\<notin>| xs

goal (1 subgoal):
 1. count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a
[PROOF STEP]
using insert.prems insert.IH
[PROOF STATE]
proof (prove)
using this:
y |\<notin>| xs
xs |\<subseteq>| finsert y ys
?xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset ?xs)) a \<le> count (sum f (fset ys)) a

goal (1 subgoal):
 1. count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a

goal (1 subgoal):
 1. \<lbrakk>y |\<notin>| ys; \<And>xs. xs |\<subseteq>| ys \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a; xs |\<subseteq>| finsert y ys; y |\<notin>| xs\<rbrakk> \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a

goal (1 subgoal):
 1. count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
using insert.hyps
[PROOF STATE]
proof (prove)
using this:
count (sum f (fset xs)) a \<le> count (sum f (fset ys)) a
y |\<notin>| ys

goal (1 subgoal):
 1. count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a
[PROOF STEP]
by (auto simp: notin_fset)
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
count (sum f (fset xs)) a \<le> count (sum f (fset (finsert y ys))) a

goal (1 subgoal):
 1. \<And>xs. xs |\<subseteq>| {||} \<Longrightarrow> count (sum f (fset xs)) a \<le> count (sum f (fset {||})) a
[PROOF STEP]
qed(simp)


[STATEMENT]
lemma if_bool_simps:
  "If p True y = (p \<or> y) \<and> If p False y = (\<not> p \<and> y) \<and>
    If p y True = (p \<longrightarrow> y) \<and> If p y False = (p \<and> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if p then True else y) = (p \<or> y) \<and> (if p then False else y) = (\<not> p \<and> y) \<and> (if p then y else True) = (p \<longrightarrow> y) \<and> (if p then y else False) = (p \<and> y)
[PROOF STEP]
by auto


[STATEMENT]
lemma mpoly_map_vars_prod [simp]: "mpoly_map_vars f (prod g A) = (\<Prod>x\<in>A. mpoly_map_vars f (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpoly_map_vars f (prod g A) = (\<Prod>x\<in>A. mpoly_map_vars f (g x))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) auto


[STATEMENT]
lemma inorder_insert:
  "sorted(inorder t) \<Longrightarrow> inorder(insert x t) = ins_list x (inorder t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sorted_Less.sorted (Tree2.inorder t) \<Longrightarrow> Tree2.inorder (insert x t) = ins_list x (Tree2.inorder t)
[PROOF STEP]
by(induction t) (auto simp: ins_list_simps inorder_split inorder_skew)


[STATEMENT]
lemma if_SE_D1 : "P \<sigma> \<Longrightarrow> (\<sigma> \<Turnstile> (if\<^sub>S\<^sub>E P then B\<^sub>1 else B\<^sub>2 fi)) = (\<sigma> \<Turnstile> B\<^sub>1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<sigma> \<Longrightarrow> (\<sigma> \<Turnstile> _if_SE P B\<^sub>1 B\<^sub>2) = (\<sigma> \<Turnstile> B\<^sub>1)
[PROOF STEP]
by(auto simp: if_SE_def valid_SE_def)


[STATEMENT]
lemma min_height_bal:
  "\<lbrakk> n \<le> length xs; bal n xs = (t,zs) \<rbrakk> \<Longrightarrow> min_height t = nat(\<lfloor>log 2 (n + 1)\<rfloor>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> length xs; bal n xs = (t, zs)\<rbrakk> \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
proof(induction n arbitrary: xs t zs rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs t zs. \<lbrakk>\<And>y xs t zs. \<lbrakk>y < x; y \<le> length xs; bal y xs = (t, zs)\<rbrakk> \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (y + 1))\<rfloor>; x \<le> length xs; bal x xs = (t, zs)\<rbrakk> \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (x + 1))\<rfloor>
[PROOF STEP]
case (less n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>?y < n; ?y \<le> length ?xs; bal ?y ?xs = (?t, ?zs)\<rbrakk> \<Longrightarrow> min_height ?t = nat \<lfloor>log 2 (real (?y + 1))\<rfloor>
n \<le> length xs
bal n xs = (t, zs)

goal (1 subgoal):
 1. \<And>x xs t zs. \<lbrakk>\<And>y xs t zs. \<lbrakk>y < x; y \<le> length xs; bal y xs = (t, zs)\<rbrakk> \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (y + 1))\<rfloor>; x \<le> length xs; bal x xs = (t, zs)\<rbrakk> \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (x + 1))\<rfloor>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
 2. \<not> ?P \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
assume "n = 0"
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
 2. \<not> ?P \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
using less.prems(2)
[PROOF STATE]
proof (prove)
using this:
n = 0
bal n xs = (t, zs)

goal (1 subgoal):
 1. min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
by (simp add: bal_simps)
[PROOF STATE]
proof (state)
this:
min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
assume [arith]: "n \<noteq> 0"
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
let ?m = "n div 2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
let ?m' = "n - 1 - ?m"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
from less.prems
[PROOF STATE]
proof (chain)
picking this:
n \<le> length xs
bal n xs = (t, zs)
[PROOF STEP]
obtain l r ys where
      b1: "bal ?m xs = (l,ys)" and
      b2: "bal ?m' (tl ys) = (r,zs)" and
      t: "t = \<langle>l, hd ys, r\<rangle>"
[PROOF STATE]
proof (prove)
using this:
n \<le> length xs
bal n xs = (t, zs)

goal (1 subgoal):
 1. (\<And>l ys r. \<lbrakk>bal (n div 2) xs = (l, ys); bal (n - 1 - n div 2) (tl ys) = (r, zs); t = \<langle>l, hd ys, r\<rangle>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by(auto simp: bal_simps split: prod.splits)
[PROOF STATE]
proof (state)
this:
bal (n div 2) xs = (l, ys)
bal (n - 1 - n div 2) (tl ys) = (r, zs)
t = \<langle>l, hd ys, r\<rangle>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
let ?hl = "nat (floor(log 2 (?m + 1)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
let ?hr = "nat (floor(log 2 (?m' + 1)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have IH1: "min_height l = ?hl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_height l = nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>
[PROOF STEP]
using less.IH[OF _ _ b1] less.prems(1)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n div 2 < n; n div 2 \<le> length xs\<rbrakk> \<Longrightarrow> min_height l = nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>
n \<le> length xs

goal (1 subgoal):
 1. min_height l = nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
min_height l = nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have IH2: "min_height r = ?hr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_height r = nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>
[PROOF STEP]
using less.prems(1) bal_length[OF _ b1] b2
[PROOF STATE]
proof (prove)
using this:
n \<le> length xs
n div 2 \<le> length xs \<Longrightarrow> length ys = length xs - n div 2
bal (n - 1 - n div 2) (tl ys) = (r, zs)

goal (1 subgoal):
 1. min_height r = nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>
[PROOF STEP]
by(intro less.IH) auto
[PROOF STATE]
proof (state)
this:
min_height r = nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have "(n+1) div 2 \<ge> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<le> (n + 1) div 2
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
1 \<le> (n + 1) div 2

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
hence 0: "log 2 ((n+1) div 2) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
1 \<le> (n + 1) div 2

goal (1 subgoal):
 1. 0 \<le> log 2 (real ((n + 1) div 2))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> log 2 (real ((n + 1) div 2))

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have "?m' \<le> ?m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - 1 - n div 2 \<le> n div 2
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
n - 1 - n div 2 \<le> n div 2

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
hence le: "?hr \<le> ?hl"
[PROOF STATE]
proof (prove)
using this:
n - 1 - n div 2 \<le> n div 2

goal (1 subgoal):
 1. nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor> \<le> nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>
[PROOF STEP]
by(simp add: nat_mono floor_mono)
[PROOF STATE]
proof (state)
this:
nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor> \<le> nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have "min_height t = min ?hl ?hr + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min_height t = min (nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>) (nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>) + 1
[PROOF STEP]
by (simp add: t IH1 IH2)
[PROOF STATE]
proof (state)
this:
min_height t = min (nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>) (nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
min_height t = min (nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>) (nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>) + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have "\<dots> = ?hr + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>) (nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>) + 1 = nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor> + 1
[PROOF STEP]
using le
[PROOF STATE]
proof (prove)
using this:
nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor> \<le> nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>

goal (1 subgoal):
 1. min (nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>) (nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>) + 1 = nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor> + 1
[PROOF STEP]
by (simp add: min_absorb2)
[PROOF STATE]
proof (state)
this:
min (nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>) (nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>) + 1 = nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor> + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
min (nat \<lfloor>log 2 (real (n div 2 + 1))\<rfloor>) (nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor>) + 1 = nat \<lfloor>log 2 (real (n - 1 - n div 2 + 1))\<rfloor> + 1

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have "?m' + 1 = (n+1) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n - 1 - n div 2 + 1 = (n + 1) div 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
n - 1 - n div 2 + 1 = (n + 1) div 2

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
n - 1 - n div 2 + 1 = (n + 1) div 2

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have "nat (floor(log 2 ((n+1) div 2))) + 1
       = nat (floor(log 2 ((n+1) div 2) + 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat \<lfloor>log 2 (real ((n + 1) div 2))\<rfloor> + 1 = nat \<lfloor>log 2 (real ((n + 1) div 2)) + 1\<rfloor>
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
0 \<le> log 2 (real ((n + 1) div 2))

goal (1 subgoal):
 1. nat \<lfloor>log 2 (real ((n + 1) div 2))\<rfloor> + 1 = nat \<lfloor>log 2 (real ((n + 1) div 2)) + 1\<rfloor>
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
nat \<lfloor>log 2 (real ((n + 1) div 2))\<rfloor> + 1 = nat \<lfloor>log 2 (real ((n + 1) div 2)) + 1\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat \<lfloor>log 2 (real ((n + 1) div 2))\<rfloor> + 1 = nat \<lfloor>log 2 (real ((n + 1) div 2)) + 1\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
have "\<dots> = nat (floor(log 2 (n + 1)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat \<lfloor>log 2 (real ((n + 1) div 2)) + 1\<rfloor> = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
using floor_log2_div2[of "n+1"]
[PROOF STATE]
proof (prove)
using this:
2 \<le> n + 1 \<Longrightarrow> \<lfloor>log 2 (real (n + 1))\<rfloor> = \<lfloor>log 2 (real ((n + 1) div 2))\<rfloor> + 1

goal (1 subgoal):
 1. nat \<lfloor>log 2 (real ((n + 1) div 2)) + 1\<rfloor> = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
by (simp add: log_mult)
[PROOF STATE]
proof (state)
this:
nat \<lfloor>log 2 (real ((n + 1) div 2)) + 1\<rfloor> = nat \<lfloor>log 2 (real (n + 1))\<rfloor>

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>

goal (1 subgoal):
 1. min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
min_height t = nat \<lfloor>log 2 (real (n + 1))\<rfloor>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cons_in_list_Suc [iff]:
  "(x#xs \<in> list (Suc n) A) = (x\<in> A & xs \<in> list n A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs \<in> list (Suc n) A) = (x \<in> A \<and> xs \<in> list n A)
[PROOF STEP]
apply (simp add: in_list_Suc_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
theorem th2_12:
    assumes "q \<noteq> a"
    shows "\<exists>!x. B q a x \<and> a x \<congruent> b c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!x. B q a x \<and> a x \<equiv> b c
[PROOF STEP]
using \<open>q \<noteq> a\<close> and A4' and A4_unique
[PROOF STATE]
proof (prove)
using this:
q \<noteq> a
\<exists>x. B ?q ?a x \<and> ?a x \<equiv> ?b ?c
\<lbrakk>?q \<noteq> ?a; B ?q ?a ?x; ?a ?x \<equiv> ?b ?c; B ?q ?a ?x'; ?a ?x' \<equiv> ?b ?c\<rbrakk> \<Longrightarrow> ?x = ?x'

goal (1 subgoal):
 1. \<exists>!x. B q a x \<and> a x \<equiv> b c
[PROOF STEP]
by blast


[STATEMENT]
lemma mat_hom_one: "mat\<^sub>h (1\<^sub>m n) = 1\<^sub>m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat\<^sub>h (1\<^sub>m n) = 1\<^sub>m n
[PROOF STEP]
by (rule eq_matI, auto)


[STATEMENT]
lemma "(\<forall>x. P a \<and> (P x \<longrightarrow> P b)\<longrightarrow>P c)  =
      (\<forall>x. (\<not>P a \<or> P x \<or> P c) \<and> (\<not>P a \<or> \<not>P b \<or> P c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. P a \<and> (P x \<longrightarrow> P b) \<longrightarrow> P c) = (\<forall>x. (\<not> P a \<or> P x \<or> P c) \<and> (\<not> P a \<or> \<not> P b \<or> P c))
[PROOF STEP]
by blast


[STATEMENT]
lemma list_all2_approx:
  "list_all2 (approx_val G hp) s (map OK S) = list_all2 (conf G hp) s S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (approx_val G hp) s (map OK S) = list_all2 (conf G hp) s S
[PROOF STEP]
apply (induct S arbitrary: s)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>s. list_all2 (approx_val G hp) s (map OK []) = list_all2 (conf G hp) s []
 2. \<And>a S s. (\<And>s. list_all2 (approx_val G hp) s (map OK S) = list_all2 (conf G hp) s S) \<Longrightarrow> list_all2 (approx_val G hp) s (map OK (a # S)) = list_all2 (conf G hp) s (a # S)
[PROOF STEP]
apply (auto simp add: list_all2_Cons2 approx_val_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fls_divide_1':
  fixes   f :: "'a::{comm_monoid_add,inverse,mult_zero,uminus,zero_neq_one,monoid_mult} fls"
  assumes "inverse (1::'a) = 1"
  shows   "f / 1 = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f / 1 = f
[PROOF STEP]
using   assms fls_conv_base_factor_to_fps_shift_subdegree[of f]
[PROOF STATE]
proof (prove)
using this:
inverse (1::'a) = (1::'a)
f = fls_shift (- fls_subdegree f) (fls_regpart_as_fls (fls_base_factor f))

goal (1 subgoal):
 1. f / 1 = f
[PROOF STEP]
by      (simp add: fls_divide_def fps_divide_1')


[STATEMENT]
lemma HNatInfinite_not_Nats_iff: "x \<in> HNatInfinite \<longleftrightarrow> x \<notin> Nats"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> HNatInfinite) = (x \<notin> \<nat>)
[PROOF STEP]
by (simp add: HNatInfinite_def)


[STATEMENT]
lemma reify_ln_chain_pow:
  "\<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
have "\<Theta>(eval_primfun (LnChain n, real e)) = \<Theta>(\<lambda>x. (ln ^^ n) x powr (real e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Theta>(eval_primfun (LnChain n, real e)) = \<Theta>(\<lambda>x. (ln ^^ n) x powr real e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<Theta>(eval_primfun (LnChain n, real e)) = \<Theta>(\<lambda>x. (ln ^^ n) x powr real e)

goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Theta>(eval_primfun (LnChain n, real e)) = \<Theta>(\<lambda>x. (ln ^^ n) x powr real e)

goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
have "eventually (\<lambda>x::real. (ln ^^ n) x > 0) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x
[PROOF STEP]
using fun_chain_at_top_at_top[OF ln_at_top]
[PROOF STATE]
proof (prove)
using this:
filterlim (ln ^^ ?n) at_top at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x
[PROOF STEP]
unfolding filterlim_at_top_dense
[PROOF STATE]
proof (prove)
using this:
\<forall>Z. \<forall>\<^sub>F x in at_top. Z < (ln ^^ ?n) x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x

goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
hence "eventually (\<lambda>x. (ln ^^ n) x powr (real e) = (ln ^^ n) x ^ e) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. 0 < (ln ^^ n) x

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln ^^ n) x powr real e = (ln ^^ n) x ^ e
[PROOF STEP]
by eventually_elim (subst powr_realpow, auto)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. (ln ^^ n) x powr real e = (ln ^^ n) x ^ e

goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
hence "\<Theta>(\<lambda>x. (ln ^^ n) x powr (real e)) = \<Theta>(\<lambda>x. (ln ^^ n) x^e)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. (ln ^^ n) x powr real e = (ln ^^ n) x ^ e

goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x powr real e) = \<Theta>(\<lambda>x. (ln ^^ n) x ^ e)
[PROOF STEP]
by (rule landau_theta.cong)
[PROOF STATE]
proof (state)
this:
\<Theta>(\<lambda>x. (ln ^^ n) x powr real e) = \<Theta>(\<lambda>x. (ln ^^ n) x ^ e)

goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<Theta>(eval_primfun (LnChain n, real e)) = \<Theta>(\<lambda>x. (ln ^^ n) x ^ e)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Theta>(eval_primfun (LnChain n, real e)) = \<Theta>(\<lambda>x. (ln ^^ n) x ^ e)

goal (1 subgoal):
 1. \<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<Theta>(\<lambda>x. (ln ^^ n) x ^ e) = \<Theta>(eval_primfun (LnChain n, real e))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_echelon_form_of_upt_k_det:
  fixes A::"'a::{bezout_domain}^'n::{mod_type}^'n::{mod_type}"
  assumes ib: "is_bezout_ext bezout"
  shows "fst ((echelon_form_of_upt_k_det bezout) (1::'a,A) k) *  det A
  = det (snd ((echelon_form_of_upt_k_det bezout) (1::'a,A) k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k))
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. fst (echelon_form_of_upt_k_det bezout (1::'a, A) 0) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) 0))
 2. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. fst (echelon_form_of_upt_k_det bezout (1::'a, A) 0) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) 0))
 2. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_upt_k_det bezout (1::'a, A) 0) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) 0))
[PROOF STEP]
unfolding echelon_form_of_upt_k_det_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc 0]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc 0]))) * det A = det (snd (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc 0]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc 0]))))
[PROOF STEP]
by (auto, rule det_echelon_form_of_column_k_det[OF ib], simp)
[PROOF STATE]
proof (state)
this:
fst (echelon_form_of_upt_k_det bezout (1::'a, A) 0) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) 0))

goal (1 subgoal):
 1. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k))

goal (1 subgoal):
 1. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
let ?f = "foldl (echelon_form_of_column_k_det bezout) (1,A,0) [0..<Suc k]"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
have Suc_rw: "[0..<Suc (Suc k)] = [0..<(Suc k)] @ [Suc k]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
[0..<Suc (Suc k)] = [0..<Suc k] @ [Suc k]

goal (1 subgoal):
 1. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
have fold_expand: "?f = (fst ?f, fst (snd ?f), snd (snd ?f))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k] = (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])), snd (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k] = (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])), snd (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])))

goal (1 subgoal):
 1. \<And>k. fst (echelon_form_of_upt_k_det bezout (1::'a, A) k) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) k)) \<Longrightarrow> fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))
[PROOF STEP]
unfolding echelon_form_of_upt_k_det_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc (Suc k)]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc (Suc k)]))) * det A = det (snd (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc (Suc k)]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, snd (1::'a, A), 0) [0..<Suc (Suc k)]))))
[PROOF STEP]
unfolding Suc_rw foldl_append List.foldl.simps fst_conv snd_conv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]) (Suc k)) * det A = det (fst (snd (echelon_form_of_column_k_det bezout (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]) (Suc k))))
[PROOF STEP]
apply (subst (1 2) fold_expand)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (echelon_form_of_column_k_det bezout (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])), snd (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]))) (Suc k)) * det A = det (fst (snd (echelon_form_of_column_k_det bezout (fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]), fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])), snd (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]))) (Suc k))))
[PROOF STEP]
apply (rule det_echelon_form_of_column_k_det)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. is_bezout_ext bezout
 2. fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]) * det A = det (fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])))
[PROOF STEP]
apply (rule ib)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]) * det A = det (fst (snd (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k])))
[PROOF STEP]
apply (subst (1) snd_foldl_ef_det_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (foldl (echelon_form_of_column_k_det bezout) (1::'a, A, 0) [0..<Suc k]) * det A = det (fst (foldl (echelon_form_of_column_k bezout) (A, 0) [0..<Suc k]))
[PROOF STEP]
by (metis Suc.hyps echelon_form_of_upt_k_det_def fst_conv snd_conv snd_foldl_ef_det_eq)
[PROOF STATE]
proof (state)
this:
fst (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)) * det A = det (snd (echelon_form_of_upt_k_det bezout (1::'a, A) (Suc k)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma left_invertible_inj:
  "(\<forall>x . g (f x) = x) \<Longrightarrow> inj f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. g (f x) = x \<Longrightarrow> inj f
[PROOF STEP]
by (metis injI)


[STATEMENT]
lemma fusc'_unfold: "fusc' = 1 ## (fusc + fusc' - 2 * (fusc mod fusc'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fusc' = 1 ## fusc + fusc' - 2 * (fusc mod fusc')
[PROOF STEP]
by(subst fusc'.code)(simp add: fusc_def)


[STATEMENT]
lemma triple_star:
  assumes "is_inj x"
      and "is_p_fun x"
    shows "x\<^sup>\<star>;x\<^sup>T\<^sup>\<star>;x\<^sup>\<star> = x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>\<star> ; x\<^sup>T\<^sup>\<star> ; x\<^sup>\<star> = x\<^sup>\<star> + x\<^sup>T\<^sup>\<star>
[PROOF STEP]
by (simp add: assms cancel_separate_inj_converse cancel_separate_p_fun_converse)


[STATEMENT]
lemma dtree_from_list_dverts_subset_wfdverts1':
  assumes "wf_dverts (dtree_from_list v cs)"
      and "is_subtree (Node r ys) (dtree_from_list v cs)"
      and "\<exists>as e bs. as@(r,e)#bs = cs \<and> dverts t1 \<subseteq> fst ` set ((r,e)#bs)"
    shows "dverts t1 \<subseteq> dverts (Node r ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dverts t1 \<subseteq> dverts (Node r ys)
[PROOF STEP]
using dtree_from_list_dverts_subset_wfdverts1 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dverts ?t1.0 \<subseteq> fst ` set ((?r, ?e2.0) # ?bs); wf_dverts (dtree_from_list ?v (?as @ (?r, ?e2.0) # ?bs)); is_subtree (Node ?r ?ys) (dtree_from_list ?v (?as @ (?r, ?e2.0) # ?bs))\<rbrakk> \<Longrightarrow> dverts ?t1.0 \<subseteq> dverts (Node ?r ?ys)
wf_dverts (dtree_from_list v cs)
is_subtree (Node r ys) (dtree_from_list v cs)
\<exists>as e bs. as @ (r, e) # bs = cs \<and> dverts t1 \<subseteq> fst ` set ((r, e) # bs)

goal (1 subgoal):
 1. dverts t1 \<subseteq> dverts (Node r ys)
[PROOF STEP]
by fast


[STATEMENT]
lemma fst_mult_sv [simp]:
  shows "fst (k *\<^sub>s\<^sub>v v) = k * fst v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (k *\<^sub>s\<^sub>v v) = k * fst v
[PROOF STEP]
by (cases v) simp


[STATEMENT]
lemma an_mult_commutative:
  "an(x) * an(y) = an(y) * an(x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. an x * an y = an y * an x
[PROOF STEP]
by (metis sup_commute an_dist_sup)


[STATEMENT]
theorem berlekamp_hensel:
  assumes cop: "coprime (lead_coeff f) p"
    and sf: "square_free_m f"
    and res: "berlekamp_hensel p n f = gs"
    and n: "n \<noteq> 0"
  shows "poly_mod.factorization_m (p^n) f (lead_coeff f, mset gs) \<comment> \<open>factorization mod \<open>p^n\<close>\<close>"
    and "\<And> g. g \<in> set gs \<Longrightarrow> poly_mod.Mp (p^n) g = g \<and> poly_mod.irreducible_m p g
      \<comment> \<open>normalized and \<open>irreducible\<close> even mod \<open>p\<close>\<close>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_mod.factorization_m (p ^ n) f (lead_coeff f, mset gs) &&& (\<And>g. g \<in> set gs \<Longrightarrow> poly_mod.Mp (p ^ n) g = g \<and> irreducible_m g)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly_mod.factorization_m (p ^ n) f (lead_coeff f, mset gs)
 2. \<And>g. g \<in> set gs \<Longrightarrow> poly_mod.Mp (p ^ n) g = g \<and> irreducible_m g
[PROOF STEP]
obtain c fs where "finite_field_factorization_int p f = (c,fs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>c fs. finite_field_factorization_int p f = (c, fs) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
finite_field_factorization_int p f = (c, fs)

goal (2 subgoals):
 1. poly_mod.factorization_m (p ^ n) f (lead_coeff f, mset gs)
 2. \<And>g. g \<in> set gs \<Longrightarrow> poly_mod.Mp (p ^ n) g = g \<and> irreducible_m g
[PROOF STEP]
from berlekamp_hensel_main[OF n res cop sf this]
[PROOF STATE]
proof (chain)
picking this:
poly_mod.factorization_m (p ^ n) f (lead_coeff f, mset gs)
sort (map degree fs) = sort (map degree gs)
?g \<in> set gs \<Longrightarrow> monic ?g \<and> poly_mod.Mp (p ^ n) ?g = ?g \<and> irreducible_m ?g \<and> degree_m ?g = degree ?g
[PROOF STEP]
show "poly_mod.factorization_m (p^n) f (lead_coeff f, mset gs)"
    "\<And> g. g \<in> set gs \<Longrightarrow> poly_mod.Mp (p^n) g = g \<and> poly_mod.irreducible_m p g"
[PROOF STATE]
proof (prove)
using this:
poly_mod.factorization_m (p ^ n) f (lead_coeff f, mset gs)
sort (map degree fs) = sort (map degree gs)
?g \<in> set gs \<Longrightarrow> monic ?g \<and> poly_mod.Mp (p ^ n) ?g = ?g \<and> irreducible_m ?g \<and> degree_m ?g = degree ?g

goal (1 subgoal):
 1. poly_mod.factorization_m (p ^ n) f (lead_coeff f, mset gs) &&& (\<And>g. g \<in> set gs \<Longrightarrow> poly_mod.Mp (p ^ n) g = g \<and> irreducible_m g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly_mod.factorization_m (p ^ n) f (lead_coeff f, mset gs)
?g \<in> set gs \<Longrightarrow> poly_mod.Mp (p ^ n) ?g = ?g \<and> irreducible_m ?g

goal:
No subgoals!
[PROOF STEP]
qed