[STATEMENT]
lemma list_all2_nths:
assumes "list_all2 P (nths xs A) (nths ys A)"
and     "list_all2 P (nths xs (-A)) (nths ys (-A))"
shows "list_all2 P xs ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P xs ys
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. list_all2 P xs ys
[PROOF STEP]
have "length xs = length ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xs = length ys
[PROOF STEP]
proof (rule ccontr; cases "length xs < length ys")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>length xs \<noteq> length ys; length xs < length ys\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length xs \<noteq> length ys; \<not> length xs < length ys\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
length xs < length ys

goal (2 subgoals):
 1. \<lbrakk>length xs \<noteq> length ys; length xs < length ys\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length xs \<noteq> length ys; \<not> length xs < length ys\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length xs < length ys
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
length xs < length ys

goal (1 subgoal):
 1. False
[PROOF STEP]
proof (cases "length xs \<in> A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length xs < length ys; length xs \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
length xs \<notin> A

goal (2 subgoals):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length xs < length ys; length xs \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "{i. i < length xs \<and> i \<in> - A} \<subset> {i. i < length ys \<and> i \<in> - A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < length xs \<and> i \<in> - A} \<subset> {i. i < length ys \<and> i \<in> - A}
[PROOF STEP]
using False \<open>length xs < length ys\<close>
[PROOF STATE]
proof (prove)
using this:
length xs \<notin> A
length xs < length ys

goal (1 subgoal):
 1. {i. i < length xs \<and> i \<in> - A} \<subset> {i. i < length ys \<and> i \<in> - A}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{i. i < length xs \<and> i \<in> - A} \<subset> {i. i < length ys \<and> i \<in> - A}

goal (2 subgoals):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length xs < length ys; length xs \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < length xs \<and> i \<in> - A} \<subset> {i. i < length ys \<and> i \<in> - A}
[PROOF STEP]
have "length (nths ys (-A)) > length (nths xs (-A))"
[PROOF STATE]
proof (prove)
using this:
{i. i < length xs \<and> i \<in> - A} \<subset> {i. i < length ys \<and> i \<in> - A}

goal (1 subgoal):
 1. length (nths xs (- A)) < length (nths ys (- A))
[PROOF STEP]
unfolding length_nths
[PROOF STATE]
proof (prove)
using this:
{i. i < length xs \<and> i \<in> - A} \<subset> {i. i < length ys \<and> i \<in> - A}

goal (1 subgoal):
 1. card {i. i < length xs \<and> i \<in> - A} < card {i. i < length ys \<and> i \<in> - A}
[PROOF STEP]
by (simp add: psubset_card_mono)
[PROOF STATE]
proof (state)
this:
length (nths xs (- A)) < length (nths ys (- A))

goal (2 subgoals):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length xs < length ys; length xs \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (nths xs (- A)) < length (nths ys (- A))
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
length (nths xs (- A)) < length (nths ys (- A))

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2) list_all2_lengthD not_less_iff_gr_or_eq
[PROOF STATE]
proof (prove)
using this:
length (nths xs (- A)) < length (nths ys (- A))
list_all2 P (nths xs (- A)) (nths ys (- A))
list_all2 ?P ?xs ?ys \<Longrightarrow> length ?xs = length ?ys
(\<not> ?x < ?y) = (?y < ?x \<or> ?x = ?y)

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

goal (1 subgoal):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
length xs \<in> A

goal (1 subgoal):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "{i. i < length xs \<and> i \<in> A} \<subset> {i. i < length ys \<and> i \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < length xs \<and> i \<in> A} \<subset> {i. i < length ys \<and> i \<in> A}
[PROOF STEP]
using True \<open>length xs < length ys\<close>
[PROOF STATE]
proof (prove)
using this:
length xs \<in> A
length xs < length ys

goal (1 subgoal):
 1. {i. i < length xs \<and> i \<in> A} \<subset> {i. i < length ys \<and> i \<in> A}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{i. i < length xs \<and> i \<in> A} \<subset> {i. i < length ys \<and> i \<in> A}

goal (1 subgoal):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < length xs \<and> i \<in> A} \<subset> {i. i < length ys \<and> i \<in> A}
[PROOF STEP]
have "length (nths ys A) > length (nths xs A)"
[PROOF STATE]
proof (prove)
using this:
{i. i < length xs \<and> i \<in> A} \<subset> {i. i < length ys \<and> i \<in> A}

goal (1 subgoal):
 1. length (nths xs A) < length (nths ys A)
[PROOF STEP]
unfolding length_nths
[PROOF STATE]
proof (prove)
using this:
{i. i < length xs \<and> i \<in> A} \<subset> {i. i < length ys \<and> i \<in> A}

goal (1 subgoal):
 1. card {i. i < length xs \<and> i \<in> A} < card {i. i < length ys \<and> i \<in> A}
[PROOF STEP]
by (simp add: psubset_card_mono)
[PROOF STATE]
proof (state)
this:
length (nths xs A) < length (nths ys A)

goal (1 subgoal):
 1. \<lbrakk>length xs < length ys; length xs \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (nths xs A) < length (nths ys A)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
length (nths xs A) < length (nths ys A)

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(1) list_all2_lengthD not_less_iff_gr_or_eq
[PROOF STATE]
proof (prove)
using this:
length (nths xs A) < length (nths ys A)
list_all2 P (nths xs A) (nths ys A)
list_all2 ?P ?xs ?ys \<Longrightarrow> length ?xs = length ?ys
(\<not> ?x < ?y) = (?y < ?x \<or> ?x = ?y)

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

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

goal (1 subgoal):
 1. \<lbrakk>length xs \<noteq> length ys; \<not> length xs < length ys\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>length xs \<noteq> length ys; \<not> length xs < length ys\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume "length xs \<noteq> length ys"
[PROOF STATE]
proof (state)
this:
length xs \<noteq> length ys

goal (1 subgoal):
 1. \<lbrakk>length xs \<noteq> length ys; \<not> length xs < length ys\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> length xs < length ys

goal (1 subgoal):
 1. \<lbrakk>length xs \<noteq> length ys; \<not> length xs < length ys\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> length xs < length ys
[PROOF STEP]
have "length xs > length ys"
[PROOF STATE]
proof (prove)
using this:
\<not> length xs < length ys

goal (1 subgoal):
 1. length ys < length xs
[PROOF STEP]
using \<open>length xs \<noteq> length ys\<close>
[PROOF STATE]
proof (prove)
using this:
\<not> length xs < length ys
length xs \<noteq> length ys

goal (1 subgoal):
 1. length ys < length xs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length ys < length xs

goal (1 subgoal):
 1. \<lbrakk>length xs \<noteq> length ys; \<not> length xs < length ys\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length ys < length xs
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
length ys < length xs

goal (1 subgoal):
 1. False
