[STATEMENT]
lemma algebraic_int_altdef_ipoly:
  fixes x :: "'a :: field_char_0"
  shows "algebraic_int x \<longleftrightarrow> (\<exists>p. poly (map_poly of_int p) x = 0 \<and> lead_coeff p = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_int x = (\<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
assume "algebraic_int x"
[PROOF STATE]
proof (state)
this:
algebraic_int x

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
algebraic_int x
[PROOF STEP]
obtain p where p: "lead_coeff p = 1" "\<forall>i. coeff p i \<in> \<int>" "poly p x = 0"
[PROOF STATE]
proof (prove)
using this:
algebraic_int x

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>lead_coeff p = (1::'a); \<forall>i. coeff p i \<in> \<int>; poly p x = (0::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto elim: algebraic_int.cases)
[PROOF STATE]
proof (state)
this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
define the_int where "the_int = (\<lambda>x::'a. THE r. x = of_int r)"
[PROOF STATE]
proof (state)
this:
the_int = (\<lambda>x. THE r. x = of_int r)

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
define p' where "p' = map_poly the_int p"
[PROOF STATE]
proof (state)
this:
p' = map_poly the_int p

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
have of_int_the_int: "of_int (the_int x) = x" if "x \<in> \<int>" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (the_int x) = x
[PROOF STEP]
unfolding the_int_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int (THE r. x = of_int r) = x
[PROOF STEP]
by (rule sym, rule theI') (insert that, auto simp: Ints_def)
[PROOF STATE]
proof (state)
this:
?x \<in> \<int> \<Longrightarrow> of_int (the_int ?x) = ?x

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
have the_int_0_iff: "the_int x = 0 \<longleftrightarrow> x = 0" if "x \<in> \<int>" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (the_int x = 0) = (x = (0::'a))
[PROOF STEP]
using of_int_the_int[OF that]
[PROOF STATE]
proof (prove)
using this:
of_int (the_int x) = x

goal (1 subgoal):
 1. (the_int x = 0) = (x = (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?x \<in> \<int> \<Longrightarrow> (the_int ?x = 0) = (?x = (0::'a))

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
have [simp]: "the_int 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_int (0::'a) = 0
[PROOF STEP]
by (subst the_int_0_iff) auto
[PROOF STATE]
proof (state)
this:
the_int (0::'a) = 0

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
have "map_poly of_int p' = map_poly (of_int \<circ> the_int) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly of_int p' = map_poly (of_int \<circ> the_int) p
[PROOF STEP]
by (simp add: p'_def map_poly_map_poly)
[PROOF STATE]
proof (state)
this:
map_poly of_int p' = map_poly (of_int \<circ> the_int) p

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map_poly of_int p' = map_poly (of_int \<circ> the_int) p

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
from p of_int_the_int
[PROOF STATE]
proof (chain)
picking this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)
?x \<in> \<int> \<Longrightarrow> of_int (the_int ?x) = ?x
[PROOF STEP]
have "\<dots> = p"
[PROOF STATE]
proof (prove)
using this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)
?x \<in> \<int> \<Longrightarrow> of_int (the_int ?x) = ?x

goal (1 subgoal):
 1. map_poly (of_int \<circ> the_int) p = p
[PROOF STEP]
by (subst poly_eq_iff) (auto simp: coeff_map_poly)
[PROOF STATE]
proof (state)
this:
map_poly (of_int \<circ> the_int) p = p

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map_poly of_int p' = p
[PROOF STEP]
have p_p': "map_poly of_int p' = p"
[PROOF STATE]
proof (prove)
using this:
map_poly of_int p' = p

goal (1 subgoal):
 1. map_poly of_int p' = p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
map_poly of_int p' = p

goal (2 subgoals):
 1. algebraic_int x \<Longrightarrow> \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
 2. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
show "(\<exists>p. poly (map_poly of_int p) x = 0 \<and> lead_coeff p = 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
[PROOF STEP]
proof (intro exI conjI notI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly (map_poly of_int ?p) x = (0::'a)
 2. lead_coeff ?p = 1
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)
[PROOF STEP]
show "poly (map_poly of_int p') x = 0"
[PROOF STATE]
proof (prove)
using this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)

goal (1 subgoal):
 1. poly (map_poly of_int p') x = (0::'a)
[PROOF STEP]
by (simp add: p_p')
[PROOF STATE]
proof (state)
this:
poly (map_poly of_int p') x = (0::'a)

goal (1 subgoal):
 1. lead_coeff p' = 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lead_coeff p' = 1
[PROOF STEP]
show "lead_coeff p' = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff p' = 1
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
lead_coeff p = (1::'a)
\<forall>i. coeff p i \<in> \<int>
poly p x = (0::'a)

goal (1 subgoal):
 1. lead_coeff p' = 1
[PROOF STEP]
by (simp flip: p_p' add: degree_map_poly coeff_map_poly)
[PROOF STATE]
proof (state)
this:
lead_coeff p' = 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1

goal (1 subgoal):
 1. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
assume "\<exists>p. poly (map_poly of_int p) x = 0 \<and> lead_coeff p = 1"
[PROOF STATE]
proof (state)
this:
\<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1

goal (1 subgoal):
 1. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1
[PROOF STEP]
obtain p where p: "poly (map_poly of_int p) x = 0" "lead_coeff p = 1"
[PROOF STATE]
proof (prove)
using this:
\<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1

goal (1 subgoal):
 1. (\<And>p. \<lbrakk>poly (map_poly of_int p) x = (0::'a); lead_coeff p = 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
poly (map_poly of_int p) x = (0::'a)
lead_coeff p = 1

goal (1 subgoal):
 1. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
define p' where "p' = (map_poly of_int p :: 'a poly)"
[PROOF STATE]
proof (state)
this:
p' = map_poly of_int p

goal (1 subgoal):
 1. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
from p
[PROOF STATE]
proof (chain)
picking this:
poly (map_poly of_int p) x = (0::'a)
lead_coeff p = 1
[PROOF STEP]
have "lead_coeff p' = 1" "poly p' x = 0" "\<forall>i. coeff p' i \<in> \<int>"
[PROOF STATE]
proof (prove)
using this:
poly (map_poly of_int p) x = (0::'a)
lead_coeff p = 1

goal (1 subgoal):
 1. lead_coeff p' = (1::'a) &&& poly p' x = (0::'a) &&& \<forall>i. coeff p' i \<in> \<int>
[PROOF STEP]
by (auto simp: p'_def coeff_map_poly degree_map_poly)
[PROOF STATE]
proof (state)
this:
lead_coeff p' = (1::'a)
poly p' x = (0::'a)
\<forall>i. coeff p' i \<in> \<int>

goal (1 subgoal):
 1. \<exists>p. poly (map_poly of_int p) x = (0::'a) \<and> lead_coeff p = 1 \<Longrightarrow> algebraic_int x
[PROOF STEP]
thus "algebraic_int x"
[PROOF STATE]
proof (prove)
using this:
lead_coeff p' = (1::'a)
poly p' x = (0::'a)
\<forall>i. coeff p' i \<in> \<int>

goal (1 subgoal):
 1. algebraic_int x
[PROOF STEP]
by (intro algebraic_int.intros)
[PROOF STATE]
proof (state)
this:
algebraic_int x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_Collect_prod_ta_rules:
  "finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}" (is "finite ?set")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}
[PROOF STEP]
have "?set \<subseteq> (\<lambda> (ra, rb). case ra of f ps \<rightarrow> p \<Rightarrow> case rb of g qs \<rightarrow> q \<Rightarrow> f (zip ps qs) \<rightarrow> (p, q)) ` (srules \<A> \<times> srules \<BB>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>} \<subseteq> (\<lambda>(ra, rb). case ra of f ps \<rightarrow> p \<Rightarrow> case rb of g qs \<rightarrow> q \<Rightarrow> f zip ps qs \<rightarrow> (p, q)) ` (srules \<A> \<times> srules \<BB>)
[PROOF STEP]
by (auto simp: srules_def image_iff fmember.rep_eq split!: ta_rule.splits)
       (metis ta_rule.inject zip_map_fst_snd)
[PROOF STATE]
proof (state)
this:
{f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>} \<subseteq> (\<lambda>(ra, rb). case ra of f ps \<rightarrow> p \<Rightarrow> case rb of g qs \<rightarrow> q \<Rightarrow> f zip ps qs \<rightarrow> (p, q)) ` (srules \<A> \<times> srules \<BB>)

goal (1 subgoal):
 1. finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}
[PROOF STEP]
from finite_imageI[of "srules \<A> \<times> srules \<BB>", THEN finite_subset[OF this]]
[PROOF STATE]
proof (chain)
picking this:
finite (srules \<A> \<times> srules \<BB>) \<Longrightarrow> finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite (srules \<A> \<times> srules \<BB>) \<Longrightarrow> finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}

goal (1 subgoal):
 1. finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}
[PROOF STEP]
by (auto simp: srules_def)
[PROOF STATE]
proof (state)
this:
finite {f qs \<rightarrow> (a, b) |f qs a b. f map fst qs \<rightarrow> a |\<in>| rules \<A> \<and> f map snd qs \<rightarrow> b |\<in>| rules \<BB>}

goal:
No subgoals!
[PROOF STEP]
qed

\<comment> \<open>The product automaton of the automata A and B is constructed
 by applying the rules on pairs of states\<close>


[STATEMENT]
lemma ct_suffix_take:
  assumes "ct_suffix ts ts'"
  shows "ct_suffix ((take (length ts - n) ts)) ((take (length ts' - n) ts'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ct_suffix (take (length ts - n) ts) (take (length ts' - n) ts')
[PROOF STEP]
using assms ct_list_eq_take append_eq_conv_conj
[PROOF STATE]
proof (prove)
using this:
ct_suffix ts ts'
ct_list_eq ?xs ?ys \<Longrightarrow> ct_list_eq (take ?n ?xs) (take ?n ?ys)
(?xs @ ?ys = ?zs) = (?xs = take (length ?xs) ?zs \<and> ?ys = drop (length ?xs) ?zs)

goal (1 subgoal):
 1. ct_suffix (take (length ts - n) ts) (take (length ts' - n) ts')
[PROOF STEP]
unfolding ct_suffix_def
[PROOF STATE]
proof (prove)
using this:
\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts
ct_list_eq ?xs ?ys \<Longrightarrow> ct_list_eq (take ?n ?xs) (take ?n ?ys)
(?xs @ ?ys = ?zs) = (?xs = take (length ?xs) ?zs \<and> ?ys = drop (length ?xs) ?zs)

goal (1 subgoal):
 1. \<exists>as bs. take (length ts' - n) ts' = as @ bs \<and> ct_list_eq bs (take (length ts - n) ts)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts; \<And>xs ys n. ct_list_eq xs ys \<Longrightarrow> ct_list_eq (take n xs) (take n ys); \<And>xs ys zs. (xs @ ys = zs) = (xs = take (length xs) zs \<and> ys = drop (length xs) zs)\<rbrakk> \<Longrightarrow> \<exists>as bs. take (length ts' - n) ts' = as @ bs \<and> ct_list_eq bs (take (length ts - n) ts)
[PROOF STEP]
assume "\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts"
[PROOF STATE]
proof (state)
this:
\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts

goal (1 subgoal):
 1. \<lbrakk>\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts; \<And>xs ys n. ct_list_eq xs ys \<Longrightarrow> ct_list_eq (take n xs) (take n ys); \<And>xs ys zs. (xs @ ys = zs) = (xs = take (length xs) zs \<and> ys = drop (length xs) zs)\<rbrakk> \<Longrightarrow> \<exists>as bs. take (length ts' - n) ts' = as @ bs \<and> ct_list_eq bs (take (length ts - n) ts)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts
[PROOF STEP]
obtain ccs :: "ct list" and ccsa :: "ct list" where
    f1: "ts' = ccs @ ccsa \<and> ct_list_eq ccsa ts"
[PROOF STATE]
proof (prove)
using this:
\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts

goal (1 subgoal):
 1. (\<And>ccs ccsa. ts' = ccs @ ccsa \<and> ct_list_eq ccsa ts \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by moura
[PROOF STATE]
proof (state)
this:
ts' = ccs @ ccsa \<and> ct_list_eq ccsa ts

goal (1 subgoal):
 1. \<lbrakk>\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts; \<And>xs ys n. ct_list_eq xs ys \<Longrightarrow> ct_list_eq (take n xs) (take n ys); \<And>xs ys zs. (xs @ ys = zs) = (xs = take (length xs) zs \<and> ys = drop (length xs) zs)\<rbrakk> \<Longrightarrow> \<exists>as bs. take (length ts' - n) ts' = as @ bs \<and> ct_list_eq bs (take (length ts - n) ts)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ts' = ccs @ ccsa \<and> ct_list_eq ccsa ts
[PROOF STEP]
have f2: "length ccsa = length ts"
[PROOF STATE]
proof (prove)
using this:
ts' = ccs @ ccsa \<and> ct_list_eq ccsa ts

goal (1 subgoal):
 1. length ccsa = length ts
[PROOF STEP]
by (meson ct_list_eq_length)
[PROOF STATE]
proof (state)
this:
length ccsa = length ts

goal (1 subgoal):
 1. \<lbrakk>\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts; \<And>xs ys n. ct_list_eq xs ys \<Longrightarrow> ct_list_eq (take n xs) (take n ys); \<And>xs ys zs. (xs @ ys = zs) = (xs = take (length xs) zs \<and> ys = drop (length xs) zs)\<rbrakk> \<Longrightarrow> \<exists>as bs. take (length ts' - n) ts' = as @ bs \<and> ct_list_eq bs (take (length ts - n) ts)
[PROOF STEP]
have "\<And>n. ct_list_eq (take n ccsa) (take n ts)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. ct_list_eq (take n ccsa) (take n ts)
[PROOF STEP]
using f1
[PROOF STATE]
proof (prove)
using this:
ts' = ccs @ ccsa \<and> ct_list_eq ccsa ts

goal (1 subgoal):
 1. \<And>n. ct_list_eq (take n ccsa) (take n ts)
[PROOF STEP]
by (meson ct_list_eq_take)
[PROOF STATE]
proof (state)
this:
ct_list_eq (take ?n ccsa) (take ?n ts)

goal (1 subgoal):
 1. \<lbrakk>\<exists>as bs. ts' = as @ bs \<and> ct_list_eq bs ts; \<And>xs ys n. ct_list_eq xs ys \<Longrightarrow> ct_list_eq (take n xs) (take n ys); \<And>xs ys zs. (xs @ ys = zs) = (xs = take (length xs) zs \<and> ys = drop (length xs) zs)\<rbrakk> \<Longrightarrow> \<exists>as bs. take (length ts' - n) ts' = as @ bs \<and> ct_list_eq bs (take (length ts - n) ts)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ct_list_eq (take ?n ccsa) (take ?n ts)
[PROOF STEP]
show "\<exists>cs csa. take (length ts' - n) ts' = cs @ csa \<and> ct_list_eq csa (take (length ts - n) ts)"
[PROOF STATE]
proof (prove)
using this:
ct_list_eq (take ?n ccsa) (take ?n ts)

goal (1 subgoal):
 1. \<exists>cs csa. take (length ts' - n) ts' = cs @ csa \<and> ct_list_eq csa (take (length ts - n) ts)
[PROOF STEP]
using f2 f1
[PROOF STATE]
proof (prove)
using this:
ct_list_eq (take ?n ccsa) (take ?n ts)
length ccsa = length ts
ts' = ccs @ ccsa \<and> ct_list_eq ccsa ts

goal (1 subgoal):
 1. \<exists>cs csa. take (length ts' - n) ts' = cs @ csa \<and> ct_list_eq csa (take (length ts - n) ts)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>cs csa. take (length ts' - n) ts' = cs @ csa \<and> ct_list_eq csa (take (length ts - n) ts)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_Suc_diff_le:"x \<le> Suc n \<Longrightarrow> x - Suc 0 \<le> n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> Suc n \<Longrightarrow> x - Suc 0 \<le> n
[PROOF STEP]
apply (frule diff_le_mono[of x "Suc n" "Suc 0"],
       thin_tac "x \<le> Suc n", simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma coprime_linear_poly':
  fixes c :: "'a :: field_gcd"
  assumes "c \<noteq> c'" "c \<noteq> 0" "c' \<noteq> 0"
  shows   "coprime [:1,c:] [:1,c':]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
have "gcd [:1,c:] [:1,c':] = gcd ([:1,c:] mod [:1,c':]) [:1,c':]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd [:1::'a, c:] [:1::'a, c':] = gcd ([:1::'a, c:] mod [:1::'a, c':]) [:1::'a, c':]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
gcd [:1::'a, c:] [:1::'a, c':] = gcd ([:1::'a, c:] mod [:1::'a, c':]) [:1::'a, c':]

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd [:1::'a, c:] [:1::'a, c':] = gcd ([:1::'a, c:] mod [:1::'a, c':]) [:1::'a, c':]

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
have \<open>[:1,c:] mod [:1,c':] = [:1 - c / c':]\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:1::'a, c:] mod [:1::'a, c':] = [:(1::'a) - c / c':]
[PROOF STEP]
using \<open>c' \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
c' \<noteq> (0::'a)

goal (1 subgoal):
 1. [:1::'a, c:] mod [:1::'a, c':] = [:(1::'a) - c / c':]
[PROOF STEP]
by (simp add: mod_pCons)
[PROOF STATE]
proof (state)
this:
[:1::'a, c:] mod [:1::'a, c':] = [:(1::'a) - c / c':]

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[:1::'a, c:] mod [:1::'a, c':] = [:(1::'a) - c / c':]

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> c'
c \<noteq> (0::'a)
c' \<noteq> (0::'a)
[PROOF STEP]
have "gcd \<dots> [:1,c':] = normalize ([:1 - c / c':])"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> c'
c \<noteq> (0::'a)
c' \<noteq> (0::'a)

goal (1 subgoal):
 1. gcd [:(1::'a) - c / c':] [:1::'a, c':] = normalize [:(1::'a) - c / c':]
[PROOF STEP]
by (intro gcd_proj1_if_dvd) (auto simp: const_poly_dvd_iff dvd_field_iff)
[PROOF STATE]
proof (state)
this:
gcd [:(1::'a) - c / c':] [:1::'a, c':] = normalize [:(1::'a) - c / c':]

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
gcd [:(1::'a) - c / c':] [:1::'a, c':] = normalize [:(1::'a) - c / c':]

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
c \<noteq> c'
c \<noteq> (0::'a)
c' \<noteq> (0::'a)
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
using this:
c \<noteq> c'
c \<noteq> (0::'a)
c' \<noteq> (0::'a)

goal (1 subgoal):
 1. normalize [:(1::'a) - c / c':] = 1
[PROOF STEP]
by (auto simp: normalize_poly_def)
[PROOF STATE]
proof (state)
this:
normalize [:(1::'a) - c / c':] = 1

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
gcd [:1::'a, c:] [:1::'a, c':] = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gcd [:1::'a, c:] [:1::'a, c':] = 1

goal (1 subgoal):
 1. coprime [:1::'a, c:] [:1::'a, c':]
[PROOF STEP]
by (rule gcd_eq_1_imp_coprime)
[PROOF STATE]
proof (state)
this:
coprime [:1::'a, c:] [:1::'a, c':]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma is_Pointwise_Output_Shrink_list_eq_is_Pointwise_Output_Shrink_all:
  "(is_Pointwise_Output_Shrink_list pointwise_shrink fs) =
    (\<forall>output_fun \<in> set fs. is_Pointwise_Output_Shrink pointwise_shrink output_fun)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_Pointwise_Output_Shrink_list pointwise_shrink fs = (\<forall>output_fun\<in>set fs. is_Pointwise_Output_Shrink pointwise_shrink output_fun)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. is_Pointwise_Output_Shrink_list pointwise_shrink fs \<Longrightarrow> \<forall>output_fun\<in>set fs. is_Pointwise_Output_Shrink pointwise_shrink output_fun
 2. \<forall>output_fun\<in>set fs. is_Pointwise_Output_Shrink pointwise_shrink output_fun \<Longrightarrow> is_Pointwise_Output_Shrink_list pointwise_shrink fs
[PROOF STEP]
apply (rule ballI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>output_fun. \<lbrakk>is_Pointwise_Output_Shrink_list pointwise_shrink fs; output_fun \<in> set fs\<rbrakk> \<Longrightarrow> is_Pointwise_Output_Shrink pointwise_shrink output_fun
 2. \<forall>output_fun\<in>set fs. is_Pointwise_Output_Shrink pointwise_shrink output_fun \<Longrightarrow> is_Pointwise_Output_Shrink_list pointwise_shrink fs
[PROOF STEP]
apply (rule is_Pointwise_Output_Shrink_list_imp_is_Pointwise_Output_Shrink)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>output_fun. \<lbrakk>is_Pointwise_Output_Shrink_list pointwise_shrink fs; output_fun \<in> set fs\<rbrakk> \<Longrightarrow> is_Pointwise_Output_Shrink_list pointwise_shrink (?fs5 output_fun)
 2. \<And>output_fun. \<lbrakk>is_Pointwise_Output_Shrink_list pointwise_shrink fs; output_fun \<in> set fs\<rbrakk> \<Longrightarrow> output_fun \<in> set (?fs5 output_fun)
 3. \<forall>output_fun\<in>set fs. is_Pointwise_Output_Shrink pointwise_shrink output_fun \<Longrightarrow> is_Pointwise_Output_Shrink_list pointwise_shrink fs
[PROOF STEP]
apply (simp add: member_def)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>output_fun\<in>set fs. is_Pointwise_Output_Shrink pointwise_shrink output_fun \<Longrightarrow> is_Pointwise_Output_Shrink_list pointwise_shrink fs
[PROOF STEP]
apply (induct fs, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a fs. \<lbrakk>Ball (set fs) (is_Pointwise_Output_Shrink pointwise_shrink) \<Longrightarrow> is_Pointwise_Output_Shrink_list pointwise_shrink fs; Ball (set (a # fs)) (is_Pointwise_Output_Shrink pointwise_shrink)\<rbrakk> \<Longrightarrow> is_Pointwise_Output_Shrink_list pointwise_shrink (a # fs)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma the_elem_eq:
  assumes "f \<in> A \<rightarrow>\<^sub>E B"
  assumes "b \<in> f ` A"
  shows "the_elem (f ` {x' \<in> A. f x' = b}) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_elem (f ` {x' \<in> A. f x' = b}) = b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. the_elem (f ` {x' \<in> A. f x' = b}) = b
[PROOF STEP]
from \<open>b \<in> f ` A\<close>
[PROOF STATE]
proof (chain)
picking this:
b \<in> f ` A
[PROOF STEP]
obtain a where "a \<in> A" and "b = f a"
[PROOF STATE]
proof (prove)
using this:
b \<in> f ` A

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> A; b = f a\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> A
b = f a

goal (1 subgoal):
 1. the_elem (f ` {x' \<in> A. f x' = b}) = b
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
a \<in> A
b = f a
[PROOF STEP]
show "the_elem (f ` {x' \<in> A. f x' = b}) = b"
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b = f a

goal (1 subgoal):
 1. the_elem (f ` {x' \<in> A. f x' = b}) = b
[PROOF STEP]
using the_elem[OF \<open>f \<in> A \<rightarrow>\<^sub>E B\<close> \<open>f \<in> A \<rightarrow>\<^sub>E B\<close>]
[PROOF STATE]
proof (prove)
using this:
a \<in> A
b = f a
\<lbrakk>(\<lambda>b. {x \<in> A. f x = b}) ` B - {{}} = (\<lambda>b. {x \<in> A. f x = b}) ` B - {{}}; ?x \<in> A\<rbrakk> \<Longrightarrow> the_elem (f ` {xa \<in> A. f xa = f ?x}) = f ?x

goal (1 subgoal):
 1. the_elem (f ` {x' \<in> A. f x' = b}) = b
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
the_elem (f ` {x' \<in> A. f x' = b}) = b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frange_mono:
  assumes "r \<subseteq>\<^sub>\<circ> s"
  shows "\<R>\<^sub>\<bullet> r \<subseteq>\<^sub>\<circ> \<R>\<^sub>\<bullet> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<R>\<^sub>\<bullet> r \<subseteq>\<^sub>\<circ> \<R>\<^sub>\<bullet> s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
r \<subseteq>\<^sub>\<circ> s

goal (1 subgoal):
 1. \<R>\<^sub>\<bullet> r \<subseteq>\<^sub>\<circ> \<R>\<^sub>\<bullet> s
[PROOF STEP]
by force


[STATEMENT]
lemma dim_Macaulay_mat[simp]:
  "dim_row (Macaulay_mat ps) = length ps"
  "dim_col (Macaulay_mat ps) = card (Keys (set ps))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (Macaulay_mat ps) = length ps &&& dim_col (Macaulay_mat ps) = card (Keys (set ps))
[PROOF STEP]
by (simp_all add: Macaulay_mat_def length_Keys_to_list)


[STATEMENT]
lemma convergent_prod_cong:
  fixes f g :: "nat \<Rightarrow> 'a::{field,topological_semigroup_mult,t2_space}"
  assumes ev: "eventually (\<lambda>x. f x = g x) sequentially" and f: "\<And>i. f i \<noteq> 0" and g: "\<And>i. g i \<noteq> 0"
  shows "convergent_prod f = convergent_prod g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F x in sequentially. f x = g x
f ?i \<noteq> (0::'a)
g ?i \<noteq> (0::'a)
[PROOF STEP]
obtain N where N: "\<forall>n\<ge>N. f n = g n"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in sequentially. f x = g x
f ?i \<noteq> (0::'a)
g ?i \<noteq> (0::'a)

goal (1 subgoal):
 1. (\<And>N. \<forall>n\<ge>N. f n = g n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_at_top_linorder)
[PROOF STATE]
proof (state)
this:
\<forall>n\<ge>N. f n = g n

goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
define C where "C = (\<Prod>k<N. f k / g k)"
[PROOF STATE]
proof (state)
this:
C = (\<Prod>k<N. f k / g k)

goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
with g
[PROOF STATE]
proof (chain)
picking this:
g ?i \<noteq> (0::'a)
C = (\<Prod>k<N. f k / g k)
[PROOF STEP]
have "C \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
g ?i \<noteq> (0::'a)
C = (\<Prod>k<N. f k / g k)

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

goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
have *: "eventually (\<lambda>n. prod f {..n} = C * prod g {..n}) sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. prod f {..n} = C * prod g {..n}
[PROOF STEP]
using eventually_ge_at_top[of N]
[PROOF STATE]
proof (prove)
using this:
eventually ((\<le>) N) sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. prod f {..n} = C * prod g {..n}
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
case (elim n)
[PROOF STATE]
proof (state)
this:
N \<le> n

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
N \<le> n
[PROOF STEP]
have "{..n} = {..<N} \<union> {N..n}"
[PROOF STATE]
proof (prove)
using this:
N \<le> n

goal (1 subgoal):
 1. {..n} = {..<N} \<union> {N..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..n} = {..<N} \<union> {N..n}

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{..n} = {..<N} \<union> {N..n}

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
have "prod f \<dots> = prod f {..<N} * prod f {N..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f ({..<N} \<union> {N..n}) = prod f {..<N} * prod f {N..n}
[PROOF STEP]
by (intro prod.union_disjoint) auto
[PROOF STATE]
proof (state)
this:
prod f ({..<N} \<union> {N..n}) = prod f {..<N} * prod f {N..n}

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f ({..<N} \<union> {N..n}) = prod f {..<N} * prod f {N..n}

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
from N
[PROOF STATE]
proof (chain)
picking this:
\<forall>n\<ge>N. f n = g n
[PROOF STEP]
have "prod f {N..n} = prod g {N..n}"
[PROOF STATE]
proof (prove)
using this:
\<forall>n\<ge>N. f n = g n

goal (1 subgoal):
 1. prod f {N..n} = prod g {N..n}
[PROOF STEP]
by (intro prod.cong) simp_all
[PROOF STATE]
proof (state)
this:
prod f {N..n} = prod g {N..n}

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f {N..n} = prod g {N..n}

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
have "prod f {..<N} * prod g {N..n} = C * (prod g {..<N} * prod g {N..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<N} * prod g {N..n} = C * (prod g {..<N} * prod g {N..n})
[PROOF STEP]
unfolding C_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod f {..<N} * prod g {N..n} = (\<Prod>k<N. f k / g k) * (prod g {..<N} * prod g {N..n})
[PROOF STEP]
by (simp add: g prod_dividef)
[PROOF STATE]
proof (state)
this:
prod f {..<N} * prod g {N..n} = C * (prod g {..<N} * prod g {N..n})

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod f {..<N} * prod g {N..n} = C * (prod g {..<N} * prod g {N..n})

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
have "prod g {..<N} * prod g {N..n} = prod g ({..<N} \<union> {N..n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod g {..<N} * prod g {N..n} = prod g ({..<N} \<union> {N..n})
[PROOF STEP]
by (intro prod.union_disjoint [symmetric]) auto
[PROOF STATE]
proof (state)
this:
prod g {..<N} * prod g {N..n} = prod g ({..<N} \<union> {N..n})

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod g {..<N} * prod g {N..n} = prod g ({..<N} \<union> {N..n})

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
from elim
[PROOF STATE]
proof (chain)
picking this:
N \<le> n
[PROOF STEP]
have "{..<N} \<union> {N..n} = {..n}"
[PROOF STATE]
proof (prove)
using this:
N \<le> n

goal (1 subgoal):
 1. {..<N} \<union> {N..n} = {..n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{..<N} \<union> {N..n} = {..n}

goal (1 subgoal):
 1. \<And>n. N \<le> n \<Longrightarrow> prod f {..n} = C * prod g {..n}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod f {..n} = C * prod g {..n}
[PROOF STEP]
show "prod f {..n} = C * prod g {..n}"
[PROOF STATE]
proof (prove)
using this:
prod f {..n} = C * prod g {..n}

goal (1 subgoal):
 1. prod f {..n} = C * prod g {..n}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
prod f {..n} = C * prod g {..n}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. prod f {..n} = C * prod g {..n}

goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>\<^sub>F n in sequentially. prod f {..n} = C * prod g {..n}
[PROOF STEP]
have cong: "convergent (\<lambda>n. prod f {..n}) = convergent (\<lambda>n. C * prod g {..n})"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F n in sequentially. prod f {..n} = C * prod g {..n}

goal (1 subgoal):
 1. convergent (\<lambda>n. prod f {..n}) = convergent (\<lambda>n. C * prod g {..n})
[PROOF STEP]
by (rule convergent_cong)
[PROOF STATE]
proof (state)
this:
convergent (\<lambda>n. prod f {..n}) = convergent (\<lambda>n. C * prod g {..n})

goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convergent_prod f = convergent_prod g
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> convergent_prod g
 2. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
assume cf: "convergent_prod f"
[PROOF STATE]
proof (state)
this:
convergent_prod f

goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> convergent_prod g
 2. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
with f
[PROOF STATE]
proof (chain)
picking this:
f ?i \<noteq> (0::'a)
convergent_prod f
[PROOF STEP]
have "\<not> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
f ?i \<noteq> (0::'a)
convergent_prod f

goal (1 subgoal):
 1. \<not> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> (0::'a)

goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> convergent_prod g
 2. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
have "\<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. \<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
using * \<open>C \<noteq> 0\<close> filterlim_cong
[PROOF STATE]
proof (prove)
using this:
\<not> (\<lambda>n. prod f {..n}) \<longlonglongrightarrow> (0::'a)
\<forall>\<^sub>F n in sequentially. prod f {..n} = C * prod g {..n}
C \<noteq> (0::'a)
\<lbrakk>?F1.0 = ?F1'; ?F2.0 = ?F2'; \<forall>\<^sub>F x in ?F2.0. ?f x = ?g x\<rbrakk> \<Longrightarrow> filterlim ?f ?F1.0 ?F2.0 = filterlim ?g ?F1' ?F2'

goal (1 subgoal):
 1. \<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> (0::'a)

goal (2 subgoals):
 1. convergent_prod f \<Longrightarrow> convergent_prod g
 2. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
show "convergent_prod g"
[PROOF STATE]
proof (prove)
using this:
\<not> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> (0::'a)

goal (1 subgoal):
 1. convergent_prod g
[PROOF STEP]
by (metis convergent_mult_const_iff \<open>C \<noteq> 0\<close> cong cf convergent_LIMSEQ_iff convergent_prod_iff_convergent convergent_prod_imp_convergent g)
[PROOF STATE]
proof (state)
this:
convergent_prod g

goal (1 subgoal):
 1. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
assume cg: "convergent_prod g"
[PROOF STATE]
proof (state)
this:
convergent_prod g

goal (1 subgoal):
 1. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
have "\<exists>a. C * a \<noteq> 0 \<and> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a. C * a \<noteq> (0::'a) \<and> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> a
[PROOF STEP]
by (metis (no_types) \<open>C \<noteq> 0\<close> cg convergent_prod_iff_nz_lim divide_eq_0_iff g nonzero_mult_div_cancel_right)
[PROOF STATE]
proof (state)
this:
\<exists>a. C * a \<noteq> (0::'a) \<and> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> a

goal (1 subgoal):
 1. convergent_prod g \<Longrightarrow> convergent_prod f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>a. C * a \<noteq> (0::'a) \<and> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> a
[PROOF STEP]
show "convergent_prod f"
[PROOF STATE]
proof (prove)
using this:
\<exists>a. C * a \<noteq> (0::'a) \<and> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> a

goal (1 subgoal):
 1. convergent_prod f
[PROOF STEP]
using "*" tendsto_mult_left filterlim_cong
[PROOF STATE]
proof (prove)
using this:
\<exists>a. C * a \<noteq> (0::'a) \<and> (\<lambda>n. prod g {..n}) \<longlonglongrightarrow> a
\<forall>\<^sub>F n in sequentially. prod f {..n} = C * prod g {..n}
(?f \<longlongrightarrow> ?l) ?F \<Longrightarrow> ((\<lambda>x. ?c * ?f x) \<longlongrightarrow> ?c * ?l) ?F
\<lbrakk>?F1.0 = ?F1'; ?F2.0 = ?F2'; \<forall>\<^sub>F x in ?F2.0. ?f x = ?g x\<rbrakk> \<Longrightarrow> filterlim ?f ?F1.0 ?F2.0 = filterlim ?g ?F1' ?F2'

goal (1 subgoal):
 1. convergent_prod f
[PROOF STEP]
by (fastforce simp add: convergent_prod_iff_nz_lim f)
[PROOF STATE]
proof (state)
this:
convergent_prod f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
convergent_prod f = convergent_prod g

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_nodes_inpow:
  assumes "sorted (rev xs)"
      and "set xs \<subseteq> set nodes"
    shows "xs \<in> (rev \<circ> sorted_list_of_set) ` (Pow (set nodes))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
from assms(1)
[PROOF STATE]
proof (chain)
picking this:
Sorted_Less.sorted (rev xs)
[PROOF STEP]
have "(sorted_list_of_set (set xs)) = rev xs"
[PROOF STATE]
proof (prove)
using this:
Sorted_Less.sorted (rev xs)

goal (1 subgoal):
 1. sorted_list_of_set (set xs) = rev xs
[PROOF STEP]
by (auto intro:sorted_less_rev_set_eq)
[PROOF STATE]
proof (state)
this:
sorted_list_of_set (set xs) = rev xs

goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sorted_list_of_set (set xs) = rev xs
[PROOF STEP]
have "rev (rev xs) = rev (sorted_list_of_set (set xs))"
[PROOF STATE]
proof (prove)
using this:
sorted_list_of_set (set xs) = rev xs

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

goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
with assms(2)
[PROOF STATE]
proof (chain)
picking this:
set xs \<subseteq> set nodes
rev (rev xs) = rev (sorted_list_of_set (set xs))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set xs \<subseteq> set nodes
rev (rev xs) = rev (sorted_list_of_set (set xs))

goal (1 subgoal):
 1. xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
xs \<in> (rev \<circ> sorted_list_of_set) ` Pow (set nodes)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cart2_append1_z:
  assumes "z_non_zero p"
  shows "(cart2_append1 p)$3 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cart2_append1 p $ 3 = 1
[PROOF STEP]
using \<open>z_non_zero p\<close>
[PROOF STATE]
proof (prove)
using this:
z_non_zero p

goal (1 subgoal):
 1. cart2_append1 p $ 3 = 1
[PROOF STEP]
by (unfold cart2_append1_def) simp


[STATEMENT]
lemma favorites_nonempty: "i \<in> agents \<Longrightarrow> favorites R i \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> agents \<Longrightarrow> favorites R i \<noteq> {}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<in> agents \<Longrightarrow> favorites R i \<noteq> {}
[PROOF STEP]
assume "i \<in> agents"
[PROOF STATE]
proof (state)
this:
i \<in> agents

goal (1 subgoal):
 1. i \<in> agents \<Longrightarrow> favorites R i \<noteq> {}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> agents
[PROOF STEP]
interpret finite_total_preorder_on alts "R i"
[PROOF STATE]
proof (prove)
using this:
i \<in> agents

goal (1 subgoal):
 1. finite_total_preorder_on alts (R i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<in> agents \<Longrightarrow> favorites R i \<noteq> {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. favorites R i \<noteq> {}
[PROOF STEP]
unfolding favorites_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max_wrt (R i) \<noteq> {}
[PROOF STEP]
by (intro Max_wrt_nonempty) simp_all
[PROOF STATE]
proof (state)
this:
favorites R i \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma append_vec_vCons[simp]: "vCons a v @\<^sub>v w = vCons a (v @\<^sub>v w)" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vCons a v @\<^sub>v w = vCons a (v @\<^sub>v w)
[PROOF STEP]
proof (unfold vec_eq_iff, intro conjI allI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_vec (vCons a v @\<^sub>v w) = dim_vec (vCons a (v @\<^sub>v w))
 2. \<And>i. i < dim_vec (vCons a (v @\<^sub>v w)) \<Longrightarrow> (vCons a v @\<^sub>v w) $ i = vCons a (v @\<^sub>v w) $ i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_vec (vCons a v @\<^sub>v w) = dim_vec (vCons a (v @\<^sub>v w))
 2. \<And>i. i < dim_vec (vCons a (v @\<^sub>v w)) \<Longrightarrow> (vCons a v @\<^sub>v w) $ i = vCons a (v @\<^sub>v w) $ i
[PROOF STEP]
assume "i < dim_vec ?r"
[PROOF STATE]
proof (state)
this:
i < dim_vec (vCons a (v @\<^sub>v w))

goal (2 subgoals):
 1. dim_vec (vCons a v @\<^sub>v w) = dim_vec (vCons a (v @\<^sub>v w))
 2. \<And>i. i < dim_vec (vCons a (v @\<^sub>v w)) \<Longrightarrow> (vCons a v @\<^sub>v w) $ i = vCons a (v @\<^sub>v w) $ i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_vec (vCons a (v @\<^sub>v w))
[PROOF STEP]
show "?l $ i = ?r $ i"
[PROOF STATE]
proof (prove)
using this:
i < dim_vec (vCons a (v @\<^sub>v w))

goal (1 subgoal):
 1. (vCons a v @\<^sub>v w) $ i = vCons a (v @\<^sub>v w) $ i
[PROOF STEP]
by (cases i; subst index_append_vec, auto)
[PROOF STATE]
proof (state)
this:
(vCons a v @\<^sub>v w) $ i = vCons a (v @\<^sub>v w) $ i

goal (1 subgoal):
 1. dim_vec (vCons a v @\<^sub>v w) = dim_vec (vCons a (v @\<^sub>v w))
[PROOF STEP]
qed simp


[STATEMENT]
lemma lex_two_refl:
  assumes r1: "refl ns1" and r2: "refl ns2"
  shows "refl (lex_two s1 ns1 ns2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl (lex_two s1 ns1 ns2)
[PROOF STEP]
using refl_onD[OF r1] and refl_onD[OF r2]
[PROOF STATE]
proof (prove)
using this:
?a \<in> UNIV \<Longrightarrow> (?a, ?a) \<in> ns1
?a \<in> UNIV \<Longrightarrow> (?a, ?a) \<in> ns2

goal (1 subgoal):
 1. refl (lex_two s1 ns1 ns2)
[PROOF STEP]
by (intro refl_onI) auto


[STATEMENT]
lemma (in PolynRg) higher_part_zero:"\<lbrakk>pol_coeff S c; k < fst c;
      \<forall>j\<in>nset (Suc k) (fst c). snd c j = \<zero>\<^bsub>S\<^esub>\<rbrakk> \<Longrightarrow>
             \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) (Suc k) (fst c) = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k < fst c; \<forall>j\<in>nset (Suc k) (fst c). snd c j = \<zero>\<^bsub>S\<^esub>\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>f R (\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>) Suc k fst c = \<zero>
[PROOF STEP]
apply (cut_tac ring_is_ag,
       rule aGroup.fSum_zero1[of R k "fst c" "\<lambda>j. snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup>"],
       assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>pol_coeff S c; k < fst c; \<forall>j\<in>nset (Suc k) (fst c). snd c j = \<zero>\<^bsub>S\<^esub>; aGroup R\<rbrakk> \<Longrightarrow> \<forall>j\<in>nset (Suc k) (fst c). snd c j \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> = \<zero>
[PROOF STEP]
apply (rule ballI,
       drule_tac x = j in bspec, assumption, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<lbrakk>pol_coeff S c; k < fst c; aGroup R; j \<in> nset (Suc k) (fst c); snd c j = \<zero>\<^bsub>S\<^esub>\<rbrakk> \<Longrightarrow> \<zero>\<^bsub>S\<^esub> \<cdot>\<^sub>r X^\<^bsup>R j\<^esup> = \<zero>
[PROOF STEP]
apply (cut_tac subring,
       simp add:Subring_zero_ring_zero,
       cut_tac X_mem_R,
       frule_tac n = j in npClose[of X],
       simp add:ring_times_0_x)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma set_eqvt:
  fixes pi :: "'x prm"
  and   xs :: "'a list"
  shows "pi\<bullet>(set xs) = set (pi\<bullet>xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi \<bullet> set xs = set (pi \<bullet> xs)
[PROOF STEP]
by (induct xs) (auto simp add: empty_eqvt insert_eqvt)


[STATEMENT]
lemma eventually_imp_frequently: "frequently P F \<Longrightarrow> eventually P F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frequently P F \<Longrightarrow> eventually P F
[PROOF STEP]
using ultra[of P]
[PROOF STATE]
proof (prove)
using this:
eventually P F \<or> (\<forall>\<^sub>F x in F. \<not> P x)

goal (1 subgoal):
 1. frequently P F \<Longrightarrow> eventually P F
[PROOF STEP]
by (simp add: frequently_def)


[STATEMENT]
lemma cone_smult:
  assumes a: "a \<ge> 0"
    and Vs: "Vs \<subseteq> carrier_vec n"
    and x: "x \<in> cone Vs"
  shows "a \<cdot>\<^sub>v x \<in> cone Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<cdot>\<^sub>v x \<in> cone Vs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<cdot>\<^sub>v x \<in> cone Vs
[PROOF STEP]
from x Vs
[PROOF STATE]
proof (chain)
picking this:
x \<in> cone Vs
Vs \<subseteq> carrier_vec n
[PROOF STEP]
obtain Ws c where Ws: "Ws \<subseteq> Vs" and fin: "finite Ws" and
    "nonneg_lincomb c Ws x"
[PROOF STATE]
proof (prove)
using this:
x \<in> cone Vs
Vs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. (\<And>Ws c. \<lbrakk>Ws \<subseteq> Vs; finite Ws; nonneg_lincomb c Ws x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding cone_def finite_cone_def
[PROOF STATE]
proof (prove)
using this:
x \<in> {x. \<exists>Ws. finite Ws \<and> Ws \<subseteq> Vs \<and> x \<in> {b. \<exists>c. nonneg_lincomb c (if finite Ws then Ws else {}) b}}
Vs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. (\<And>Ws c. \<lbrakk>Ws \<subseteq> Vs; finite Ws; nonneg_lincomb c Ws x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ws \<subseteq> Vs
finite Ws
nonneg_lincomb c Ws x

goal (1 subgoal):
 1. a \<cdot>\<^sub>v x \<in> cone Vs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ws \<subseteq> Vs
finite Ws
nonneg_lincomb c Ws x
[PROOF STEP]
have "nonneg_lincomb (\<lambda> w. a * c w) Ws (a \<cdot>\<^sub>v x)"
[PROOF STATE]
proof (prove)
using this:
Ws \<subseteq> Vs
finite Ws
nonneg_lincomb c Ws x

goal (1 subgoal):
 1. nonneg_lincomb (\<lambda>w. a * c w) Ws (a \<cdot>\<^sub>v x)
[PROOF STEP]
unfolding nonneg_lincomb_def
[PROOF STATE]
proof (prove)
using this:
Ws \<subseteq> Vs
finite Ws
lincomb c Ws = x \<and> c ` Ws \<subseteq> Collect ((\<le>) (0::'a))

goal (1 subgoal):
 1. lincomb (\<lambda>w. a * c w) Ws = a \<cdot>\<^sub>v x \<and> (\<lambda>w. a * c w) ` Ws \<subseteq> Collect ((\<le>) (0::'a))
[PROOF STEP]
using a lincomb_distrib Vs
[PROOF STATE]
proof (prove)
using this:
Ws \<subseteq> Vs
finite Ws
lincomb c Ws = x \<and> c ` Ws \<subseteq> Collect ((\<le>) (0::'a))
(0::'a) \<le> a
\<lbrakk>?U \<subseteq> carrier_vec n; ?a \<in> ?U \<rightarrow> UNIV; ?c \<in> UNIV\<rbrakk> \<Longrightarrow> ?c \<cdot>\<^sub>v lincomb ?a ?U = lincomb (\<lambda>u. ?c * ?a u) ?U
Vs \<subseteq> carrier_vec n

goal (1 subgoal):
 1. lincomb (\<lambda>w. a * c w) Ws = a \<cdot>\<^sub>v x \<and> (\<lambda>w. a * c w) ` Ws \<subseteq> Collect ((\<le>) (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nonneg_lincomb (\<lambda>w. a * c w) Ws (a \<cdot>\<^sub>v x)

goal (1 subgoal):
 1. a \<cdot>\<^sub>v x \<in> cone Vs
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nonneg_lincomb (\<lambda>w. a * c w) Ws (a \<cdot>\<^sub>v x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nonneg_lincomb (\<lambda>w. a * c w) Ws (a \<cdot>\<^sub>v x)

goal (1 subgoal):
 1. a \<cdot>\<^sub>v x \<in> cone Vs
[PROOF STEP]
using Ws fin
[PROOF STATE]
proof (prove)
using this:
nonneg_lincomb (\<lambda>w. a * c w) Ws (a \<cdot>\<^sub>v x)
Ws \<subseteq> Vs
finite Ws

goal (1 subgoal):
 1. a \<cdot>\<^sub>v x \<in> cone Vs
[PROOF STEP]
unfolding cone_def finite_cone_def
[PROOF STATE]
proof (prove)
using this:
nonneg_lincomb (\<lambda>w. a * c w) Ws (a \<cdot>\<^sub>v x)
Ws \<subseteq> Vs
finite Ws

goal (1 subgoal):
 1. a \<cdot>\<^sub>v x \<in> {x. \<exists>Ws. finite Ws \<and> Ws \<subseteq> Vs \<and> x \<in> {b. \<exists>c. nonneg_lincomb c (if finite Ws then Ws else {}) b}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a \<cdot>\<^sub>v x \<in> cone Vs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Un_lepoll_mono:
  assumes "A \<lesssim> C" "B \<lesssim> D" "disjnt C D" shows "A \<union> B \<lesssim> C \<union> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<union> B \<lesssim> C \<union> D
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<union> B \<lesssim> C \<union> D
[PROOF STEP]
obtain f g where inj: "inj_on f A" "inj_on g B" and fg: "f ` A \<subseteq> C" "g ` B \<subseteq> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f g. \<lbrakk>inj_on f A; inj_on g B; f ` A \<subseteq> C; g ` B \<subseteq> D\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson assms lepoll_def)
[PROOF STATE]
proof (state)
this:
inj_on f A
inj_on g B
f ` A \<subseteq> C
g ` B \<subseteq> D

goal (1 subgoal):
 1. A \<union> B \<lesssim> C \<union> D
[PROOF STEP]
have "inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)
[PROOF STEP]
using inj \<open>disjnt C D\<close> fg
[PROOF STATE]
proof (prove)
using this:
inj_on f A
inj_on g B
disjnt C D
f ` A \<subseteq> C
g ` B \<subseteq> D

goal (1 subgoal):
 1. inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)
[PROOF STEP]
unfolding disjnt_iff
[PROOF STATE]
proof (prove)
using this:
inj_on f A
inj_on g B
\<forall>x. \<not> (x \<in> C \<and> x \<in> D)
f ` A \<subseteq> C
g ` B \<subseteq> D

goal (1 subgoal):
 1. inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)
[PROOF STEP]
by (fastforce intro: inj_onI dest: inj_on_contraD split: if_split_asm)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)

goal (1 subgoal):
 1. A \<union> B \<lesssim> C \<union> D
[PROOF STEP]
with fg
[PROOF STATE]
proof (chain)
picking this:
f ` A \<subseteq> C
g ` B \<subseteq> D
inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` A \<subseteq> C
g ` B \<subseteq> D
inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)

goal (1 subgoal):
 1. A \<union> B \<lesssim> C \<union> D
[PROOF STEP]
unfolding lepoll_def
[PROOF STATE]
proof (prove)
using this:
f ` A \<subseteq> C
g ` B \<subseteq> D
inj_on (\<lambda>x. if x \<in> A then f x else g x) (A \<union> B)

goal (1 subgoal):
 1. \<exists>f. inj_on f (A \<union> B) \<and> f ` (A \<union> B) \<subseteq> C \<union> D
[PROOF STEP]
by (rule_tac x="\<lambda>x. if x \<in> A then f x else g x" in exI) auto
[PROOF STATE]
proof (state)
this:
A \<union> B \<lesssim> C \<union> D

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma e_nth_snoc_small [simp]:
  assumes "n < e_length b"
  shows "e_nth (e_snoc b z) n = e_nth b n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e_nth (e_snoc b z) n = e_nth b n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n < e_length b

goal (1 subgoal):
 1. e_nth (e_snoc b z) n = e_nth b n
[PROOF STEP]
by (simp add: nth_append)


[STATEMENT]
lemma blocks_max_vars:
  "\<lbrakk> length vs = length pns; length Ts = length pns \<rbrakk>
  \<Longrightarrow> max_vars (blocks pns Ts vs e) = max_vars e + length pns"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length vs = length pns; length Ts = length pns\<rbrakk> \<Longrightarrow> max_vars (blocks pns Ts vs e) = max_vars e + length pns
[PROOF STEP]
by(induct pns Ts vs e rule: blocks.induct)(auto)


[STATEMENT]
lemma map_id_subst: "P (map id xs) \<Longrightarrow> P xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (map id xs) \<Longrightarrow> P xs
[PROOF STEP]
by (subst map_id[symmetric])


[STATEMENT]
lemma Carmichael_number_imp_dvd:
  fixes n :: nat
  assumes Carmichael_number: "Carmichael_number n" and "prime p" "p dvd n"
  shows "p - 1 dvd n - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "\<not>prime n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> prime n
[PROOF STEP]
using Carmichael_number
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n

goal (1 subgoal):
 1. \<not> prime n
[PROOF STEP]
unfolding Carmichael_number_def
[PROOF STATE]
proof (prove)
using this:
1 < n \<and> \<not> prime n \<and> (\<forall>a. coprime a n \<longrightarrow> [a ^ (n - 1) = 1] (mod n))

goal (1 subgoal):
 1. \<not> prime n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<not> prime n

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
obtain u where "n = p * u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>u. n = p * u \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>p dvd n\<close>
[PROOF STATE]
proof (prove)
using this:
p dvd n

goal (1 subgoal):
 1. (\<And>u. n = p * u \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
n = p * u

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "squarefree n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. squarefree n
[PROOF STEP]
using Carmichael_number_imp_squarefree assms
[PROOF STATE]
proof (prove)
using this:
Carmichael_number ?n \<Longrightarrow> squarefree ?n
Carmichael_number n
prime p
p dvd n

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

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
squarefree n
[PROOF STEP]
have "\<not>p dvd u"
[PROOF STATE]
proof (prove)
using this:
squarefree n

goal (1 subgoal):
 1. \<not> p dvd u
[PROOF STEP]
using \<open>prime p\<close> not_prime_unit[of p]
[PROOF STATE]
proof (prove)
using this:
squarefree n
prime p
is_unit p \<Longrightarrow> \<not> prime p

goal (1 subgoal):
 1. \<not> p dvd u
[PROOF STEP]
unfolding power2_eq_square squarefree_def \<open>n = p * u\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x * x dvd p * u \<longrightarrow> is_unit x
prime p
is_unit p \<Longrightarrow> \<not> prime p

goal (1 subgoal):
 1. \<not> p dvd u
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<not> p dvd u

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
define R where "R = Residues_nat p"
[PROOF STATE]
proof (state)
this:
R = Residues_nat p

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
interpret residues_nat_prime p R
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. residues_nat_prime p &&& R \<equiv> Residues_nat p
[PROOF STEP]
by unfold_locales (simp_all only: \<open>prime p\<close> R_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
obtain a where a: "a \<in> {0<..<p}" "units.ord a = p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> {0<..<p}; units.ord a = p - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using residues_prime_cyclic' \<open>prime p\<close>
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>{0<..<p}. units.ord x = p - 1
prime p

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> {0<..<p}; units.ord a = p - 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
a \<in> {0<..<p}
units.ord a = p - 1

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
from a
[PROOF STATE]
proof (chain)
picking this:
a \<in> {0<..<p}
units.ord a = p - 1
[PROOF STEP]
have "a \<in> totatives p"
[PROOF STATE]
proof (prove)
using this:
a \<in> {0<..<p}
units.ord a = p - 1

goal (1 subgoal):
 1. a \<in> totatives p
[PROOF STEP]
by (auto simp: totatives_prime \<open>prime p\<close>)
[PROOF STATE]
proof (state)
this:
a \<in> totatives p

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "coprime p u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime p u
[PROOF STEP]
using \<open>prime p\<close> \<open>\<not> p dvd u\<close>
[PROOF STATE]
proof (prove)
using this:
prime p
\<not> p dvd u

goal (1 subgoal):
 1. coprime p u
[PROOF STEP]
by (simp add: prime_imp_coprime_nat)
[PROOF STATE]
proof (state)
this:
coprime p u

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
coprime p u
[PROOF STEP]
obtain x where "[x = a] (mod p)" "[x = 1] (mod u)"
[PROOF STATE]
proof (prove)
using this:
coprime p u

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>[x = a] (mod p); [x = 1] (mod u)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using binary_chinese_remainder_nat[of p u a 1]
[PROOF STATE]
proof (prove)
using this:
coprime p u
coprime p u \<Longrightarrow> \<exists>x. [x = a] (mod p) \<and> [x = 1] (mod u)

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>[x = a] (mod p); [x = 1] (mod u)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[x = a] (mod p)
[x = 1] (mod u)

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "coprime x p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x p
[PROOF STEP]
using \<open>a \<in> totatives p\<close> and cong_imp_coprime[OF cong_sym[OF \<open>[x = a] (mod p)\<close>]]
[PROOF STATE]
proof (prove)
using this:
a \<in> totatives p
coprime a p \<Longrightarrow> coprime x p

goal (1 subgoal):
 1. coprime x p
[PROOF STEP]
by (simp add: coprime_commute totatives_def)
[PROOF STATE]
proof (state)
this:
coprime x p

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
coprime x p

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "coprime x u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime x u
[PROOF STEP]
using coprime_1_left and cong_imp_coprime[OF cong_sym[OF \<open>[x = 1] (mod u)\<close>]]
[PROOF STATE]
proof (prove)
using this:
coprime (1::?'a) ?a
coprime 1 u \<Longrightarrow> coprime x u

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

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
coprime x p
coprime x u
[PROOF STEP]
have "coprime x n"
[PROOF STATE]
proof (prove)
using this:
coprime x p
coprime x u

goal (1 subgoal):
 1. coprime x n
[PROOF STEP]
by (simp add: \<open>n = p * u\<close>)
[PROOF STATE]
proof (state)
this:
coprime x n

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "[a ^ (n - 1) = x ^ (n - 1)] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [a ^ (n - 1) = x ^ (n - 1)] (mod p)
[PROOF STEP]
using \<open>[x = a] (mod p)\<close>
[PROOF STATE]
proof (prove)
using this:
[x = a] (mod p)

goal (1 subgoal):
 1. [a ^ (n - 1) = x ^ (n - 1)] (mod p)
[PROOF STEP]
by (intro cong_pow) (auto simp: cong_sym_eq)
[PROOF STATE]
proof (state)
this:
[a ^ (n - 1) = x ^ (n - 1)] (mod p)

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[a ^ (n - 1) = x ^ (n - 1)] (mod p)

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "[x ^ (n - 1) = 1] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x ^ (n - 1) = 1] (mod n)
[PROOF STEP]
using Carmichael_number \<open>coprime x n\<close>
[PROOF STATE]
proof (prove)
using this:
Carmichael_number n
coprime x n

goal (1 subgoal):
 1. [x ^ (n - 1) = 1] (mod n)
[PROOF STEP]
unfolding Carmichael_number_def
[PROOF STATE]
proof (prove)
using this:
1 < n \<and> \<not> prime n \<and> (\<forall>a. coprime a n \<longrightarrow> [a ^ (n - 1) = 1] (mod n))
coprime x n

goal (1 subgoal):
 1. [x ^ (n - 1) = 1] (mod n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[x ^ (n - 1) = 1] (mod n)

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[x ^ (n - 1) = 1] (mod n)
[PROOF STEP]
have "[x ^ (n - 1) = 1] (mod p)"
[PROOF STATE]
proof (prove)
using this:
[x ^ (n - 1) = 1] (mod n)

goal (1 subgoal):
 1. [x ^ (n - 1) = 1] (mod p)
[PROOF STEP]
using \<open>n = p * u\<close> cong_modulus_mult_nat
[PROOF STATE]
proof (prove)
using this:
[x ^ (n - 1) = 1] (mod n)
n = p * u
[?x = ?y] (mod ?m * ?n) \<Longrightarrow> [?x = ?y] (mod ?m)

goal (1 subgoal):
 1. [x ^ (n - 1) = 1] (mod p)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
[x ^ (n - 1) = 1] (mod p)

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[a ^ (n - 1) = 1] (mod p)
[PROOF STEP]
have "ord p a dvd n - 1"
[PROOF STATE]
proof (prove)
using this:
[a ^ (n - 1) = 1] (mod p)

goal (1 subgoal):
 1. ord p a dvd n - 1
[PROOF STEP]
by (simp add: ord_divides [symmetric])
[PROOF STATE]
proof (state)
this:
ord p a dvd n - 1

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ord p a dvd n - 1

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
have "ord p a = p - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord p a = p - 1
[PROOF STEP]
using a \<open>a \<in> totatives p\<close>
[PROOF STATE]
proof (prove)
using this:
a \<in> {0<..<p}
units.ord a = p - 1
a \<in> totatives p

goal (1 subgoal):
 1. ord p a = p - 1
[PROOF STEP]
by (simp add: units.ord_residue_mult_group)
[PROOF STATE]
proof (state)
this:
ord p a = p - 1

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p - 1 dvd n - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p - 1 dvd n - 1

goal (1 subgoal):
 1. p - 1 dvd n - 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
p - 1 dvd n - 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iR_prop_rules [simp]: "sset prop_rules = {andI, andE, impI, impE}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sset prop_rules = {andI, andE, impI, impE}
[PROOF STEP]
unfolding prop_rules_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sset (cycle [andI, andE, impI, impE]) = {andI, andE, impI, impE}
[PROOF STEP]
by simp


[STATEMENT]
lemma entails_frame:
  assumes ePR: "P \<tturnstile> R"
      and eQS: "Q \<tturnstile> S"
  shows "P && Q \<tturnstile> R && S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P && Q \<tturnstile> R && S
[PROOF STEP]
proof(rule le_funI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (P && Q) x \<le> (R && S) x
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (P && Q) x \<le> (R && S) x
[PROOF STEP]
from ePR
[PROOF STATE]
proof (chain)
picking this:
P \<tturnstile> R
[PROOF STEP]
have "P s \<le> R s"
[PROOF STATE]
proof (prove)
using this:
P \<tturnstile> R

goal (1 subgoal):
 1. P s \<le> R s
[PROOF STEP]
by(blast)
[PROOF STATE]
proof (state)
this:
P s \<le> R s

goal (1 subgoal):
 1. \<And>x. (P && Q) x \<le> (R && S) x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
P s \<le> R s

goal (1 subgoal):
 1. \<And>x. (P && Q) x \<le> (R && S) x
[PROOF STEP]
from eQS
[PROOF STATE]
proof (chain)
picking this:
Q \<tturnstile> S
[PROOF STEP]
have "Q s \<le> S s"
[PROOF STATE]
proof (prove)
using this:
Q \<tturnstile> S

goal (1 subgoal):
 1. Q s \<le> S s
[PROOF STEP]
by(blast)
[PROOF STATE]
proof (state)
this:
Q s \<le> S s

goal (1 subgoal):
 1. \<And>x. (P && Q) x \<le> (R && S) x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
P s \<le> R s
Q s \<le> S s
[PROOF STEP]
have "P s + Q s \<le> R s + S s"
[PROOF STATE]
proof (prove)
using this:
P s \<le> R s
Q s \<le> S s

goal (1 subgoal):
 1. P s + Q s \<le> R s + S s
[PROOF STEP]
by(rule add_mono)
[PROOF STATE]
proof (state)
this:
P s + Q s \<le> R s + S s

goal (1 subgoal):
 1. \<And>x. (P && Q) x \<le> (R && S) x
[PROOF STEP]
hence "P s + Q s \<ominus> 1 \<le> R s + S s \<ominus> 1"
[PROOF STATE]
proof (prove)
using this:
P s + Q s \<le> R s + S s

goal (1 subgoal):
 1. P s + Q s \<ominus> 1 \<le> R s + S s \<ominus> 1
[PROOF STEP]
by(rule tminus_left_mono)
[PROOF STATE]
proof (state)
this:
P s + Q s \<ominus> 1 \<le> R s + S s \<ominus> 1

goal (1 subgoal):
 1. \<And>x. (P && Q) x \<le> (R && S) x
[PROOF STEP]
thus "(P && Q) s \<le> (R && S) s"
[PROOF STATE]
proof (prove)
using this:
P s + Q s \<ominus> 1 \<le> R s + S s \<ominus> 1

goal (1 subgoal):
 1. (P && Q) s \<le> (R && S) s
[PROOF STEP]
unfolding exp_conj_def pconj_def
[PROOF STATE]
proof (prove)
using this:
P s + Q s \<ominus> 1 \<le> R s + S s \<ominus> 1

goal (1 subgoal):
 1. P s + Q s \<ominus> 1 \<le> R s + S s \<ominus> 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(P && Q) s \<le> (R && S) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_pcompose: "degree (pcompose p q) = degree p * degree q"
  for p q :: "'a::{comm_semiring_0,semiring_no_zero_divisors} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (p \<circ>\<^sub>p q) = degree p * degree q
[PROOF STEP]
proof (induct p)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree (0 \<circ>\<^sub>p q) = degree 0 * degree q
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (p \<circ>\<^sub>p q) = degree p * degree q\<rbrakk> \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. degree (0 \<circ>\<^sub>p q) = degree 0 * degree q
 2. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (p \<circ>\<^sub>p q) = degree p * degree q\<rbrakk> \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (0 \<circ>\<^sub>p q) = degree 0 * degree q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (0 \<circ>\<^sub>p q) = degree 0 * degree q

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (p \<circ>\<^sub>p q) = degree p * degree q\<rbrakk> \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (p \<circ>\<^sub>p q) = degree p * degree q\<rbrakk> \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
case (pCons a p)
[PROOF STATE]
proof (state)
this:
a \<noteq> (0::'a) \<or> p \<noteq> 0
degree (p \<circ>\<^sub>p q) = degree p * degree q

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (p \<circ>\<^sub>p q) = degree p * degree q\<rbrakk> \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
consider "degree (q * pcompose p q) = 0" | "degree (q * pcompose p q) > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> ?thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. \<And>a p. \<lbrakk>a \<noteq> (0::'a) \<or> p \<noteq> 0; degree (p \<circ>\<^sub>p q) = degree p * degree q\<rbrakk> \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> ?thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> ?thesis; 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
 2. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
case prems: 1
[PROOF STATE]
proof (state)
this:
degree (q * p \<circ>\<^sub>p q) = 0

goal (2 subgoals):
 1. degree (q * p \<circ>\<^sub>p q) = 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
 2. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
proof (cases "p = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
 2. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
p = 0

goal (2 subgoals):
 1. p = 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
 2. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p = 0

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
from prems
[PROOF STATE]
proof (chain)
picking this:
degree (q * p \<circ>\<^sub>p q) = 0
[PROOF STEP]
have "degree q = 0 \<or> pcompose p q = 0"
[PROOF STATE]
proof (prove)
using this:
degree (q * p \<circ>\<^sub>p q) = 0

goal (1 subgoal):
 1. degree q = 0 \<or> p \<circ>\<^sub>p q = 0
[PROOF STEP]
by (auto simp add: degree_mult_eq_0)
[PROOF STATE]
proof (state)
this:
degree q = 0 \<or> p \<circ>\<^sub>p q = 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
degree q = 0 \<or> p \<circ>\<^sub>p q = 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
have False if "pcompose p q = 0" "degree q \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. False
[PROOF STEP]
from pCons.hyps(2) that
[PROOF STATE]
proof (chain)
picking this:
degree (p \<circ>\<^sub>p q) = degree p * degree q
p \<circ>\<^sub>p q = 0
degree q \<noteq> 0
[PROOF STEP]
have "degree p = 0"
[PROOF STATE]
proof (prove)
using this:
degree (p \<circ>\<^sub>p q) = degree p * degree q
p \<circ>\<^sub>p q = 0
degree q \<noteq> 0

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

goal (1 subgoal):
 1. False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree p = 0
[PROOF STEP]
obtain a1 where "p = [:a1:]"
[PROOF STATE]
proof (prove)
using this:
degree p = 0

goal (1 subgoal):
 1. (\<And>a1. p = [:a1:] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis degree_pCons_eq_if old.nat.distinct(2) pCons_cases)
[PROOF STATE]
proof (state)
this:
p = [:a1:]

goal (1 subgoal):
 1. False
[PROOF STEP]
with \<open>pcompose p q = 0\<close> \<open>p \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<circ>\<^sub>p q = 0
p \<noteq> 0
p = [:a1:]
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
p \<circ>\<^sub>p q = 0
p \<noteq> 0
p = [:a1:]

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>p \<circ>\<^sub>p q = 0; degree q \<noteq> 0\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
degree q = 0 \<or> p \<circ>\<^sub>p q = 0
\<lbrakk>p \<circ>\<^sub>p q = 0; degree q \<noteq> 0\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "degree (pCons a p) * degree q = 0"
[PROOF STATE]
proof (prove)
using this:
degree q = 0 \<or> p \<circ>\<^sub>p q = 0
\<lbrakk>p \<circ>\<^sub>p q = 0; degree q \<noteq> 0\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. degree (pCons a p) * degree q = 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (pCons a p) * degree q = 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
degree (pCons a p) * degree q = 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
have "degree (pcompose (pCons a p) q) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = 0
[PROOF STEP]
from prems
[PROOF STATE]
proof (chain)
picking this:
degree (q * p \<circ>\<^sub>p q) = 0
[PROOF STEP]
have "0 = max (degree [:a:]) (degree (q * pcompose p q))"
[PROOF STATE]
proof (prove)
using this:
degree (q * p \<circ>\<^sub>p q) = 0

goal (1 subgoal):
 1. 0 = max (degree [:a:]) (degree (q * p \<circ>\<^sub>p q))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 = max (degree [:a:]) (degree (q * p \<circ>\<^sub>p q))

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = 0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
0 = max (degree [:a:]) (degree (q * p \<circ>\<^sub>p q))

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = 0
[PROOF STEP]
have "\<dots> \<ge> degree ([:a:] + q * pcompose p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree ([:a:] + q * p \<circ>\<^sub>p q) \<le> max (degree [:a:]) (degree (q * p \<circ>\<^sub>p q))
[PROOF STEP]
by (rule degree_add_le_max)
[PROOF STATE]
proof (state)
this:
degree ([:a:] + q * p \<circ>\<^sub>p q) \<le> max (degree [:a:]) (degree (q * p \<circ>\<^sub>p q))

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = 0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree ([:a:] + q * p \<circ>\<^sub>p q) \<le> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree ([:a:] + q * p \<circ>\<^sub>p q) \<le> 0

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = 0
[PROOF STEP]
by (auto simp add: pcompose_pCons)
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = 0

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = 0

goal (1 subgoal):
 1. p \<noteq> 0 \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
degree (pCons a p) * degree q = 0
degree (pCons a p \<circ>\<^sub>p q) = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (pCons a p) * degree q = 0
degree (pCons a p \<circ>\<^sub>p q) = 0

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
case prems: 2
[PROOF STATE]
proof (state)
this:
0 < degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < degree (q * p \<circ>\<^sub>p q)
[PROOF STEP]
have "p \<noteq> 0" "q \<noteq> 0" "pcompose p q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
0 < degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. p \<noteq> 0 &&& q \<noteq> 0 &&& p \<circ>\<^sub>p q \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
q \<noteq> 0
p \<circ>\<^sub>p q \<noteq> 0

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
from prems degree_add_eq_right [of "[:a:]"]
[PROOF STATE]
proof (chain)
picking this:
0 < degree (q * p \<circ>\<^sub>p q)
degree [:a:] < degree ?q \<Longrightarrow> degree ([:a:] + ?q) = degree ?q
[PROOF STEP]
have "degree (pcompose (pCons a p) q) = degree (q * pcompose p q)"
[PROOF STATE]
proof (prove)
using this:
0 < degree (q * p \<circ>\<^sub>p q)
degree [:a:] < degree ?q \<Longrightarrow> degree ([:a:] + ?q) = degree ?q

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = degree (q * p \<circ>\<^sub>p q)
[PROOF STEP]
by (auto simp: pcompose_pCons)
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. 0 < degree (q * p \<circ>\<^sub>p q) \<Longrightarrow> degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
with pCons.hyps(2) degree_mult_eq[OF \<open>q\<noteq>0\<close> \<open>pcompose p q\<noteq>0\<close>]
[PROOF STATE]
proof (chain)
picking this:
degree (p \<circ>\<^sub>p q) = degree p * degree q
degree (q * p \<circ>\<^sub>p q) = degree q + degree (p \<circ>\<^sub>p q)
degree (pCons a p \<circ>\<^sub>p q) = degree (q * p \<circ>\<^sub>p q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree (p \<circ>\<^sub>p q) = degree p * degree q
degree (q * p \<circ>\<^sub>p q) = degree q + degree (p \<circ>\<^sub>p q)
degree (pCons a p \<circ>\<^sub>p q) = degree (q * p \<circ>\<^sub>p q)

goal (1 subgoal):
 1. degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
degree (pCons a p \<circ>\<^sub>p q) = degree (pCons a p) * degree q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma span_minimal: "S \<subseteq> T \<Longrightarrow> subspace T \<Longrightarrow> span S \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<subseteq> T; subspace T\<rbrakk> \<Longrightarrow> span S \<subseteq> T
[PROOF STEP]
by (auto simp: span_explicit intro!: subspace_sum subspace_scale)


[STATEMENT]
lemma analz_insert_Hash [simp]:
     "analz (insert (Hash X) H) = insert (Hash X) (analz H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. analz (insert (Hash X) H) = insert (Hash X) (analz H)
[PROOF STEP]
apply (rule analz_insert_eq_I)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> analz (insert (Hash X) H) \<Longrightarrow> x \<in> insert (Hash X) (analz H)
[PROOF STEP]
apply (erule analz.induct, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in PolynRg) ext_special_cf_lo_zero:"\<lbrakk>0 < n; x \<le> (n - Suc 0)\<rbrakk>
              \<Longrightarrow> snd (ext_cf S n (C\<^sub>0 S)) x = \<zero>\<^bsub>S\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; x \<le> n - Suc 0\<rbrakk> \<Longrightarrow> snd (ext_cf S n (C\<^sub>0 S)) x = \<zero>\<^bsub>S\<^esub>
[PROOF STEP]
by (cut_tac special_cf_pol_coeff,
       frule ext_cf_lo_zero[of "C\<^sub>0 S" n], assumption+)


[STATEMENT]
lemma lhd_lfilter [simp]: "lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
[PROOF STEP]
proof(cases "\<exists>x\<in>lset xs. P x")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>x\<in>lset xs. P x \<Longrightarrow> lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
 2. \<not> (\<exists>x\<in>lset xs. P x) \<Longrightarrow> lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>lset xs. P x

goal (2 subgoals):
 1. \<exists>x\<in>lset xs. P x \<Longrightarrow> lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
 2. \<not> (\<exists>x\<in>lset xs. P x) \<Longrightarrow> lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x\<in>lset xs. P x
[PROOF STEP]
obtain x where "x \<in> lset xs" and "P x"
[PROOF STATE]
proof (prove)
using this:
\<exists>x\<in>lset xs. P x

goal (1 subgoal):
 1. (\<And>x. \<lbrakk>x \<in> lset xs; P x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> lset xs
P x

goal (2 subgoals):
 1. \<exists>x\<in>lset xs. P x \<Longrightarrow> lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
 2. \<not> (\<exists>x\<in>lset xs. P x) \<Longrightarrow> lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
[PROOF STEP]
from \<open>x \<in> lset xs\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<in> lset xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<in> lset xs

goal (1 subgoal):
 1. lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
[PROOF STEP]
by induct(simp_all add: \<open>P x\<close>)
[PROOF STATE]
proof (state)
this:
lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>lset xs. P x) \<Longrightarrow> lhd (lfilter P xs) = lhd (ldropWhile (Not \<circ> P) xs)
[PROOF STEP]
qed(simp add: o_def)


[STATEMENT]
lemma Card_is_Ord:
  assumes "Card \<kappa>" shows "Ord \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord \<kappa>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Ord \<kappa>
[PROOF STEP]
obtain \<alpha> where "Ord \<alpha>" "elts \<alpha> \<approx> elts \<kappa>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<alpha>. \<lbrakk>Ord \<alpha>; elts \<alpha> \<approx> elts \<kappa>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Ord_ordertype ordertype_eqpoll
[PROOF STATE]
proof (prove)
using this:
Ord (ordertype ?A VWF)
small ?A \<Longrightarrow> elts (ordertype ?A VWF) \<approx> ?A

goal (1 subgoal):
 1. (\<And>\<alpha>. \<lbrakk>Ord \<alpha>; elts \<alpha> \<approx> elts \<kappa>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Ord \<alpha>
elts \<alpha> \<approx> elts \<kappa>

goal (1 subgoal):
 1. Ord \<kappa>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ord \<alpha>
elts \<alpha> \<approx> elts \<kappa>
[PROOF STEP]
have "Ord (LEAST i. Ord i \<and> elts i \<approx> elts \<kappa>)"
[PROOF STATE]
proof (prove)
using this:
Ord \<alpha>
elts \<alpha> \<approx> elts \<kappa>

goal (1 subgoal):
 1. Ord (LEAST i. Ord i \<and> elts i \<approx> elts \<kappa>)
[PROOF STEP]
by (metis Ord_Least)
[PROOF STATE]
proof (state)
this:
Ord (LEAST i. Ord i \<and> elts i \<approx> elts \<kappa>)

goal (1 subgoal):
 1. Ord \<kappa>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ord (LEAST i. Ord i \<and> elts i \<approx> elts \<kappa>)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Ord (LEAST i. Ord i \<and> elts i \<approx> elts \<kappa>)

goal (1 subgoal):
 1. Ord \<kappa>
[PROOF STEP]
using Card_def vcard_def assms
[PROOF STATE]
proof (prove)
using this:
Ord (LEAST i. Ord i \<and> elts i \<approx> elts \<kappa>)
Card ?i \<equiv> ?i = vcard ?i
vcard ?a \<equiv> LEAST i. Ord i \<and> elts i \<approx> elts ?a
Card \<kappa>

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma derangements_inv:
  assumes d: "d \<in> derangements S"
  shows "inv d \<in> derangements S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv d \<in> derangements S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
d \<in> derangements S

goal (1 subgoal):
 1. inv d \<in> derangements S
[PROOF STEP]
by (auto intro!: derangementsI elim!: derangementsE simp add: permutes_inv permutes_inv_eq)


[STATEMENT]
lemma isolated_other_da:
    assumes "u \<notin> {tail G a, head G a}" shows "u \<in> H.isolated_verts \<longleftrightarrow> u \<in> G.isolated_verts"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> H.isolated_verts) = (u \<in> G.isolated_verts)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
u \<notin> {tail G a, head G a}

goal (1 subgoal):
 1. (u \<in> H.isolated_verts) = (u \<in> G.isolated_verts)
[PROOF STEP]
by (auto simp: pre_digraph.isolated_verts_def verts_H arcs_H tail_H out_arcs_def)


[STATEMENT]
lemma fmrestrict_set_twice[simp]: "fmrestrict_set S (fmrestrict_set T m) = fmrestrict_set (S \<inter> T) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmrestrict_set S (fmrestrict_set T m) = fmrestrict_set (S \<inter> T) m
[PROOF STEP]
unfolding fmfilter_alt_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fmfilter (\<lambda>a. a \<in> S) (fmfilter (\<lambda>a. a \<in> T) m) = fmfilter (\<lambda>a. a \<in> S \<inter> T) m
[PROOF STEP]
by auto


[STATEMENT]
lemma Pi'_I'[simp]: "domain f = A \<Longrightarrow> (\<And>x. x \<in> A \<longrightarrow> f x \<in> B x) \<Longrightarrow> f \<in> Pi' A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>domain f = A; \<And>x. x \<in> A \<longrightarrow> (f)\<^sub>F x \<in> B x\<rbrakk> \<Longrightarrow> f \<in> Pi' A B
[PROOF STEP]
by (simp add:Pi'_def)


[STATEMENT]
lemma rank_eclose [simp]: "rank (eclose x) = rank x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (eclose x) = rank x
[PROOF STEP]
proof (induct x rule: hf_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rank (eclose 0) = rank 0
 2. \<And>x y. \<lbrakk>rank (eclose x) = rank x; rank (eclose y) = rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank (eclose (y \<triangleleft> x)) = rank (y \<triangleleft> x)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. rank (eclose 0) = rank 0
 2. \<And>x y. \<lbrakk>rank (eclose x) = rank x; rank (eclose y) = rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank (eclose (y \<triangleleft> x)) = rank (y \<triangleleft> x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (eclose 0) = rank 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rank (eclose 0) = rank 0

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>rank (eclose x) = rank x; rank (eclose y) = rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank (eclose (y \<triangleleft> x)) = rank (y \<triangleleft> x)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>rank (eclose x) = rank x; rank (eclose y) = rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank (eclose (y \<triangleleft> x)) = rank (y \<triangleleft> x)
[PROOF STEP]
case (hinsert a b)
[PROOF STATE]
proof (state)
this:
rank (eclose a) = rank a
rank (eclose b) = rank b
a \<^bold>\<notin> b

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>rank (eclose x) = rank x; rank (eclose y) = rank y; x \<^bold>\<notin> y\<rbrakk> \<Longrightarrow> rank (eclose (y \<triangleleft> x)) = rank (y \<triangleleft> x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
rank (eclose a) = rank a
rank (eclose b) = rank b
a \<^bold>\<notin> b

goal (1 subgoal):
 1. rank (eclose (b \<triangleleft> a)) = rank (b \<triangleleft> a)
[PROOF STEP]
by simp (metis hinsert_eq_sup succ_def sup.left_idem)
[PROOF STATE]
proof (state)
this:
rank (eclose (b \<triangleleft> a)) = rank (b \<triangleleft> a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) triv_subgroup:
  shows "subgroup {\<one>} G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup {\<one>} G
[PROOF STEP]
unfolding subgroup_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({\<one>} \<subseteq> carrier G \<and> (\<forall>x y. x \<in> {\<one>} \<longrightarrow> y \<in> {\<one>} \<longrightarrow> x \<otimes> y \<in> {\<one>})) \<and> \<one> \<in> {\<one>} \<and> (\<forall>x. x \<in> {\<one>} \<longrightarrow> inv x \<in> {\<one>})
[PROOF STEP]
by auto


[STATEMENT]
lemma set_of_map_inj: "inj set_of_map"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj set_of_map
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; set_of_map x = set_of_map y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
fix x y
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; set_of_map x = set_of_map y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
assume "set_of_map x = set_of_map y"
[PROOF STATE]
proof (state)
this:
set_of_map x = set_of_map y

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; set_of_map x = set_of_map y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "(x a = Some b) = (y a = Some b)" for a b
[PROOF STATE]
proof (prove)
using this:
set_of_map x = set_of_map y

goal (1 subgoal):
 1. (x a = Some b) = (y a = Some b)
[PROOF STEP]
unfolding set_of_map_def
[PROOF STATE]
proof (prove)
using this:
{(k, v) |k v. x k = Some v} = {(k, v) |k v. y k = Some v}

goal (1 subgoal):
 1. (x a = Some b) = (y a = Some b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(x ?a = Some ?b) = (y ?a = Some ?b)

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; set_of_map x = set_of_map y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
hence "x k = y k" for k
[PROOF STATE]
proof (prove)
using this:
(x ?a = Some ?b) = (y ?a = Some ?b)

goal (1 subgoal):
 1. x k = y k
[PROOF STEP]
by (metis not_None_eq)
[PROOF STATE]
proof (state)
this:
x ?k = y ?k

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; set_of_map x = set_of_map y\<rbrakk> \<Longrightarrow> x = y
[PROOF STEP]
thus "x = y"
[PROOF STATE]
proof (prove)
using this:
x ?k = y ?k

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma to_list_tree_root_awalk_unique:
  assumes "v \<in> verts to_list_tree"
      and "pre_digraph.awalk to_list_tree [root] p v"
      and "pre_digraph.awalk to_list_tree [root] y v"
  shows "p = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = y
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p \<noteq> y \<Longrightarrow> False
[PROOF STEP]
assume "p \<noteq> y"
[PROOF STATE]
proof (state)
this:
p \<noteq> y

goal (1 subgoal):
 1. p \<noteq> y \<Longrightarrow> False
[PROOF STEP]
obtain v' where v'_def: "v = [v']"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>v'. v = [v'] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using to_list_tree_def assms(1)
[PROOF STATE]
proof (prove)
using this:
to_list_tree = \<lparr>verts = (\<lambda>x. [x]) ` verts T, arcs = arcs T, tail = \<lambda>x. [tail T x], head = \<lambda>x. [head T x]\<rparr>
v \<in> verts to_list_tree

goal (1 subgoal):
 1. (\<And>v'. v = [v'] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v = [v']

goal (1 subgoal):
 1. p \<noteq> y \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
v = [v']
[PROOF STEP]
have "v' \<in> verts T"
[PROOF STATE]
proof (prove)
using this:
v = [v']

goal (1 subgoal):
 1. v' \<in> verts T
[PROOF STEP]
using assms(1) to_list_tree_def
[PROOF STATE]
proof (prove)
using this:
v = [v']
v \<in> verts to_list_tree
to_list_tree = \<lparr>verts = (\<lambda>x. [x]) ` verts T, arcs = arcs T, tail = \<lambda>x. [tail T x], head = \<lambda>x. [head T x]\<rparr>

goal (1 subgoal):
 1. v' \<in> verts T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v' \<in> verts T

goal (1 subgoal):
 1. p \<noteq> y \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
using to_list_tree_awalk assms \<open>p \<noteq> y\<close> assms(2,3) unique_awalk v'_def
[PROOF STATE]
proof (prove)
using this:
awalk ?u ?p ?v = pre_digraph.awalk to_list_tree [?u] ?p [?v]
v \<in> verts to_list_tree
pre_digraph.awalk to_list_tree [root] p v
pre_digraph.awalk to_list_tree [root] y v
p \<noteq> y
pre_digraph.awalk to_list_tree [root] p v
pre_digraph.awalk to_list_tree [root] y v
?v \<in> verts T \<Longrightarrow> \<exists>!p. awalk root p ?v
v = [v']

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in field) nth_el_closed [simp]: "in_carrier xs \<Longrightarrow> nth_el xs n \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. in_carrier xs \<Longrightarrow> nth_el xs n \<in> carrier R
[PROOF STEP]
by (induct xs n rule: nth_el.induct) (simp_all add: in_carrier_def)