[PROOF STEP]
proof (cases "length ys \<in> A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length ys < length xs; length ys \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
length ys \<notin> A

goal (2 subgoals):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length ys < length xs; length ys \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "{i. i < length ys \<and> i \<in> -A} \<subset> {i. i < length xs \<and> i \<in> -A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < length ys \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
using False \<open>length xs > length ys\<close>
[PROOF STATE]
proof (prove)
using this:
length ys \<notin> A
length ys < length xs

goal (1 subgoal):
 1. {i. i < length ys \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{i. i < length ys \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}

goal (2 subgoals):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length ys < length xs; length ys \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < length ys \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
have "length (nths xs (-A)) > length (nths ys (-A))"
[PROOF STATE]
proof (prove)
using this:
{i. i < length ys \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}

goal (1 subgoal):
 1. length (nths ys (- A)) < length (nths xs (- A))
[PROOF STEP]
unfolding length_nths
[PROOF STATE]
proof (prove)
using this:
{i. i < length ys \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}

goal (1 subgoal):
 1. card {i. i < length ys \<and> i \<in> - A} < card {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
by (simp add: psubset_card_mono)
[PROOF STATE]
proof (state)
this:
length (nths ys (- A)) < length (nths xs (- A))

goal (2 subgoals):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
 2. \<lbrakk>length ys < length xs; length ys \<notin> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (nths ys (- A)) < length (nths xs (- A))
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
length (nths ys (- A)) < length (nths xs (- A))

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(2) list_all2_lengthD dual_order.strict_implies_not_eq
[PROOF STATE]
proof (prove)
using this:
length (nths ys (- A)) < length (nths xs (- A))
list_all2 P (nths xs (- A)) (nths ys (- A))
list_all2 ?P ?xs ?ys \<Longrightarrow> length ?xs = length ?ys
?b < ?a \<Longrightarrow> ?a \<noteq> ?b

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

goal (1 subgoal):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
length ys \<in> A

goal (1 subgoal):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
have "{i. i < length ys \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < length ys \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
using True \<open>length xs > length ys\<close>
[PROOF STATE]
proof (prove)
using this:
length ys \<in> A
length ys < length xs

goal (1 subgoal):
 1. {i. i < length ys \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{i. i < length ys \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}

goal (1 subgoal):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < length ys \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
have "length (nths xs A) > length (nths ys A)"
[PROOF STATE]
proof (prove)
using this:
{i. i < length ys \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}

goal (1 subgoal):
 1. length (nths ys A) < length (nths xs A)
[PROOF STEP]
unfolding length_nths
[PROOF STATE]
proof (prove)
using this:
{i. i < length ys \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}

goal (1 subgoal):
 1. card {i. i < length ys \<and> i \<in> A} < card {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
by (simp add: psubset_card_mono)
[PROOF STATE]
proof (state)
this:
length (nths ys A) < length (nths xs A)

goal (1 subgoal):
 1. \<lbrakk>length ys < length xs; length ys \<in> A\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (nths ys A) < length (nths xs A)
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
length (nths ys A) < length (nths xs A)

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms(1) list_all2_lengthD dual_order.strict_implies_not_eq
[PROOF STATE]
proof (prove)
using this:
length (nths ys A) < length (nths xs A)
list_all2 P (nths xs A) (nths ys A)
list_all2 ?P ?xs ?ys \<Longrightarrow> length ?xs = length ?ys
?b < ?a \<Longrightarrow> ?a \<noteq> ?b

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

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
length xs = length ys

goal (1 subgoal):
 1. list_all2 P xs ys
[PROOF STEP]
have "\<And>n. n < length xs \<Longrightarrow> P (xs ! n) (ys ! n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. n < length xs \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. n < length xs \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. n < length xs \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
assume "n < length xs"
[PROOF STATE]
proof (state)
this:
n < length xs

goal (1 subgoal):
 1. \<And>n. n < length xs \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n < length xs
[PROOF STEP]
have "n < length ys"
[PROOF STATE]
proof (prove)
using this:
n < length xs

goal (1 subgoal):
 1. n < length ys
[PROOF STEP]
using \<open>length xs = length ys\<close>
[PROOF STATE]
proof (prove)
using this:
n < length xs
length xs = length ys

goal (1 subgoal):
 1. n < length ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n < length ys

goal (1 subgoal):
 1. \<And>n. n < length xs \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n < length ys
[PROOF STEP]
show "P (xs ! n) (ys ! n)"
[PROOF STATE]
proof (prove)
using this:
n < length ys

goal (1 subgoal):
 1. P (xs ! n) (ys ! n)
[PROOF STEP]
proof (cases "n\<in>A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>n < length ys; n \<in> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
 2. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n \<in> A

goal (2 subgoals):
 1. \<lbrakk>n < length ys; n \<in> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
 2. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
have "{i. i < n \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < n \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
using \<open>n < length xs\<close> \<open>n\<in>A\<close>
[PROOF STATE]
proof (prove)
using this:
n < length xs
n \<in> A

goal (1 subgoal):
 1. {i. i < n \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{i. i < n \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}

goal (2 subgoals):
 1. \<lbrakk>n < length ys; n \<in> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
 2. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < n \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
have "card {i. i < n \<and> i \<in> A} < length (nths xs A)"
[PROOF STATE]
proof (prove)
using this:
{i. i < n \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}

goal (1 subgoal):
 1. card {i. i < n \<and> i \<in> A} < length (nths xs A)
[PROOF STEP]
unfolding length_nths
[PROOF STATE]
proof (prove)
using this:
{i. i < n \<and> i \<in> A} \<subset> {i. i < length xs \<and> i \<in> A}

goal (1 subgoal):
 1. card {i. i < n \<and> i \<in> A} < card {i. i < length xs \<and> i \<in> A}
[PROOF STEP]
by (simp add: psubset_card_mono)
[PROOF STATE]
proof (state)
this:
card {i. i < n \<and> i \<in> A} < length (nths xs A)

goal (2 subgoals):
 1. \<lbrakk>n < length ys; n \<in> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
 2. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (xs ! n) (ys ! n)
[PROOF STEP]
using nths_nth[OF \<open>n\<in>A\<close> \<open>n < length xs\<close>] nths_nth[OF \<open>n\<in>A\<close> \<open>n < length ys\<close>]
        list_all2_nthD[OF assms(1), of "card {i. i < n \<and> i \<in> A}"] length_nths
[PROOF STATE]
proof (prove)
using this:
nths xs A ! card {i. i < n \<and> i \<in> A} = xs ! n
nths ys A ! card {i. i < n \<and> i \<in> A} = ys ! n
card {i. i < n \<and> i \<in> A} < length (nths xs A) \<Longrightarrow> P (nths xs A ! card {i. i < n \<and> i \<in> A}) (nths ys A ! card {i. i < n \<and> i \<in> A})
length (nths ?xs ?I) = card {i. i < length ?xs \<and> i \<in> ?I}

goal (1 subgoal):
 1. P (xs ! n) (ys ! n)
[PROOF STEP]
by (simp add: \<open>card {i. i < n \<and> i \<in> A} < length (nths xs A)\<close>)
[PROOF STATE]
proof (state)
this:
P (xs ! n) (ys ! n)

goal (1 subgoal):
 1. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<notin> A

goal (1 subgoal):
 1. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<notin> A
[PROOF STEP]
have "n\<in>-A"
[PROOF STATE]
proof (prove)
using this:
n \<notin> A

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

goal (1 subgoal):
 1. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
have "{i. i < n \<and> i \<in> -A} \<subset> {i. i < length xs \<and> i \<in> -A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i. i < n \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
using \<open>n < length xs\<close> \<open>n\<in>-A\<close>
[PROOF STATE]
proof (prove)
using this:
n < length xs
n \<in> - A

goal (1 subgoal):
 1. {i. i < n \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{i. i < n \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}

goal (1 subgoal):
 1. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{i. i < n \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
have "card {i. i < n \<and> i \<in> -A} < length (nths xs (-A))"
[PROOF STATE]
proof (prove)
using this:
{i. i < n \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}

goal (1 subgoal):
 1. card {i. i < n \<and> i \<in> - A} < length (nths xs (- A))
[PROOF STEP]
unfolding length_nths
[PROOF STATE]
proof (prove)
using this:
{i. i < n \<and> i \<in> - A} \<subset> {i. i < length xs \<and> i \<in> - A}

goal (1 subgoal):
 1. card {i. i < n \<and> i \<in> - A} < card {i. i < length xs \<and> i \<in> - A}
[PROOF STEP]
by (simp add: psubset_card_mono)
[PROOF STATE]
proof (state)
this:
card {i. i < n \<and> i \<in> - A} < length (nths xs (- A))

goal (1 subgoal):
 1. \<lbrakk>n < length ys; n \<notin> A\<rbrakk> \<Longrightarrow> P (xs ! n) (ys ! n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (xs ! n) (ys ! n)
[PROOF STEP]
using nths_nth[OF \<open>n\<in>-A\<close> \<open>n < length xs\<close>] nths_nth[OF \<open>n\<in>-A\<close> \<open>n < length ys\<close>]
        list_all2_nthD[OF assms(2), of "card {i. i < n \<and> i \<in> -A}"] length_nths
[PROOF STATE]
proof (prove)
using this:
nths xs (- A) ! card {i. i < n \<and> i \<in> - A} = xs ! n
nths ys (- A) ! card {i. i < n \<and> i \<in> - A} = ys ! n
card {i. i < n \<and> i \<in> - A} < length (nths xs (- A)) \<Longrightarrow> P (nths xs (- A) ! card {i. i < n \<and> i \<in> - A}) (nths ys (- A) ! card {i. i < n \<and> i \<in> - A})
length (nths ?xs ?I) = card {i. i < length ?xs \<and> i \<in> ?I}

goal (1 subgoal):
 1. P (xs ! n) (ys ! n)
[PROOF STEP]
using \<open>card {i. i < n \<and> i \<in> - A} < length (nths xs (- A))\<close>
[PROOF STATE]
proof (prove)
using this:
nths xs (- A) ! card {i. i < n \<and> i \<in> - A} = xs ! n
nths ys (- A) ! card {i. i < n \<and> i \<in> - A} = ys ! n
card {i. i < n \<and> i \<in> - A} < length (nths xs (- A)) \<Longrightarrow> P (nths xs (- A) ! card {i. i < n \<and> i \<in> - A}) (nths ys (- A) ! card {i. i < n \<and> i \<in> - A})
length (nths ?xs ?I) = card {i. i < length ?xs \<and> i \<in> ?I}
card {i. i < n \<and> i \<in> - A} < length (nths xs (- A))

goal (1 subgoal):
 1. P (xs ! n) (ys ! n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P (xs ! n) (ys ! n)

goal:
No subgoals!
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
P (xs ! n) (ys ! n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?n < length xs \<Longrightarrow> P (xs ! ?n) (ys ! ?n)

goal (1 subgoal):
 1. list_all2 P xs ys
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?n < length xs \<Longrightarrow> P (xs ! ?n) (ys ! ?n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?n < length xs \<Longrightarrow> P (xs ! ?n) (ys ! ?n)

goal (1 subgoal):
 1. list_all2 P xs ys
[PROOF STEP]
using \<open>length xs = length ys\<close> list_all2_all_nthI
[PROOF STATE]
proof (prove)
using this:
?n < length xs \<Longrightarrow> P (xs ! ?n) (ys ! ?n)
length xs = length ys
\<lbrakk>length ?a = length ?b; \<And>n. n < length ?a \<Longrightarrow> ?P (?a ! n) (?b ! n)\<rbrakk> \<Longrightarrow> list_all2 ?P ?a ?b

goal (1 subgoal):
 1. list_all2 P xs ys
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
list_all2 P xs ys

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in semicategory) op_smc_is_zero_arr[smc_op_simps]:
  "f : b \<mapsto>\<^sub>0\<^bsub>op_smc \<CC>\<^esub> a \<longleftrightarrow> f : a \<mapsto>\<^sub>0\<^bsub>\<CC>\<^esub> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f : b \<mapsto>\<^sub>0\<^bsub>op_smc \<CC>\<^esub> a = f : a \<mapsto>\<^sub>0\<^bsub>\<CC>\<^esub> b
[PROOF STEP]
using op_smc_Comp
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f : ?b \<mapsto>\<^bsub>\<CC>\<^esub> ?c; ?g : ?a \<mapsto>\<^bsub>\<CC>\<^esub> ?b\<rbrakk> \<Longrightarrow> ?g \<circ>\<^sub>A\<^bsub>op_smc \<CC>\<^esub> ?f = ?f \<circ>\<^sub>A\<^bsub>\<CC>\<^esub> ?g

goal (1 subgoal):
 1. f : b \<mapsto>\<^sub>0\<^bsub>op_smc \<CC>\<^esub> a = f : a \<mapsto>\<^sub>0\<^bsub>\<CC>\<^esub> b
[PROOF STEP]
unfolding is_zero_arr_def smc_op_simps
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f : ?b \<mapsto>\<^bsub>\<CC>\<^esub> ?c; ?g : ?a \<mapsto>\<^bsub>\<CC>\<^esub> ?b\<rbrakk> \<Longrightarrow> ?g \<circ>\<^sub>A\<^bsub>op_smc \<CC>\<^esub> ?f = ?f \<circ>\<^sub>A\<^bsub>\<CC>\<^esub> ?g

goal (1 subgoal):
 1. (\<exists>z g fa. obj_null \<CC> z \<and> f = g \<circ>\<^sub>A\<^bsub>op_smc \<CC>\<^esub> fa \<and> fa : z \<mapsto>\<^bsub>\<CC>\<^esub> b \<and> g : a \<mapsto>\<^bsub>\<CC>\<^esub> z) = (\<exists>z g fa. obj_null \<CC> z \<and> f = g \<circ>\<^sub>A\<^bsub>\<CC>\<^esub> fa \<and> fa : a \<mapsto>\<^bsub>\<CC>\<^esub> z \<and> g : z \<mapsto>\<^bsub>\<CC>\<^esub> b)
[PROOF STEP]
by metis


[STATEMENT]
lemma c_fst_at_0: "c_fst 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_fst 0 = 0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c_fst 0 = 0
[PROOF STEP]
have "c_pair 0 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c_pair 0 0 = 0
[PROOF STEP]
by (rule c_pair_at_0)
[PROOF STATE]
proof (state)
this:
c_pair 0 0 = 0

goal (1 subgoal):
 1. c_fst 0 = 0
[PROOF STEP]
hence "c_fst 0 = c_fst (c_pair 0 0)"
[PROOF STATE]
proof (prove)
using this:
c_pair 0 0 = 0

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

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma all_Suc_conv:
  "(\<forall>i<Suc n. P i) \<longleftrightarrow> P 0 \<and> (\<forall>i<n. P (Suc i))" (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i<Suc n. P i) = (P 0 \<and> (\<forall>i<n. P (Suc i)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>i<Suc n. P i \<Longrightarrow> P 0 \<and> (\<forall>i<n. P (Suc i))
 2. P 0 \<and> (\<forall>i<n. P (Suc i)) \<Longrightarrow> \<forall>i<Suc n. P i
[PROOF STEP]
assume ?l
[PROOF STATE]
proof (state)
this:
\<forall>i<Suc n. P i

goal (2 subgoals):
 1. \<forall>i<Suc n. P i \<Longrightarrow> P 0 \<and> (\<forall>i<n. P (Suc i))
 2. P 0 \<and> (\<forall>i<n. P (Suc i)) \<Longrightarrow> \<forall>i<Suc n. P i
[PROOF STEP]
thus ?r
[PROOF STATE]
proof (prove)
using this:
\<forall>i<Suc n. P i

goal (1 subgoal):
 1. P 0 \<and> (\<forall>i<n. P (Suc i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P 0 \<and> (\<forall>i<n. P (Suc i))

goal (1 subgoal):
 1. P 0 \<and> (\<forall>i<n. P (Suc i)) \<Longrightarrow> \<forall>i<Suc n. P i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. P 0 \<and> (\<forall>i<n. P (Suc i)) \<Longrightarrow> \<forall>i<Suc n. P i
[PROOF STEP]
assume ?r
[PROOF STATE]
proof (state)
this:
P 0 \<and> (\<forall>i<n. P (Suc i))

goal (1 subgoal):
 1. P 0 \<and> (\<forall>i<n. P (Suc i)) \<Longrightarrow> \<forall>i<Suc n. P i
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<Suc n. P i
[PROOF STEP]
proof (intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < Suc n \<Longrightarrow> P i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < Suc n \<Longrightarrow> P i
[PROOF STEP]
assume "i < Suc n"
[PROOF STATE]
proof (state)
this:
i < Suc n

goal (1 subgoal):
 1. \<And>i. i < Suc n \<Longrightarrow> P i
[PROOF STEP]
with \<open>?r\<close>
[PROOF STATE]
proof (chain)
picking this:
P 0 \<and> (\<forall>i<n. P (Suc i))
i < Suc n
[PROOF STEP]
show "P i"
[PROOF STATE]
proof (prove)
using this:
P 0 \<and> (\<forall>i<n. P (Suc i))
i < Suc n

goal (1 subgoal):
 1. P i
[PROOF STEP]
by (cases i, auto)
[PROOF STATE]
proof (state)
this:
P i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>i<Suc n. P i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lipschitz_onI: "L-lipschitz_on X f"
  if "\<And>x y. x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> dist (f x) (f y) \<le> L * dist x y" "0 \<le> L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. L-lipschitz_on X f
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> X; ?y \<in> X\<rbrakk> \<Longrightarrow> dist (f ?x) (f ?y) \<le> L * dist ?x ?y
0 \<le> L

goal (1 subgoal):
 1. L-lipschitz_on X f
[PROOF STEP]
by (auto simp: lipschitz_on_def)


[STATEMENT]
lemma test_inf_closed_sup_complement:
  assumes "test x"
      and "test y"
      and "\<forall>u v . test u \<and> test v \<longrightarrow> test (u \<sqinter> v)"
    shows "!x \<sqinter> !y \<sqinter> (x \<squnion> y) = bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ! x \<sqinter> ! y \<sqinter> (x \<squnion> y) = bot
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ! x \<sqinter> ! y \<sqinter> (x \<squnion> y) = bot
[PROOF STEP]
have 1: "!(!x \<sqinter> !y) = x \<squnion> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ! (! x \<sqinter> ! y) = x \<squnion> y
[PROOF STEP]
by (simp add: assms de_morgan_1 neg_involutive neg_test)
[PROOF STATE]
proof (state)
this:
! (! x \<sqinter> ! y) = x \<squnion> y

goal (1 subgoal):
 1. ! x \<sqinter> ! y \<sqinter> (x \<squnion> y) = bot
[PROOF STEP]
have "test (!(!x \<sqinter> !y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. test (! (! x \<sqinter> ! y))
[PROOF STEP]
by (metis assms neg_test)
[PROOF STATE]
proof (state)
this:
test (! (! x \<sqinter> ! y))

goal (1 subgoal):
 1. ! x \<sqinter> ! y \<sqinter> (x \<squnion> y) = bot
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
test (! (! x \<sqinter> ! y))

goal (1 subgoal):
 1. ! x \<sqinter> ! y \<sqinter> (x \<squnion> y) = bot
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
test (! (! x \<sqinter> ! y))
! (! x \<sqinter> ! y) = x \<squnion> y

goal (1 subgoal):
 1. ! x \<sqinter> ! y \<sqinter> (x \<squnion> y) = bot
[PROOF STEP]
by (metis assms(1,2) de_morgan_2 neg_char)
[PROOF STATE]
proof (state)
this:
! x \<sqinter> ! y \<sqinter> (x \<squnion> y) = bot

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compact_translation:
  "compact ((+) a ` s)" if "compact s" for s :: "'a::real_normed_vector set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact ((+) a ` s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compact ((+) a ` s)
[PROOF STEP]
have "{x + y |x y. x \<in> s \<and> y \<in> {a}} = (\<lambda>x. a + x) ` s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x + y |x y. x \<in> s \<and> y \<in> {a}} = (+) a ` s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x + y |x y. x \<in> s \<and> y \<in> {a}} = (+) a ` s

goal (1 subgoal):
 1. compact ((+) a ` s)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{x + y |x y. x \<in> s \<and> y \<in> {a}} = (+) a ` s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{x + y |x y. x \<in> s \<and> y \<in> {a}} = (+) a ` s

goal (1 subgoal):
 1. compact ((+) a ` s)
[PROOF STEP]
using compact_sums [OF that compact_sing [of a]]
[PROOF STATE]
proof (prove)
using this:
{x + y |x y. x \<in> s \<and> y \<in> {a}} = (+) a ` s
compact {x + y |x y. x \<in> s \<and> y \<in> {a}}

goal (1 subgoal):
 1. compact ((+) a ` s)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
compact ((+) a ` s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma verts_ge_Suc0 : "\<not> [0..<length (g_V G)] = [0]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [0..<length (g_V G)] \<noteq> [0]
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [0..<length (g_V G)] = [0] \<Longrightarrow> False
[PROOF STEP]
assume "[0..<length (g_V G)] = [0]"
[PROOF STATE]
proof (state)
this:
[0..<length (g_V G)] = [0]

goal (1 subgoal):
 1. [0..<length (g_V G)] = [0] \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[0..<length (g_V G)] = [0]
[PROOF STEP]
have "length [0..<length (g_V G)] = 1"
[PROOF STATE]
proof (prove)
using this:
[0..<length (g_V G)] = [0]

goal (1 subgoal):
 1. length [0..<length (g_V G)] = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length [0..<length (g_V G)] = 1

goal (1 subgoal):
 1. [0..<length (g_V G)] = [0] \<Longrightarrow> False
[PROOF STEP]
with len_verts_gt1
[PROOF STATE]
proof (chain)
picking this:
1 < length (g_V G)
length [0..<length (g_V G)] = 1
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
1 < length (g_V G)
length [0..<length (g_V G)] = 1

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_card_roots_greater:
  "card {x::real. x > a \<and> poly p x = 0} = count_roots_above p a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. a < x \<and> poly p x = 0} = count_roots_above p a
[PROOF STEP]
using count_roots_above_correct
[PROOF STATE]
proof (prove)
using this:
count_roots_above ?p ?a = card {x. ?a < x \<and> poly ?p x = 0}

goal (1 subgoal):
 1. card {x. a < x \<and> poly p x = 0} = count_roots_above p a
[PROOF STEP]
by simp


[STATEMENT]
lemma emeasure_return_pmf[simp]: "emeasure (return_pmf x) X = indicator X x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (measure_pmf (return_pmf x)) X = indicator X x
[PROOF STEP]
unfolding return_pmf.rep_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (return (count_space UNIV) x) X = indicator X x
[PROOF STEP]
by (intro emeasure_return) auto


[STATEMENT]
lemma bin_to_bl_bintr:
  "bin_to_bl n (take_bit m bin) = replicate (n - m) False @ bin_to_bl (min n m) bin"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_to_bl n (take_bit m bin) = replicate (n - m) False @ bin_to_bl (min n m) bin
[PROOF STEP]
unfolding bin_to_bl_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bin_to_bl_aux n (take_bit m bin) [] = replicate (n - m) False @ bin_to_bl_aux (min n m) bin []
[PROOF STEP]
by (rule bin_to_bl_aux_bintr)


[STATEMENT]
lemma float_round_down: "real_of_float (float_round_down prec x) \<le> real_of_float x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_float (float_round_down prec x) \<le> real_of_float x
[PROOF STEP]
using truncate_down
[PROOF STATE]
proof (prove)
using this:
truncate_down ?prec ?x \<le> ?x

goal (1 subgoal):
 1. real_of_float (float_round_down prec x) \<le> real_of_float x
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma norm_vector_to_cblinfun[simp]: "norm (vector_to_cblinfun x) = norm x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (vector_to_cblinfun x) = norm x
[PROOF STEP]
proof transfer
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. onorm (\<lambda>\<phi>. one_dim_iso \<phi> *\<^sub>C x) = norm x
[PROOF STEP]
have "bounded_clinear (one_dim_iso::'a \<Rightarrow> complex)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded_clinear one_dim_iso
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
bounded_clinear one_dim_iso

goal (1 subgoal):
 1. \<And>x. onorm (\<lambda>\<phi>. one_dim_iso \<phi> *\<^sub>C x) = norm x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
bounded_clinear one_dim_iso

goal (1 subgoal):
 1. \<And>x. onorm (\<lambda>\<phi>. one_dim_iso \<phi> *\<^sub>C x) = norm x
[PROOF STEP]
have "onorm (one_dim_iso::'a \<Rightarrow> complex) * norm x = norm x"
    for x :: 'b
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. onorm one_dim_iso * norm x = norm x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
onorm one_dim_iso * norm ?x = norm ?x

goal (1 subgoal):
 1. \<And>x. onorm (\<lambda>\<phi>. one_dim_iso \<phi> *\<^sub>C x) = norm x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
bounded_clinear one_dim_iso
onorm one_dim_iso * norm ?x = norm ?x
[PROOF STEP]
show "onorm (\<lambda>\<phi>. one_dim_iso (\<phi>::'a) *\<^sub>C x) = norm x"
    for x :: 'b
[PROOF STATE]
proof (prove)
using this:
bounded_clinear one_dim_iso
onorm one_dim_iso * norm ?x = norm ?x

goal (1 subgoal):
 1. onorm (\<lambda>\<phi>. one_dim_iso \<phi> *\<^sub>C x) = norm x
[PROOF STEP]
by (subst onorm_scaleC_left)
[PROOF STATE]
proof (state)
this:
onorm (\<lambda>\<phi>. one_dim_iso \<phi> *\<^sub>C ?x) = norm ?x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_exp_simps [simp]:
  "rel_exp V (Var x) e' \<longleftrightarrow> (\<exists>y. e' = Var y \<and> V x y)"
  "rel_exp V (Const n) e' \<longleftrightarrow> e' = Const n"
  "rel_exp V (Plus e1 e2) e' \<longleftrightarrow> (\<exists>e1' e2'. e' = Plus e1' e2' \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2')"
  "rel_exp V (Div e1 e2) e' \<longleftrightarrow> (\<exists>e1' e2'. e' = Div e1' e2' \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2')"
  "rel_exp V e (Var y) \<longleftrightarrow> (\<exists>x. e = Var x \<and> V x y)"
  "rel_exp V e (Const n) \<longleftrightarrow> e = Const n"
  "rel_exp V e (Plus e1' e2') \<longleftrightarrow> (\<exists>e1 e2. e = Plus e1 e2 \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2')"
  "rel_exp V e (Div e1' e2') \<longleftrightarrow> (\<exists>e1 e2. e = Div e1 e2 \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((rel_exp V (Var x) e' = (\<exists>y. e' = Var y \<and> V x y) &&& rel_exp V (Const n) e' = (e' = Const n)) &&& rel_exp V (Plus e1 e2) e' = (\<exists>e1' e2'. e' = Plus e1' e2' \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2') &&& rel_exp V (Div e1 e2) e' = (\<exists>e1' e2'. e' = Div e1' e2' \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2')) &&& (rel_exp V e (Var y) = (\<exists>x. e = Var x \<and> V x y) &&& rel_exp V e (Const n) = (e = Const n)) &&& rel_exp V e (Plus e1' e2') = (\<exists>e1 e2. e = Plus e1 e2 \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2') &&& rel_exp V e (Div e1' e2') = (\<exists>e1 e2. e = Div e1 e2 \<and> rel_exp V e1 e1' \<and> rel_exp V e2 e2')
[PROOF STEP]
by(auto elim: exp.rel_cases)


[STATEMENT]
lemma floor_neg_numeral [simp]: "\<lfloor>- numeral v\<rfloor> = - numeral v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>- numeral v\<rfloor> = - numeral v
[PROOF STEP]
using floor_of_int [of "- numeral v"]
[PROOF STATE]
proof (prove)
using this:
\<lfloor>of_int (- numeral v)\<rfloor> = - numeral v

goal (1 subgoal):
 1. \<lfloor>- numeral v\<rfloor> = - numeral v
[PROOF STEP]
by simp


[STATEMENT]
lemma Class_cover_imp_subset_or_disj:
  assumes "A = (\<Union> (Class ` C))" and "x \<in> G" and "C \<subseteq> G"
  shows "Class x \<subseteq> A \<or> Class x \<inter> A = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Class x \<subseteq> A \<or> Class x \<inter> A = {}
[PROOF STEP]
proof(intro disjCI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Class x \<inter> A \<noteq> {} \<Longrightarrow> Class x \<subseteq> A
[PROOF STEP]
assume "Class x \<inter> A \<noteq> {}"
[PROOF STATE]
proof (state)
this:
Class x \<inter> A \<noteq> {}

goal (1 subgoal):
 1. Class x \<inter> A \<noteq> {} \<Longrightarrow> Class x \<subseteq> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Class x \<inter> A \<noteq> {}
[PROOF STEP]
obtain c where "c \<in> C" and "Class x \<inter> Class c \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
Class x \<inter> A \<noteq> {}

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> C; Class x \<inter> Class c \<noteq> {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Class x \<inter> A \<noteq> {}
A = \<Union> (Class ` C)
x \<in> G
C \<subseteq> G

goal (1 subgoal):
 1. (\<And>c. \<lbrakk>c \<in> C; Class x \<inter> Class c \<noteq> {}\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
c \<in> C
Class x \<inter> Class c \<noteq> {}

goal (1 subgoal):
 1. Class x \<inter> A \<noteq> {} \<Longrightarrow> Class x \<subseteq> A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c \<in> C
Class x \<inter> Class c \<noteq> {}
[PROOF STEP]
show "Class x \<subseteq> A"
[PROOF STATE]
proof (prove)
using this:
c \<in> C
Class x \<inter> Class c \<noteq> {}

goal (1 subgoal):
 1. Class x \<subseteq> A
[PROOF STEP]
using assms not_disjoint_implies_equal Sup_upper imageI subset_iff
[PROOF STATE]
proof (prove)
using this:
c \<in> C
Class x \<inter> Class c \<noteq> {}
A = \<Union> (Class ` C)
x \<in> G
C \<subseteq> G
\<lbrakk>Class ?a \<inter> Class ?b \<noteq> {}; ?a \<in> G; ?b \<in> G\<rbrakk> \<Longrightarrow> Class ?a = Class ?b
?x \<in> ?A \<Longrightarrow> ?x \<le> Sup ?A
?x \<in> ?A \<Longrightarrow> ?f ?x \<in> ?f ` ?A
(?A \<subseteq> ?B) = (\<forall>t. t \<in> ?A \<longrightarrow> t \<in> ?B)

goal (1 subgoal):
 1. Class x \<subseteq> A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Class x \<subseteq> A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monom_of_set_plus_monom_of_set:
  assumes "A \<inter> B = {}" "finite A" "finite B"
  shows   "monom_of_set A + monom_of_set B = monom_of_set (A \<union> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_of_set A + monom_of_set B = monom_of_set (A \<union> B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<inter> B = {}
finite A
finite B

goal (1 subgoal):
 1. monom_of_set A + monom_of_set B = monom_of_set (A \<union> B)
[PROOF STEP]
by transfer (auto simp: fun_eq_iff)


[STATEMENT]
lemma stable_sort:
  "stable_segment cmp x (sort cmp xs) = stable_segment cmp x xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>y. compare cmp x y = Equiv) (Sorting_Algorithms.sort cmp xs) = filter (\<lambda>y. compare cmp x y = Equiv) xs
[PROOF STEP]
by (induction xs) (simp_all add: stable_insort_equiv stable_insort_not_equiv)


[STATEMENT]
lemma length_foldr_bitwise_add:
  shows "length (bitwise_add x c) = length x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (bitwise_add x c) = length x
[PROOF STEP]
unfolding bitwise_add_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (foldr (\<lambda>(x, y) res car. xor3 x y car # res (carry x y car)) x (\<lambda>_. []) c) = length x
[PROOF STEP]
by(induct x arbitrary: c) auto


[STATEMENT]
lemma (in normed_vectorspace_with_fn_norm) fn_norm_ge_zero [iff]:
  assumes "continuous V f norm"
  shows "0 \<le> \<parallel>f\<parallel>\<hyphen>V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
interpret continuous V f norm
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Function_Norm.continuous V f norm
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
txt \<open>The function norm is defined as the supremum of \<open>B\<close>.
    So it is \<open>\<ge> 0\<close> if all elements in \<open>B\<close> are \<open>\<ge>
    0\<close>, provided the supremum exists and \<open>B\<close> is not empty.\<close>
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
have "lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)
[PROOF STEP]
using \<open>continuous V f norm\<close>
[PROOF STATE]
proof (prove)
using this:
Function_Norm.continuous V f norm

goal (1 subgoal):
 1. lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)
[PROOF STEP]
by (rule fn_norm_works)
[PROOF STATE]
proof (state)
this:
lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)

goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)

goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
have "0 \<in> B V f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<in> B V f
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
0 \<in> B V f

goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)
0 \<in> B V f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lub (B V f) (\<parallel>f\<parallel>\<hyphen>V)
0 \<in> B V f

goal (1 subgoal):
 1. 0 \<le> \<parallel>f\<parallel>\<hyphen>V
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
0 \<le> \<parallel>f\<parallel>\<hyphen>V

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem "\<forall>(x::int). 2 dvd x \<longrightarrow> (\<exists>(y::int). x = 2*y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. even x \<longrightarrow> (\<exists>y. x = 2 * y)
[PROOF STEP]
by cooper


[STATEMENT]
lemma subset_second_countable:
  obtains \<B> :: "'a:: second_countable_topology set set"
    where "countable \<B>"
          "{} \<notin> \<B>"
          "\<And>C. C \<in> \<B> \<Longrightarrow> openin(top_of_set S) C"
          "\<And>T. openin(top_of_set S) T \<Longrightarrow> \<exists>\<U>. \<U> \<subseteq> \<B> \<and> T = \<Union>\<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<B>. \<lbrakk>countable \<B>; {} \<notin> \<B>; \<And>C. C \<in> \<B> \<Longrightarrow> openin (top_of_set S) C; \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B>. T = \<Union> \<U>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<B>. \<lbrakk>countable \<B>; {} \<notin> \<B>; \<And>C. C \<in> \<B> \<Longrightarrow> openin (top_of_set S) C; \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B>. T = \<Union> \<U>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain \<B> :: "'a set set"
    where "countable \<B>"
      and opeB: "\<And>C. C \<in> \<B> \<Longrightarrow> openin(top_of_set S) C"
      and \<B>:    "\<And>T. openin(top_of_set S) T \<Longrightarrow> \<exists>\<U>. \<U> \<subseteq> \<B> \<and> T = \<Union>\<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<B>. \<lbrakk>countable \<B>; \<And>C. C \<in> \<B> \<Longrightarrow> openin (top_of_set S) C; \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B>. T = \<Union> \<U>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>\<B>. \<lbrakk>countable \<B>; \<And>C. C \<in> \<B> \<Longrightarrow> openin (top_of_set S) C; \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B>. T = \<Union> \<U>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain \<C> :: "'a set set"
      where "countable \<C>" and ope: "\<And>C. C \<in> \<C> \<Longrightarrow> open C"
        and \<C>: "\<And>S. open S \<Longrightarrow> \<exists>U. U \<subseteq> \<C> \<and> S = \<Union>U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<C>. \<lbrakk>countable \<C>; \<And>C. C \<in> \<C> \<Longrightarrow> open C; \<And>S. open S \<Longrightarrow> \<exists>U\<subseteq>\<C>. S = \<Union> U\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis univ_second_countable that)
[PROOF STATE]
proof (state)
this:
countable \<C>
?C \<in> \<C> \<Longrightarrow> open ?C
open ?S \<Longrightarrow> \<exists>U\<subseteq>\<C>. ?S = \<Union> U

goal (1 subgoal):
 1. (\<And>\<B>. \<lbrakk>countable \<B>; \<And>C. C \<in> \<B> \<Longrightarrow> openin (top_of_set S) C; \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B>. T = \<Union> \<U>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. countable ?\<B>
 2. \<And>C. C \<in> ?\<B> \<Longrightarrow> openin (top_of_set S) C
 3. \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>?\<B>. T = \<Union> \<U>
[PROOF STEP]
show "countable ((\<lambda>C. S \<inter> C) ` \<C>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable ((\<inter>) S ` \<C>)
[PROOF STEP]
by (simp add: \<open>countable \<C>\<close>)
[PROOF STATE]
proof (state)
this:
countable ((\<inter>) S ` \<C>)

goal (2 subgoals):
 1. \<And>C. C \<in> (\<inter>) S ` \<C> \<Longrightarrow> openin (top_of_set S) C
 2. \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>(\<inter>) S ` \<C>. T = \<Union> \<U>
[PROOF STEP]
show "\<And>C. C \<in> (\<inter>) S ` \<C> \<Longrightarrow> openin (top_of_set S) C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C. C \<in> (\<inter>) S ` \<C> \<Longrightarrow> openin (top_of_set S) C
[PROOF STEP]
using ope
[PROOF STATE]
proof (prove)
using this:
?C \<in> \<C> \<Longrightarrow> open ?C

goal (1 subgoal):
 1. \<And>C. C \<in> (\<inter>) S ` \<C> \<Longrightarrow> openin (top_of_set S) C
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?C \<in> (\<inter>) S ` \<C> \<Longrightarrow> openin (top_of_set S) ?C

goal (1 subgoal):
 1. \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>(\<inter>) S ` \<C>. T = \<Union> \<U>
[PROOF STEP]
show "\<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>(\<inter>) S ` \<C>. T = \<Union>\<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>(\<inter>) S ` \<C>. T = \<Union> \<U>
[PROOF STEP]
by (metis \<C> image_mono inf_Sup openin_open)
[PROOF STATE]
proof (state)
this:
openin (top_of_set S) ?T \<Longrightarrow> \<exists>\<U>\<subseteq>(\<inter>) S ` \<C>. ?T = \<Union> \<U>

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
countable \<B>
?C \<in> \<B> \<Longrightarrow> openin (top_of_set S) ?C
openin (top_of_set S) ?T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B>. ?T = \<Union> \<U>

goal (1 subgoal):
 1. (\<And>\<B>. \<lbrakk>countable \<B>; {} \<notin> \<B>; \<And>C. C \<in> \<B> \<Longrightarrow> openin (top_of_set S) C; \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B>. T = \<Union> \<U>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. countable ?\<B>
 2. {} \<notin> ?\<B>
 3. \<And>C. C \<in> ?\<B> \<Longrightarrow> openin (top_of_set S) C
 4. \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>?\<B>. T = \<Union> \<U>
[PROOF STEP]
show "countable (\<B> - {{}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. countable (\<B> - {{}})
[PROOF STEP]
using \<open>countable \<B>\<close>
[PROOF STATE]
proof (prove)
using this:
countable \<B>

goal (1 subgoal):
 1. countable (\<B> - {{}})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
countable (\<B> - {{}})

goal (3 subgoals):
 1. {} \<notin> \<B> - {{}}
 2. \<And>C. C \<in> \<B> - {{}} \<Longrightarrow> openin (top_of_set S) C
 3. \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B> - {{}}. T = \<Union> \<U>
[PROOF STEP]
show "\<And>C. \<lbrakk>C \<in> \<B> - {{}}\<rbrakk> \<Longrightarrow> openin (top_of_set S) C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>C. C \<in> \<B> - {{}} \<Longrightarrow> openin (top_of_set S) C
[PROOF STEP]
by (simp add: \<open>\<And>C. C \<in> \<B> \<Longrightarrow> openin (top_of_set S) C\<close>)
[PROOF STATE]
proof (state)
this:
?C \<in> \<B> - {{}} \<Longrightarrow> openin (top_of_set S) ?C

goal (2 subgoals):
 1. {} \<notin> \<B> - {{}}
 2. \<And>T. openin (top_of_set S) T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B> - {{}}. T = \<Union> \<U>
[PROOF STEP]
show "\<exists>\<U>\<subseteq>\<B> - {{}}. T = \<Union>\<U>" if "openin (top_of_set S) T" for T
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<U>\<subseteq>\<B> - {{}}. T = \<Union> \<U>
[PROOF STEP]
using \<B> [OF that]
[PROOF STATE]
proof (prove)
using this:
\<exists>\<U>\<subseteq>\<B>. T = \<Union> \<U>

goal (1 subgoal):
 1. \<exists>\<U>\<subseteq>\<B> - {{}}. T = \<Union> \<U>
[PROOF STEP]
apply clarify
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>\<U>. \<lbrakk>\<U> \<subseteq> \<B>; T = \<Union> \<U>\<rbrakk> \<Longrightarrow> \<exists>\<U>'\<subseteq>\<B> - {{}}. \<Union> \<U> = \<Union> \<U>'
[PROOF STEP]
apply (rule_tac x="\<U> - {{}}" in exI, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
openin (top_of_set S) ?T \<Longrightarrow> \<exists>\<U>\<subseteq>\<B> - {{}}. ?T = \<Union> \<U>

goal (1 subgoal):
 1. {} \<notin> \<B> - {{}}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trapG1_subset:
  shows "trapG1 \<subseteq> cball (0::real \<times> real) 20"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trapG1 \<subseteq> cball 0 20
[PROOF STEP]
unfolding trapG1_def pos_quad_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p. - snd p \<le> 0} \<inter> {p. - fst p \<le> 0} \<inter> ({p. snd p - 751 / 100 \<le> 0} \<inter> {p. fst p + snd p - 812 / 100 \<le> 0}) \<subseteq> cball 0 20
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>0 \<le> b; 0 \<le> a; b * 100 \<le> 751; a * 25 + b * 25 \<le> 203\<rbrakk> \<Longrightarrow> norm (a, b) \<le> 20
[PROOF STEP]
using arith norm_Pair_le
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?b; 0 \<le> ?a; ?b * 100 \<le> 751; ?a * 25 + ?b * 25 \<le> 203\<rbrakk> \<Longrightarrow> norm ?a + norm ?b \<le> 20
norm (?x, ?y) \<le> norm ?x + norm ?y

goal (1 subgoal):
 1. \<And>a b. \<lbrakk>0 \<le> b; 0 \<le> a; b * 100 \<le> 751; a * 25 + b * 25 \<le> 203\<rbrakk> \<Longrightarrow> norm (a, b) \<le> 20
[PROOF STEP]
by smt


[STATEMENT]
lemma homeomorphism_on_inverse:
  fixes f::"'a::topological_space \<Rightarrow> 'b::topological_space"
  assumes "homeomorphism_on X f"
  shows "homeomorphism_on (f`X) (inv_into X f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
obtain g where g: "homeomorphism X (f`X) f g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>g. homeomorphism X (f ` X) f g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
homeomorphism_on X f

goal (1 subgoal):
 1. (\<And>g. homeomorphism X (f ` X) f g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding homeomorphism_on_def
[PROOF STATE]
proof (prove)
using this:
Ex (homeomorphism X (f ` X) f)

goal (1 subgoal):
 1. (\<And>g. homeomorphism X (f ` X) f g \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
homeomorphism X (f ` X) f g

goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homeomorphism X (f ` X) f g
[PROOF STEP]
have "g`f`X = X"
[PROOF STATE]
proof (prove)
using this:
homeomorphism X (f ` X) f g

goal (1 subgoal):
 1. g ` f ` X = X
[PROOF STEP]
by (simp add: homeomorphism_def)
[PROOF STATE]
proof (state)
this:
g ` f ` X = X

goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
g ` f ` X = X
[PROOF STEP]
have "homeomorphism_on (f`X) g"
[PROOF STATE]
proof (prove)
using this:
g ` f ` X = X

goal (1 subgoal):
 1. homeomorphism_on (f ` X) g
[PROOF STEP]
unfolding homeomorphism_on_def
[PROOF STATE]
proof (prove)
using this:
g ` f ` X = X

goal (1 subgoal):
 1. Ex (homeomorphism (f ` X) (g ` f ` X) g)
[PROOF STEP]
using homeomorphism_symD[OF g]
[PROOF STATE]
proof (prove)
using this:
g ` f ` X = X
homeomorphism (f ` X) X g f

goal (1 subgoal):
 1. Ex (homeomorphism (f ` X) (g ` f ` X) g)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
homeomorphism_on (f ` X) g

goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
homeomorphism_on (f ` X) g

goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
have "g x = inv_into X f x" if "x \<in> f`X" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x = inv_into X f x
[PROOF STEP]
using g that
[PROOF STATE]
proof (prove)
using this:
homeomorphism X (f ` X) f g
x \<in> f ` X

goal (1 subgoal):
 1. g x = inv_into X f x
[PROOF STEP]
unfolding homeomorphism_def
[PROOF STATE]
proof (prove)
using this:
(\<forall>x\<in>X. g (f x) = x) \<and> f ` X = f ` X \<and> continuous_on X f \<and> (\<forall>y\<in>f ` X. f (g y) = y) \<and> g ` f ` X = X \<and> continuous_on (f ` X) g
x \<in> f ` X

goal (1 subgoal):
 1. g x = inv_into X f x
[PROOF STEP]
by (auto, metis f_inv_into_f inv_into_into that)
[PROOF STATE]
proof (state)
this:
?x \<in> f ` X \<Longrightarrow> g ?x = inv_into X f ?x

goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
homeomorphism_on (f ` X) g
?x \<in> f ` X \<Longrightarrow> g ?x = inv_into X f ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
homeomorphism_on (f ` X) g
?x \<in> f ` X \<Longrightarrow> g ?x = inv_into X f ?x

goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
using homeomorphism_on_cong
[PROOF STATE]
proof (prove)
using this:
homeomorphism_on (f ` X) g
?x \<in> f ` X \<Longrightarrow> g ?x = inv_into X f ?x
\<lbrakk>homeomorphism_on ?X ?f; ?X' = ?X; \<And>x. x \<in> ?X \<Longrightarrow> ?f' x = ?f x\<rbrakk> \<Longrightarrow> homeomorphism_on ?X' ?f'

goal (1 subgoal):
 1. homeomorphism_on (f ` X) (inv_into X f)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
homeomorphism_on (f ` X) (inv_into X f)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma code_im: "code (range f\<^sup>\<C>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. code (range f\<^sup>\<C>)
[PROOF STEP]
using code_morph morph_concat_map
[PROOF STATE]
proof (prove)
using this:
inj f
concat (map f\<^sup>\<C> ?x) = f ?x

goal (1 subgoal):
 1. code (range f\<^sup>\<C>)
[PROOF STEP]
unfolding inj_on_def code_def core_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. f x = f y \<longrightarrow> x = y
concat (map (\<lambda>x. f [x]) ?x) = f ?x

goal (1 subgoal):
 1. \<forall>xs ys. xs \<in> lists (range (\<lambda>x. f [x])) \<longrightarrow> ys \<in> lists (range (\<lambda>x. f [x])) \<longrightarrow> concat xs = concat ys \<longrightarrow> xs = ys
[PROOF STEP]
unfolding lists_image lists_UNIV
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. f x = f y \<longrightarrow> x = y
concat (map (\<lambda>x. f [x]) ?x) = f ?x

goal (1 subgoal):
 1. \<forall>xs ys. xs \<in> range (map (\<lambda>x. f [x])) \<longrightarrow> ys \<in> range (map (\<lambda>x. f [x])) \<longrightarrow> concat xs = concat ys \<longrightarrow> xs = ys
[PROOF STEP]
by fastforce


[STATEMENT]
lemma inj_mult:
  assumes coprime: "coprime x (q::nat)"
    and y: "y < q"
    and y': "y' < q"
  and map: "x * y mod q = x * y' mod q"
shows "y = y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y = y'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y = y'
[PROOF STEP]
have "x*y mod q = x*y' mod q \<Longrightarrow> y mod q = y' mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
have "x*y mod q = x*y' mod q \<Longrightarrow> [x*y = x*y'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> [x * y = x * y'] (mod q)
[PROOF STEP]
by(simp add: cong_def)
[PROOF STATE]
proof (state)
this:
x * y mod q = x * y' mod q \<Longrightarrow> [x * y = x * y'] (mod q)

goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * y mod q = x * y' mod q \<Longrightarrow> [x * y = x * y'] (mod q)

goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
have "[x*y = x*y'] (mod q) = [y = y'] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [x * y = x * y'] (mod q) = [y = y'] (mod q)
[PROOF STEP]
by(simp add: cong_mult_lcancel_nat coprime)
[PROOF STATE]
proof (state)
this:
[x * y = x * y'] (mod q) = [y = y'] (mod q)

goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
[x * y = x * y'] (mod q) = [y = y'] (mod q)

goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
have "[y = y'] (mod q) \<Longrightarrow> y mod q = y' mod q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [y = y'] (mod q) \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
by(simp add: cong_def)
[PROOF STATE]
proof (state)
this:
[y = y'] (mod q) \<Longrightarrow> y mod q = y' mod q

goal (1 subgoal):
 1. x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x * y mod q = x * y' mod q \<Longrightarrow> [y = y'] (mod q)
[y = y'] (mod q) \<Longrightarrow> y mod q = y' mod q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * y mod q = x * y' mod q \<Longrightarrow> [y = y'] (mod q)
[y = y'] (mod q) \<Longrightarrow> y mod q = y' mod q

goal (1 subgoal):
 1. y mod q = y' mod q
[PROOF STEP]
by(simp add: map)
[PROOF STATE]
proof (state)
this:
y mod q = y' mod q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
have "y mod q = y' mod q \<Longrightarrow> y = y'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y mod q = y' mod q \<Longrightarrow> y = y'
[PROOF STEP]
by(simp add: y y')
[PROOF STATE]
proof (state)
this:
y mod q = y' mod q \<Longrightarrow> y = y'

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
y mod q = y' mod q \<Longrightarrow> y = y'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * y mod q = x * y' mod q \<Longrightarrow> y mod q = y' mod q
y mod q = y' mod q \<Longrightarrow> y = y'

goal (1 subgoal):
 1. y = y'
[PROOF STEP]
by(simp add: map)
[PROOF STATE]
proof (state)
this:
y = y'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_leaf_is_leaf:
  assumes "T' = \<lparr>verts = V, arcs = A, tail = t, head = h\<rparr>"
      and "T = \<lparr>verts = V \<union> {v}, arcs = A \<union> {a}, tail = t(a := u), head = h(a := v)\<rparr>"
      and "u \<in> V"
      and "v \<notin> V"
      and "a \<notin> A"
      and "directed_tree T' root'"
    shows "leaf v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. leaf v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. leaf v
[PROOF STEP]
have 0: "wf_digraph T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_digraph T
[PROOF STEP]
by (simp add: wf_digraph_axioms)
[PROOF STATE]
proof (state)
this:
wf_digraph T

goal (1 subgoal):
 1. leaf v
[PROOF STEP]
have 1: "wf_digraph T'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_digraph T'
[PROOF STEP]
using assms(6) directed_tree.axioms(1)
[PROOF STATE]
proof (prove)
using this:
directed_tree T' root'
directed_tree ?T ?root \<Longrightarrow> wf_digraph ?T

goal (1 subgoal):
 1. wf_digraph T'
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
wf_digraph T'

goal (1 subgoal):
 1. leaf v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
wf_digraph T'
[PROOF STEP]
have "\<forall>a\<in>arcs T. tail T a \<noteq> v"
[PROOF STATE]
proof (prove)
using this:
wf_digraph T'

goal (1 subgoal):
 1. \<forall>a\<in>arcs T. tail T a \<noteq> v
[PROOF STEP]
by (metis Un_insert_right assms(1-4) fun_upd_apply insert_iff
        pre_digraph.select_convs(1-3) sup_bot_right wf_digraph.tail_in_verts)
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>arcs T. tail T a \<noteq> v

goal (1 subgoal):
 1. leaf v
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>a\<in>arcs T. tail T a \<noteq> v
[PROOF STEP]
have "out_arcs T v = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>arcs T. tail T a \<noteq> v

goal (1 subgoal):
 1. out_arcs T v = {}
[PROOF STEP]
using in_out_arcs_conv
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>arcs T. tail T a \<noteq> v
(?e \<in> out_arcs ?G ?v) = (?e \<in> arcs ?G \<and> tail ?G ?e = ?v)

goal (1 subgoal):
 1. out_arcs T v = {}
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
out_arcs T v = {}

goal (1 subgoal):
 1. leaf v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
out_arcs T v = {}

goal (1 subgoal):
 1. leaf v
[PROOF STEP]
have "v \<in> verts T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<in> verts T
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
T = \<lparr>verts = V \<union> {v}, arcs = A \<union> {a}, tail = t(a := u), head = h(a := v)\<rparr>

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

goal (1 subgoal):
 1. leaf v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
out_arcs T v = {}
v \<in> verts T
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
out_arcs T v = {}
v \<in> verts T

goal (1 subgoal):
 1. leaf v
[PROOF STEP]
by (simp add: leaf_def)
[PROOF STATE]
proof (state)
this:
leaf v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_deg_sum_le: "((poly_deg (sum f A))::'a::add_linorder_min) \<le> Max (poly_deg ` f ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
proof (cases "finite A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite A \<Longrightarrow> poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
 2. infinite A \<Longrightarrow> poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite A

goal (2 subgoals):
 1. finite A \<Longrightarrow> poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
 2. infinite A \<Longrightarrow> poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
proof (induct A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. poly_deg (sum f {}) \<le> Max (poly_deg ` f ` {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; poly_deg (sum f F) \<le> Max (poly_deg ` f ` F)\<rbrakk> \<Longrightarrow> poly_deg (sum f (insert x F)) \<le> Max (poly_deg ` f ` insert x F)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. poly_deg (sum f {}) \<le> Max (poly_deg ` f ` {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; poly_deg (sum f F) \<le> Max (poly_deg ` f ` F)\<rbrakk> \<Longrightarrow> poly_deg (sum f (insert x F)) \<le> Max (poly_deg ` f ` insert x F)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg (sum f {}) \<le> Max (poly_deg ` f ` {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_deg (sum f {}) \<le> Max (poly_deg ` f ` {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; poly_deg (sum f F) \<le> Max (poly_deg ` f ` F)\<rbrakk> \<Longrightarrow> poly_deg (sum f (insert x F)) \<le> Max (poly_deg ` f ` insert x F)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; poly_deg (sum f F) \<le> Max (poly_deg ` f ` F)\<rbrakk> \<Longrightarrow> poly_deg (sum f (insert x F)) \<le> Max (poly_deg ` f ` insert x F)
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; poly_deg (sum f F) \<le> Max (poly_deg ` f ` F)\<rbrakk> \<Longrightarrow> poly_deg (sum f (insert x F)) \<le> Max (poly_deg ` f ` insert x F)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
proof (cases "A = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
 2. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = {}

goal (2 subgoals):
 1. A = {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
 2. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A = {}

goal (1 subgoal):
 1. poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> {}

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
have "poly_deg (sum f (insert a A)) \<le> max (poly_deg (f a)) (poly_deg (sum f A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_deg (sum f (insert a A)) \<le> max (poly_deg (f a)) (poly_deg (sum f A))
[PROOF STEP]
by (simp only: comm_monoid_add_class.sum.insert[OF insert(1) insert(2)] poly_deg_plus_le)
[PROOF STATE]
proof (state)
this:
poly_deg (sum f (insert a A)) \<le> max (poly_deg (f a)) (poly_deg (sum f A))

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
poly_deg (sum f (insert a A)) \<le> max (poly_deg (f a)) (poly_deg (sum f A))

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
have "... \<le> max (poly_deg (f a)) (Max (poly_deg ` f ` A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (poly_deg (f a)) (poly_deg (sum f A)) \<le> max (poly_deg (f a)) (Max (poly_deg ` f ` A))
[PROOF STEP]
using insert(3) max.mono
[PROOF STATE]
proof (prove)
using this:
poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
\<lbrakk>?c \<le> ?a; ?d \<le> ?b\<rbrakk> \<Longrightarrow> max ?c ?d \<le> max ?a ?b

goal (1 subgoal):
 1. max (poly_deg (f a)) (poly_deg (sum f A)) \<le> max (poly_deg (f a)) (Max (poly_deg ` f ` A))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
max (poly_deg (f a)) (poly_deg (sum f A)) \<le> max (poly_deg (f a)) (Max (poly_deg ` f ` A))

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
max (poly_deg (f a)) (poly_deg (sum f A)) \<le> max (poly_deg (f a)) (Max (poly_deg ` f ` A))

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
have "... = (Max (poly_deg ` f ` (insert a A)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max (poly_deg (f a)) (Max (poly_deg ` f ` A)) = Max (poly_deg ` f ` insert a A)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
A \<noteq> {}

goal (1 subgoal):
 1. max (poly_deg (f a)) (Max (poly_deg ` f ` A)) = Max (poly_deg ` f ` insert a A)
[PROOF STEP]
by (simp add: insert(1))
[PROOF STATE]
proof (state)
this:
max (poly_deg (f a)) (Max (poly_deg ` f ` A)) = Max (poly_deg ` f ` insert a A)

goal (1 subgoal):
 1. A \<noteq> {} \<Longrightarrow> poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)

goal (1 subgoal):
 1. poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly_deg (sum f (insert a A)) \<le> Max (poly_deg ` f ` insert a A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)

goal (1 subgoal):
 1. infinite A \<Longrightarrow> poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite A \<Longrightarrow> poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite A

goal (1 subgoal):
 1. infinite A \<Longrightarrow> poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite A

goal (1 subgoal):
 1. poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
poly_deg (sum f A) \<le> Max (poly_deg ` f ` A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma select_finite:
  assumes "finite S"
  shows "finite (select f S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (select f S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. finite (select f S)
[PROOF STEP]
unfolding select_def
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. finite {z |z. \<exists>x\<in>S. f x = Some z}
[PROOF STEP]
by finite


[STATEMENT]
lemma minimum_spanning_forest_impl_tree:
  assumes "minimum_spanning_forest F G"
  assumes valid_G: "valid_graph G"
  assumes "connected_graph F"
  shows "minimum_spanning_tree F G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. minimum_spanning_tree F G
[PROOF STEP]
using assms valid_graph.connected_impl_maximally_connected[OF valid_G]
[PROOF STATE]
proof (prove)
using this:
minimum_spanning_forest F G
valid_graph G
connected_graph F
\<lbrakk>connected_graph ?H; subgraph ?H G\<rbrakk> \<Longrightarrow> maximally_connected ?H G

goal (1 subgoal):
 1. minimum_spanning_tree F G
[PROOF STEP]
unfolding minimum_spanning_forest_def minimum_spanning_tree_def
    spanning_forest_def spanning_tree_def tree_def
    optimal_forest_def optimal_tree_def
[PROOF STATE]
proof (prove)
using this:
(forest F \<and> maximally_connected F G \<and> subgraph F G) \<and> (\<forall>F'. forest F' \<and> maximally_connected F' G \<and> subgraph F' G \<longrightarrow> edge_weight F \<le> edge_weight F')
valid_graph G
connected_graph F
\<lbrakk>connected_graph ?H; subgraph ?H G\<rbrakk> \<Longrightarrow> maximally_connected ?H G

goal (1 subgoal):
 1. ((forest F \<and> connected_graph F) \<and> subgraph F G) \<and> (\<forall>F'. (forest F' \<and> connected_graph F') \<and> subgraph F' G \<longrightarrow> edge_weight F \<le> edge_weight F')
[PROOF STEP]
by auto


[STATEMENT]
lemma state_cover_assignment_card :
  assumes "is_state_cover_assignment M V"
  and     "observable M"
shows "card (V ` reachable_states M) = card (reachable_states M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (V ` reachable_states M) = size_r M
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card (V ` reachable_states M) = size_r M
[PROOF STEP]
have "inj_on V (reachable_states M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on V (reachable_states M)
[PROOF STEP]
using state_cover_assignment_inj[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?q1.0 \<in> reachable_states M; ?q2.0 \<in> reachable_states M; ?q1.0 \<noteq> ?q2.0\<rbrakk> \<Longrightarrow> V ?q1.0 \<noteq> V ?q2.0

goal (1 subgoal):
 1. inj_on V (reachable_states M)
[PROOF STEP]
by (meson inj_onI)
[PROOF STATE]
proof (state)
this:
inj_on V (reachable_states M)

goal (1 subgoal):
 1. card (V ` reachable_states M) = size_r M
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inj_on V (reachable_states M)
[PROOF STEP]
have "card (reachable_states M) \<le> card (V ` reachable_states M)"
[PROOF STATE]
proof (prove)
using this:
inj_on V (reachable_states M)

goal (1 subgoal):
 1. size_r M \<le> card (V ` reachable_states M)
[PROOF STEP]
using fsm_states_finite restrict_to_reachable_states_simps(2)
[PROOF STATE]
proof (prove)
using this:
inj_on V (reachable_states M)
finite (FSM.states ?M)
FSM.states (restrict_to_reachable_states ?M) = reachable_states ?M

goal (1 subgoal):
 1. size_r M \<le> card (V ` reachable_states M)
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
size_r M \<le> card (V ` reachable_states M)

goal (1 subgoal):
 1. card (V ` reachable_states M) = size_r M
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
size_r M \<le> card (V ` reachable_states M)

goal (1 subgoal):
 1. card (V ` reachable_states M) = size_r M
[PROOF STEP]
have "card (V ` reachable_states M) \<le> card (reachable_states M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (V ` reachable_states M) \<le> size_r M
[PROOF STEP]
using fsm_states_finite
[PROOF STATE]
proof (prove)
using this:
finite (FSM.states ?M)

goal (1 subgoal):
 1. card (V ` reachable_states M) \<le> size_r M
[PROOF STEP]
using card_image_le
[PROOF STATE]
proof (prove)
using this:
finite (FSM.states ?M)
finite ?A \<Longrightarrow> card (?f ` ?A) \<le> card ?A

goal (1 subgoal):
 1. card (V ` reachable_states M) \<le> size_r M
[PROOF STEP]
by (metis restrict_to_reachable_states_simps(2))
[PROOF STATE]
proof (state)
this:
card (V ` reachable_states M) \<le> size_r M

goal (1 subgoal):
 1. card (V ` reachable_states M) = size_r M
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
size_r M \<le> card (V ` reachable_states M)
card (V ` reachable_states M) \<le> size_r M
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size_r M \<le> card (V ` reachable_states M)
card (V ` reachable_states M) \<le> size_r M

goal (1 subgoal):
 1. card (V ` reachable_states M) = size_r M
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (V ` reachable_states M) = size_r M

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rank_sup [simp]: "rank (a \<squnion> b) = rank a \<squnion> rank b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (a \<squnion> b) = rank a \<squnion> rank b
[PROOF STEP]
proof (rule antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rank (a \<squnion> b) \<le> rank a \<squnion> rank b
 2. rank a \<squnion> rank b \<le> rank (a \<squnion> b)
[PROOF STEP]
have o: "Ord (rank a \<squnion> rank b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Ord (rank a \<squnion> rank b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Ord (rank a \<squnion> rank b)

goal (2 subgoals):
 1. rank (a \<squnion> b) \<le> rank a \<squnion> rank b
 2. rank a \<squnion> rank b \<le> rank (a \<squnion> b)
[PROOF STEP]
thus "rank (a \<squnion> b) \<le> rank a \<squnion> rank b"
[PROOF STATE]
proof (prove)
using this:
Ord (rank a \<squnion> rank b)

goal (1 subgoal):
 1. rank (a \<squnion> b) \<le> rank a \<squnion> rank b
[PROOF STEP]
apply (rule Vset_succ_rank_le, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> Vset (rank a \<squnion> rank b) \<and> b \<le> Vset (rank a \<squnion> rank b)
[PROOF STEP]
apply (metis le_Vset_rank order_trans Vset_mono sup_ge1 sup_ge2 o)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
rank (a \<squnion> b) \<le> rank a \<squnion> rank b

goal (1 subgoal):
 1. rank a \<squnion> rank b \<le> rank (a \<squnion> b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank a \<squnion> rank b \<le> rank (a \<squnion> b)
[PROOF STEP]
show "rank a \<squnion> rank b \<le> rank (a \<squnion> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank a \<squnion> rank b \<le> rank (a \<squnion> b)
[PROOF STEP]
by (metis le_supI le_supI1 le_supI2 order_eq_refl rank_mono)
[PROOF STATE]
proof (state)
this:
rank a \<squnion> rank b \<le> rank (a \<squnion> b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eventually_deriv_inverse:
  assumes "x \<noteq> 0"
    shows "\<forall>\<^sub>F x in nhds x. deriv inverse x = - 1 / (x ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
obtain T where open_T: "open T" and "\<forall>z\<in>T. z \<noteq> 0" and x_in_T: "x \<in> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>T. \<lbrakk>open T; \<forall>z\<in>T. z \<noteq> (0::'a); x \<in> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms t1_space
[PROOF STATE]
proof (prove)
using this:
x \<noteq> (0::'a)
?x \<noteq> ?y \<Longrightarrow> \<exists>U. open U \<and> ?x \<in> U \<and> ?y \<notin> U

goal (1 subgoal):
 1. (\<And>T. \<lbrakk>open T; \<forall>z\<in>T. z \<noteq> (0::'a); x \<in> T\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
open T
\<forall>z\<in>T. z \<noteq> (0::'a)
x \<in> T

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
open T
\<forall>z\<in>T. z \<noteq> (0::'a)
x \<in> T
[PROOF STEP]
have "\<forall>x \<in> T. deriv inverse x = - 1 / (x ^ 2)"
[PROOF STATE]
proof (prove)
using this:
open T
\<forall>z\<in>T. z \<noteq> (0::'a)
x \<in> T

goal (1 subgoal):
 1. \<forall>x\<in>T. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>T. deriv inverse x = - (1::'a) / x\<^sup>2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>T. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>T. deriv inverse x = - (1::'a) / x\<^sup>2

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
using eventually_nhds open_T x_in_T
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>T. deriv inverse x = - (1::'a) / x\<^sup>2
eventually ?P (nhds ?a) = (\<exists>S. open S \<and> ?a \<in> S \<and> (\<forall>x\<in>S. ?P x))
open T
x \<in> T

goal (1 subgoal):
 1. \<forall>\<^sub>F x in nhds x. deriv inverse x = - (1::'a) / x\<^sup>2
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in nhds x. deriv inverse x = - (1::'a) / x\<^sup>2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interior_halfspace_ge [simp]:
   "a \<noteq> 0 \<Longrightarrow> interior {x. a \<bullet> x \<ge> b} = {x. a \<bullet> x > b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> interior {x. b \<le> a \<bullet> x} = {x. b < a \<bullet> x}
[PROOF STEP]
using interior_halfspace_le [of "-a" "-b"]
[PROOF STATE]
proof (prove)
using this:
- a \<noteq> (0::'a) \<Longrightarrow> interior {x. - a \<bullet> x \<le> - b} = {x. - a \<bullet> x < - b}

goal (1 subgoal):
 1. a \<noteq> (0::'a) \<Longrightarrow> interior {x. b \<le> a \<bullet> x} = {x. b < a \<bullet> x}
[PROOF STEP]
by simp


[STATEMENT]
lemma convergence_norm_F:
  fixes z :: "_ :: real_normed_div_algebra"
  assumes z: "convergence_G x y z"
  shows "summable (\<lambda>n. f x y n * norm z ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. f x y n * norm z ^ n)
[PROOF STEP]
using convergence_norm_G[OF z]
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. p x y n * norm z ^ n)

goal (1 subgoal):
 1. summable (\<lambda>n. f x y n * norm z ^ n)
[PROOF STEP]
by (rule summable_comparison_test[rotated])
     (auto simp add: f_nonneg abs_mult intro!: exI[of _ 0] mult_right_mono f_le_p)


[STATEMENT]
lemma card_poly_roots_bound:
  fixes p :: "'a::{comm_ring_1,ring_no_zero_divisors} poly"
  assumes "p \<noteq> 0"
  shows   "card {x. poly p x = 0} \<le> degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0

goal (1 subgoal):
 1. card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
proof (induction "degree p" arbitrary: p rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>degree pa < degree p; pa \<noteq> 0\<rbrakk> \<Longrightarrow> card {x. poly pa x = (0::'a)} \<le> degree pa; p \<noteq> 0\<rbrakk> \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
case (less p)
[PROOF STATE]
proof (state)
this:
\<lbrakk>degree ?p < degree p; ?p \<noteq> 0\<rbrakk> \<Longrightarrow> card {x. poly ?p x = (0::'a)} \<le> degree ?p
p \<noteq> 0

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>degree pa < degree p; pa \<noteq> 0\<rbrakk> \<Longrightarrow> card {x. poly pa x = (0::'a)} \<le> degree pa; p \<noteq> 0\<rbrakk> \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
proof (cases "\<exists>x. poly p x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
 2. \<nexists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<nexists>x. poly p x = (0::'a)

goal (2 subgoals):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
 2. \<nexists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
hence "{x. poly p x = 0} = {}"
[PROOF STATE]
proof (prove)
using this:
\<nexists>x. poly p x = (0::'a)

goal (1 subgoal):
 1. {x. poly p x = (0::'a)} = {}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
{x. poly p x = (0::'a)} = {}

goal (2 subgoals):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
 2. \<nexists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{x. poly p x = (0::'a)} = {}

goal (1 subgoal):
 1. card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {x. poly p x = (0::'a)} \<le> degree p

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
\<exists>x. poly p x = (0::'a)

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. poly p x = (0::'a)
[PROOF STEP]
obtain x where x: "poly p x = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. poly p x = (0::'a)

goal (1 subgoal):
 1. (\<And>x. poly p x = (0::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
poly p x = (0::'a)

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
hence "[:-x, 1:] dvd p"
[PROOF STATE]
proof (prove)
using this:
poly p x = (0::'a)

goal (1 subgoal):
 1. [:- x, 1::'a:] dvd p
[PROOF STEP]
by (subst (asm) poly_eq_0_iff_dvd)
[PROOF STATE]
proof (state)
this:
[:- x, 1::'a:] dvd p

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[:- x, 1::'a:] dvd p
[PROOF STEP]
obtain q where q: "p = [:-x, 1:] * q"
[PROOF STATE]
proof (prove)
using this:
[:- x, 1::'a:] dvd p

goal (1 subgoal):
 1. (\<And>q. p = [:- x, 1::'a:] * q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: dvd_def)
[PROOF STATE]
proof (state)
this:
p = [:- x, 1::'a:] * q

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
with \<open>p \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> 0
p = [:- x, 1::'a:] * q
[PROOF STEP]
have [simp]: "q \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
p = [:- x, 1::'a:] * q

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

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
have deg: "degree p = Suc (degree q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree p = Suc (degree q)
[PROOF STEP]
by (subst q, subst degree_mult_eq) auto
[PROOF STATE]
proof (state)
this:
degree p = Suc (degree q)

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
have "card {x. poly p x = 0} \<le> card (insert x {x. poly q x = 0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. poly p x = (0::'a)} \<le> card (insert x {x. poly q x = (0::'a)})
[PROOF STEP]
by (intro card_mono) (auto intro: poly_roots_finite simp: q)
[PROOF STATE]
proof (state)
this:
card {x. poly p x = (0::'a)} \<le> card (insert x {x. poly q x = (0::'a)})

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {x. poly p x = (0::'a)} \<le> card (insert x {x. poly q x = (0::'a)})

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
have "\<dots> \<le> Suc (card {x. poly q x = 0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (insert x {x. poly q x = (0::'a)}) \<le> Suc (card {x. poly q x = (0::'a)})
[PROOF STEP]
by (rule card_insert_le_m1) auto
[PROOF STATE]
proof (state)
this:
card (insert x {x. poly q x = (0::'a)}) \<le> Suc (card {x. poly q x = (0::'a)})

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card (insert x {x. poly q x = (0::'a)}) \<le> Suc (card {x. poly q x = (0::'a)})

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
from deg
[PROOF STATE]
proof (chain)
picking this:
degree p = Suc (degree q)
[PROOF STEP]
have  "card {x. poly q x = 0} \<le> degree q"
[PROOF STATE]
proof (prove)
using this:
degree p = Suc (degree q)

goal (1 subgoal):
 1. card {x. poly q x = (0::'a)} \<le> degree q
[PROOF STEP]
using \<open>p \<noteq> 0\<close> and q
[PROOF STATE]
proof (prove)
using this:
degree p = Suc (degree q)
p \<noteq> 0
p = [:- x, 1::'a:] * q

goal (1 subgoal):
 1. card {x. poly q x = (0::'a)} \<le> degree q
[PROOF STEP]
by (intro less) auto
[PROOF STATE]
proof (state)
this:
card {x. poly q x = (0::'a)} \<le> degree q

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {x. poly q x = (0::'a)} \<le> degree q

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
have "Suc \<dots> = degree p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (degree q) = degree p
[PROOF STEP]
by (simp add: deg)
[PROOF STATE]
proof (state)
this:
Suc (degree q) = degree p

goal (1 subgoal):
 1. \<exists>x. poly p x = (0::'a) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<And>x y. x \<le> y \<Longrightarrow> Suc x \<le> Suc y) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x y. x \<le> y \<Longrightarrow> Suc x \<le> Suc y) \<Longrightarrow> card {x. poly p x = (0::'a)} \<le> degree p

goal (1 subgoal):
 1. card {x. poly p x = (0::'a)} \<le> degree p
[PROOF STEP]
by - simp_all
[PROOF STATE]
proof (state)
this:
card {x. poly p x = (0::'a)} \<le> degree p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {x. poly p x = (0::'a)} \<le> degree p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma f_Streams_Connected_nth_conv_if: "
  f_Streams_Connected outS inS =
  (length inS = Suc (length outS) \<and>
  (\<forall>i<length inS. inS ! i = (if i = 0 then \<NoMsg> else outS ! (i - Suc 0))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f_Streams_Connected outS inS = (length inS = Suc (length outS) \<and> (\<forall>i<length inS. inS ! i = (if i = 0 then NoMsg else outS ! (i - Suc 0))))
[PROOF STEP]
apply (subst f_Streams_Connected_nth_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length inS = Suc (length outS) \<and> (\<forall>i<length inS. inS ! i = (case i of 0 \<Rightarrow> NoMsg | Suc x \<Rightarrow> outS ! x))) = (length inS = Suc (length outS) \<and> (\<forall>i<length inS. inS ! i = (if i = 0 then NoMsg else outS ! (i - Suc 0))))
[PROOF STEP]
apply (rule conj_cong, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length inS = Suc (length outS) \<Longrightarrow> (\<forall>i<length inS. inS ! i = (case i of 0 \<Rightarrow> NoMsg | Suc x \<Rightarrow> outS ! x)) = (\<forall>i<length inS. inS ! i = (if i = 0 then NoMsg else outS ! (i - Suc 0)))
[PROOF STEP]
apply (rule all_imp_eqI, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. \<lbrakk>length inS = Suc (length outS); i < length inS\<rbrakk> \<Longrightarrow> (inS ! i = (case i of 0 \<Rightarrow> NoMsg | Suc x \<Rightarrow> outS ! x)) = (inS ! i = (if i = 0 then NoMsg else outS ! (i - Suc 0)))
[PROOF STEP]
apply (rename_tac i, case_tac i, simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done