[STATEMENT]
lemma subset_sorted_correct :
assumes l1_OK: "distinct l1 \<and> sorted l1"
assumes l2_OK: "distinct l2 \<and> sorted l2"
shows "subset_sorted l1 l2 \<longleftrightarrow> set l1 \<subseteq> set l2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_sorted l1 l2 = (set l1 \<subseteq> set l2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct l1 \<and> sorted l1
distinct l2 \<and> sorted l2

goal (1 subgoal):
 1. subset_sorted l1 l2 = (set l1 \<subseteq> set l2)
[PROOF STEP]
proof (induct l1 arbitrary: l2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>l2. \<lbrakk>distinct [] \<and> sorted []; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted [] l2 = (set [] \<subseteq> set l2)
 2. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
distinct [] \<and> sorted []
distinct l2 \<and> sorted l2

goal (2 subgoals):
 1. \<And>l2. \<lbrakk>distinct [] \<and> sorted []; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted [] l2 = (set [] \<subseteq> set l2)
 2. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
distinct [] \<and> sorted []
distinct l2 \<and> sorted l2

goal (1 subgoal):
 1. subset_sorted [] l2 = (set [] \<subseteq> set l2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subset_sorted [] l2 = (set [] \<subseteq> set l2)

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
case (Cons x1 l1 l2)
[PROOF STATE]
proof (state)
this:
\<lbrakk>distinct l1 \<and> sorted l1; distinct ?l2.0 \<and> sorted ?l2.0\<rbrakk> \<Longrightarrow> subset_sorted l1 ?l2.0 = (set l1 \<subseteq> set ?l2.0)
distinct (x1 # l1) \<and> sorted (x1 # l1)
distinct l2 \<and> sorted l2

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
note x1_l1_props = Cons(2)
[PROOF STATE]
proof (state)
this:
distinct (x1 # l1) \<and> sorted (x1 # l1)

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
note l2_props = Cons(3)
[PROOF STATE]
proof (state)
this:
distinct l2 \<and> sorted l2

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
from x1_l1_props
[PROOF STATE]
proof (chain)
picking this:
distinct (x1 # l1) \<and> sorted (x1 # l1)
[PROOF STEP]
have l1_props: "distinct l1 \<and> sorted l1"
                    and x1_nin_l1: "x1 \<notin> set l1"
                    and x1_le: "\<And>x. x \<in> set l1 \<Longrightarrow> x1 \<le> x"
[PROOF STATE]
proof (prove)
using this:
distinct (x1 # l1) \<and> sorted (x1 # l1)

goal (1 subgoal):
 1. distinct l1 \<and> sorted l1 &&& x1 \<notin> set l1 &&& (\<And>x. x \<in> set l1 \<Longrightarrow> x1 \<le> x)
[PROOF STEP]
by (simp_all add: Ball_def)
[PROOF STATE]
proof (state)
this:
distinct l1 \<and> sorted l1
x1 \<notin> set l1
?x \<in> set l1 \<Longrightarrow> x1 \<le> ?x

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
note ind_hyp_l1 = Cons(1)[OF l1_props]
[PROOF STATE]
proof (state)
this:
distinct ?l2.0 \<and> sorted ?l2.0 \<Longrightarrow> subset_sorted l1 ?l2.0 = (set l1 \<subseteq> set ?l2.0)

goal (1 subgoal):
 1. \<And>a l1 l2. \<lbrakk>\<And>l2. \<lbrakk>distinct l1 \<and> sorted l1; distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted l1 l2 = (set l1 \<subseteq> set l2); distinct (a # l1) \<and> sorted (a # l1); distinct l2 \<and> sorted l2\<rbrakk> \<Longrightarrow> subset_sorted (a # l1) l2 = (set (a # l1) \<subseteq> set l2)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2)
[PROOF STEP]
using l2_props
[PROOF STATE]
proof (prove)
using this:
distinct l2 \<and> sorted l2

goal (1 subgoal):
 1. subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2)
[PROOF STEP]
proof (induct l2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distinct [] \<and> sorted [] \<Longrightarrow> subset_sorted (x1 # l1) [] = (set (x1 # l1) \<subseteq> set [])
 2. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
distinct [] \<and> sorted []

goal (2 subgoals):
 1. distinct [] \<and> sorted [] \<Longrightarrow> subset_sorted (x1 # l1) [] = (set (x1 # l1) \<subseteq> set [])
 2. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
with x1_l1_props
[PROOF STATE]
proof (chain)
picking this:
distinct (x1 # l1) \<and> sorted (x1 # l1)
distinct [] \<and> sorted []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
distinct (x1 # l1) \<and> sorted (x1 # l1)
distinct [] \<and> sorted []

goal (1 subgoal):
 1. subset_sorted (x1 # l1) [] = (set (x1 # l1) \<subseteq> set [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) [] = (set (x1 # l1) \<subseteq> set [])

goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
case (Cons x2 l2)
[PROOF STATE]
proof (state)
this:
distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2)
distinct (x2 # l2) \<and> sorted (x2 # l2)

goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
note x2_l2_props = Cons(2)
[PROOF STATE]
proof (state)
this:
distinct (x2 # l2) \<and> sorted (x2 # l2)

goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
from x2_l2_props
[PROOF STATE]
proof (chain)
picking this:
distinct (x2 # l2) \<and> sorted (x2 # l2)
[PROOF STEP]
have l2_props: "distinct l2 \<and> sorted l2"
                    and x2_nin_l2: "x2 \<notin> set l2"
                    and x2_le: "\<And>x. x \<in> set l2 \<Longrightarrow> x2 \<le> x"
[PROOF STATE]
proof (prove)
using this:
distinct (x2 # l2) \<and> sorted (x2 # l2)

goal (1 subgoal):
 1. distinct l2 \<and> sorted l2 &&& x2 \<notin> set l2 &&& (\<And>x. x \<in> set l2 \<Longrightarrow> x2 \<le> x)
[PROOF STEP]
by (simp_all add: Ball_def)
[PROOF STATE]
proof (state)
this:
distinct l2 \<and> sorted l2
x2 \<notin> set l2
?x \<in> set l2 \<Longrightarrow> x2 \<le> ?x

goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
note ind_hyp_l2 = Cons(1)[OF l2_props]
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2)

goal (1 subgoal):
 1. \<And>a l2. \<lbrakk>distinct l2 \<and> sorted l2 \<Longrightarrow> subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2); distinct (a # l2) \<and> sorted (a # l2)\<rbrakk> \<Longrightarrow> subset_sorted (x1 # l1) (a # l2) = (set (x1 # l1) \<subseteq> set (a # l2))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
proof (cases "x1 < x2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
 2. \<not> x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x1 < x2

goal (2 subgoals):
 1. x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
 2. \<not> x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
note x1_less_x2 = this
[PROOF STATE]
proof (state)
this:
x1 < x2

goal (2 subgoals):
 1. x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
 2. \<not> x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
from ind_hyp_l1[OF x2_l2_props] x1_less_x2 x1_nin_l1 x1_le x2_le
[PROOF STATE]
proof (chain)
picking this:
subset_sorted l1 (x2 # l2) = (set l1 \<subseteq> set (x2 # l2))
x1 < x2
x1 \<notin> set l1
?x \<in> set l1 \<Longrightarrow> x1 \<le> ?x
?x \<in> set l2 \<Longrightarrow> x2 \<le> ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subset_sorted l1 (x2 # l2) = (set l1 \<subseteq> set (x2 # l2))
x1 < x2
x1 \<notin> set l1
?x \<in> set l1 \<Longrightarrow> x1 \<le> ?x
?x \<in> set l2 \<Longrightarrow> x2 \<le> ?x

goal (1 subgoal):
 1. subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
apply (auto simp add: Ball_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x1 < x2; x1 \<notin> set l1; \<And>x. x \<in> set l1 \<Longrightarrow> x1 \<le> x; \<And>x. x \<in> set l2 \<Longrightarrow> x2 \<le> x; subset_sorted l1 (x2 # l2); set l1 \<subseteq> insert x2 (set l2); x1 \<in> set l2\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
apply (metis linorder_not_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))

goal (1 subgoal):
 1. \<not> x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x1 < x2

goal (1 subgoal):
 1. \<not> x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
note x2_le_x1 = this
[PROOF STATE]
proof (state)
this:
\<not> x1 < x2

goal (1 subgoal):
 1. \<not> x1 < x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
proof (cases "x1 = x2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x1 = x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
 2. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x1 = x2

goal (2 subgoals):
 1. x1 = x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
 2. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
note x1_eq_x2 = this
[PROOF STATE]
proof (state)
this:
x1 = x2

goal (2 subgoals):
 1. x1 = x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
 2. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
from ind_hyp_l1[OF l2_props] x1_le x2_le x2_nin_l2 x1_eq_x2 x1_nin_l1
[PROOF STATE]
proof (chain)
picking this:
subset_sorted l1 l2 = (set l1 \<subseteq> set l2)
?x \<in> set l1 \<Longrightarrow> x1 \<le> ?x
?x \<in> set l2 \<Longrightarrow> x2 \<le> ?x
x2 \<notin> set l2
x1 = x2
x1 \<notin> set l1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subset_sorted l1 l2 = (set l1 \<subseteq> set l2)
?x \<in> set l1 \<Longrightarrow> x1 \<le> ?x
?x \<in> set l2 \<Longrightarrow> x2 \<le> ?x
x2 \<notin> set l2
x1 = x2
x1 \<notin> set l1

goal (1 subgoal):
 1. subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
apply (simp add: subset_iff x1_eq_x2 Ball_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subset_sorted l1 l2 = (\<forall>t. t \<in> set l1 \<longrightarrow> t \<in> set l2); \<And>x. x \<in> set l1 \<Longrightarrow> x2 \<le> x; \<And>x. x \<in> set l2 \<Longrightarrow> x2 \<le> x; x2 \<notin> set l2; x2 \<notin> set l1\<rbrakk> \<Longrightarrow> (\<forall>t. t \<in> set l1 \<longrightarrow> t \<in> set l2) = (\<forall>t. t \<in> set l1 \<longrightarrow> t = x2 \<or> t \<in> set l2)
[PROOF STEP]
apply metis
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))

goal (1 subgoal):
 1. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x1 \<noteq> x2

goal (1 subgoal):
 1. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
note x1_neq_x2 = this
[PROOF STATE]
proof (state)
this:
x1 \<noteq> x2

goal (1 subgoal):
 1. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
with x2_le_x1
[PROOF STATE]
proof (chain)
picking this:
\<not> x1 < x2
x1 \<noteq> x2
[PROOF STEP]
have x2_less_x1 : "x2 < x1"
[PROOF STATE]
proof (prove)
using this:
\<not> x1 < x2
x1 \<noteq> x2

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

goal (1 subgoal):
 1. x1 \<noteq> x2 \<Longrightarrow> subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
from ind_hyp_l2 x2_le_x1 x1_neq_x2 x2_le x2_nin_l2 x1_le
[PROOF STATE]
proof (chain)
picking this:
subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2)
\<not> x1 < x2
x1 \<noteq> x2
?x \<in> set l2 \<Longrightarrow> x2 \<le> ?x
x2 \<notin> set l2
?x \<in> set l1 \<Longrightarrow> x1 \<le> ?x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2)
\<not> x1 < x2
x1 \<noteq> x2
?x \<in> set l2 \<Longrightarrow> x2 \<le> ?x
x2 \<notin> set l2
?x \<in> set l1 \<Longrightarrow> x1 \<le> ?x

goal (1 subgoal):
 1. subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))
[PROOF STEP]
apply (simp add: subset_iff x2_less_x1 Ball_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>subset_sorted (x1 # l1) l2 = (\<forall>t. (t = x1 \<longrightarrow> x1 \<in> set l2) \<and> (t \<in> set l1 \<longrightarrow> t \<in> set l2)); \<not> x1 < x2; x1 \<noteq> x2; \<And>x. x \<in> set l2 \<Longrightarrow> x2 \<le> x; x2 \<notin> set l2; \<And>x. x \<in> set l1 \<Longrightarrow> x1 \<le> x\<rbrakk> \<Longrightarrow> (\<forall>t. (t = x1 \<longrightarrow> x1 \<in> set l2) \<and> (t \<in> set l1 \<longrightarrow> t \<in> set l2)) = (\<forall>t. (t = x1 \<longrightarrow> x1 \<in> set l2) \<and> (t \<in> set l1 \<longrightarrow> t = x2 \<or> t \<in> set l2))
[PROOF STEP]
apply (metis linorder_not_le x2_less_x1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) (x2 # l2) = (set (x1 # l1) \<subseteq> set (x2 # l2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
subset_sorted (x1 # l1) l2 = (set (x1 # l1) \<subseteq> set l2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma row_transpose_is_col[simp]:   assumes wf: "mat nr nc m"
  and i: "i < nc"
  shows "row (transpose nr m) i = col m i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (Matrix_Legacy.transpose nr m) i = col m i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. row (Matrix_Legacy.transpose nr m) i = col m i
[PROOF STEP]
have len: "length (row (transpose nr m) i) = length (col m i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (row (Matrix_Legacy.transpose nr m) i) = length (col m i)
[PROOF STEP]
using transpose[OF wf]  wf i
[PROOF STATE]
proof (prove)
using this:
mat nc nr (Matrix_Legacy.transpose nr m)
mat nr nc m
i < nc

goal (1 subgoal):
 1. length (row (Matrix_Legacy.transpose nr m) i) = length (col m i)
[PROOF STEP]
unfolding row_def col_def mat_def
[PROOF STATE]
proof (prove)
using this:
length (Matrix_Legacy.transpose nr m) = nr \<and> Ball (set (Matrix_Legacy.transpose nr m)) (vec nc)
length m = nc \<and> Ball (set m) (vec nr)
i < nc

goal (1 subgoal):
 1. length (map (\<lambda>w. w ! i) (Matrix_Legacy.transpose nr m)) = length (m ! i)
[PROOF STEP]
by (auto simp: vec_def)
[PROOF STATE]
proof (state)
this:
length (row (Matrix_Legacy.transpose nr m) i) = length (col m i)

goal (1 subgoal):
 1. row (Matrix_Legacy.transpose nr m) i = col m i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (Matrix_Legacy.transpose nr m) i = col m i
[PROOF STEP]
proof (rule nth_equalityI[OF len])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. ia < length (row (Matrix_Legacy.transpose nr m) i) \<Longrightarrow> row (Matrix_Legacy.transpose nr m) i ! ia = col m i ! ia
[PROOF STEP]
fix j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>ia. ia < length (row (Matrix_Legacy.transpose nr m) i) \<Longrightarrow> row (Matrix_Legacy.transpose nr m) i ! ia = col m i ! ia
[PROOF STEP]
assume "j < length (row (transpose nr m) i)"
[PROOF STATE]
proof (state)
this:
j < length (row (Matrix_Legacy.transpose nr m) i)

goal (1 subgoal):
 1. \<And>ia. ia < length (row (Matrix_Legacy.transpose nr m) i) \<Longrightarrow> row (Matrix_Legacy.transpose nr m) i ! ia = col m i ! ia
[PROOF STEP]
hence j: "j < nr"
[PROOF STATE]
proof (prove)
using this:
j < length (row (Matrix_Legacy.transpose nr m) i)

goal (1 subgoal):
 1. j < nr
[PROOF STEP]
using transpose[OF wf] wf i
[PROOF STATE]
proof (prove)
using this:
j < length (row (Matrix_Legacy.transpose nr m) i)
mat nc nr (Matrix_Legacy.transpose nr m)
mat nr nc m
i < nc

goal (1 subgoal):
 1. j < nr
[PROOF STEP]
unfolding row_def col_def mat_def
[PROOF STATE]
proof (prove)
using this:
j < length (map (\<lambda>w. w ! i) (Matrix_Legacy.transpose nr m))
length (Matrix_Legacy.transpose nr m) = nr \<and> Ball (set (Matrix_Legacy.transpose nr m)) (vec nc)
length m = nc \<and> Ball (set m) (vec nr)
i < nc

goal (1 subgoal):
 1. j < nr
[PROOF STEP]
by (auto simp: vec_def)
[PROOF STATE]
proof (state)
this:
j < nr

goal (1 subgoal):
 1. \<And>ia. ia < length (row (Matrix_Legacy.transpose nr m) i) \<Longrightarrow> row (Matrix_Legacy.transpose nr m) i ! ia = col m i ! ia
[PROOF STEP]
show "row (transpose nr m) i ! j = col m i ! j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row (Matrix_Legacy.transpose nr m) i ! j = col m i ! j
[PROOF STEP]
by (simp only: row_col[OF transpose[OF wf] i j],
        simp only: col_transpose_is_row[OF wf j],
        simp only: row_col[OF wf j i])
[PROOF STATE]
proof (state)
this:
row (Matrix_Legacy.transpose nr m) i ! j = col m i ! j

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
row (Matrix_Legacy.transpose nr m) i = col m i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_prime_eqI'':
  assumes "prime p" "\<pi> (real p) = real n + 1"
  shows   "nth_prime n = p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_prime n = p
[PROOF STEP]
proof (rule nth_prime_eqI')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. prime p
 2. card {q. prime q \<and> q \<le> p} = Suc n
[PROOF STEP]
have "real (card {q. prime q \<and> q \<le> p}) = \<pi> (real p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (card {q. prime q \<and> q \<le> p}) = \<pi> (real p)
[PROOF STEP]
by (simp add: \<pi>_def prime_sum_upto_def)
[PROOF STATE]
proof (state)
this:
real (card {q. prime q \<and> q \<le> p}) = \<pi> (real p)

goal (2 subgoals):
 1. prime p
 2. card {q. prime q \<and> q \<le> p} = Suc n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
real (card {q. prime q \<and> q \<le> p}) = \<pi> (real p)

goal (2 subgoals):
 1. prime p
 2. card {q. prime q \<and> q \<le> p} = Suc n
[PROOF STEP]
have "\<dots> = real (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> (real p) = real (Suc n)
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
\<pi> (real p) = real (Suc n)

goal (2 subgoals):
 1. prime p
 2. card {q. prime q \<and> q \<le> p} = Suc n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
real (card {q. prime q \<and> q \<le> p}) = real (Suc n)
[PROOF STEP]
show "card {q. prime q \<and> q \<le> p} = Suc n"
[PROOF STATE]
proof (prove)
using this:
real (card {q. prime q \<and> q \<le> p}) = real (Suc n)

goal (1 subgoal):
 1. card {q. prime q \<and> q \<le> p} = Suc n
[PROOF STEP]
by (simp only: of_nat_eq_iff)
[PROOF STATE]
proof (state)
this:
card {q. prime q \<and> q \<le> p} = Suc n

goal (1 subgoal):
 1. prime p
[PROOF STEP]
qed fact+


[STATEMENT]
lemma move_matrix_row_mult: "move_matrix ((A::('a::semiring_0) matrix) * B) j 0 = (move_matrix A j 0) * B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. move_matrix (A * B) j 0 = move_matrix A j 0 * B
[PROOF STEP]
apply (subst Rep_matrix_inject[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Rep_matrix (move_matrix (A * B) j 0) = Rep_matrix (move_matrix A j 0 * B)
[PROOF STEP]
apply (rule ext)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. Rep_matrix (move_matrix (A * B) j 0) x xa = Rep_matrix (move_matrix A j 0 * B) x xa
[PROOF STEP]
apply (auto simp add: Rep_matrix_mult foldseq_zero)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xa. \<not> int x < j \<Longrightarrow> foldseq (+) (\<lambda>k. Rep_matrix A (nat (int x - j)) k * Rep_matrix B k xa) (max (ncols A) (nrows B)) = foldseq (+) (\<lambda>k. Rep_matrix A (nat (int x - j)) k * Rep_matrix B k xa) (max (ncols (move_matrix A j 0)) (nrows B))
[PROOF STEP]
apply (rule_tac foldseq_zerotail[symmetric])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x xa. \<not> int x < j \<Longrightarrow> (0::'a) + (0::'a) = (0::'a)
 2. \<And>x xa. \<not> int x < j \<Longrightarrow> \<forall>i\<ge>max (ncols (move_matrix A j 0)) (nrows B). Rep_matrix A (nat (int x - j)) i * Rep_matrix B i xa = (0::'a)
 3. \<And>x xa. \<not> int x < j \<Longrightarrow> max (ncols (move_matrix A j 0)) (nrows B) \<le> max (ncols A) (nrows B)
[PROOF STEP]
apply (auto simp add: nrows zero_imp_mult_zero max2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<not> int x < j \<Longrightarrow> ncols (move_matrix A j 0) \<le> max (ncols A) (nrows B)
[PROOF STEP]
apply (rule order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<not> int x < j \<Longrightarrow> ncols (move_matrix A j 0) \<le> ?y10 x
 2. \<And>x. \<not> int x < j \<Longrightarrow> ?y10 x \<le> max (ncols A) (nrows B)
[PROOF STEP]
apply (rule ncols_move_matrix_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<not> int x < j \<Longrightarrow> nat (int (ncols A) + 0) \<le> max (ncols A) (nrows B)
[PROOF STEP]
apply (simp add: max1)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma map_poly_homo_polyadd:
  "map_poly f (p1 +\<^sub>p p2) = map_poly f p1 +\<^sub>p map_poly f p2"
  if [simp]: "\<And>x y. f (x + y) = f x + f y" "\<And>x. f x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly f (p1 +\<^sub>p p2) = map_poly f p1 +\<^sub>p map_poly f p2
[PROOF STEP]
by (induction p1 p2 rule: polyadd.induct)
    (auto simp: zero_iffD[OF that(2)] Let_def map_poly_homo_polyadd_eq_zero_iff)


[STATEMENT]
lemma RSpan_single_nonzero : "m \<in> M \<Longrightarrow> m \<noteq> 0 \<Longrightarrow> RSpan [m] \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<in> M; m \<noteq> (0::'m)\<rbrakk> \<Longrightarrow> RSpan [m] \<noteq> 0
[PROOF STEP]
using RSpan_contains_spanset_single
[PROOF STATE]
proof (prove)
using this:
?m \<in> M \<Longrightarrow> ?m \<in> RSpan [?m]

goal (1 subgoal):
 1. \<lbrakk>m \<in> M; m \<noteq> (0::'m)\<rbrakk> \<Longrightarrow> RSpan [m] \<noteq> 0
[PROOF STEP]
by auto


[STATEMENT]
lemma lookup_unit_vec:
assumes "j<n"
shows "lookup (unit_vec n i) [j] = (if i=j then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (unit_vec n i) [j] = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lookup (unit_vec n i) [j] = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
have "[j] \<lhd> [n]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [j] \<lhd> [n]
[PROOF STEP]
by (simp add: assms valid_index.Cons valid_index.Nil)
[PROOF STATE]
proof (state)
this:
[j] \<lhd> [n]

goal (1 subgoal):
 1. lookup (unit_vec n i) [j] = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[j] \<lhd> [n]
[PROOF STEP]
have "lookup (unit_vec n i) [j] = (\<lambda>x. if x=[i] then 1 else 0) [j]"
[PROOF STATE]
proof (prove)
using this:
[j] \<lhd> [n]

goal (1 subgoal):
 1. lookup (unit_vec n i) [j] = (if [j] = [i] then 1::'b else (0::'b))
[PROOF STEP]
by (simp add: lookup_tensor_from_lookup unit_vec_def)
[PROOF STATE]
proof (state)
this:
lookup (unit_vec n i) [j] = (if [j] = [i] then 1::?'b1 else (0::?'b1))

goal (1 subgoal):
 1. lookup (unit_vec n i) [j] = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lookup (unit_vec n i) [j] = (if [j] = [i] then 1::?'b1 else (0::?'b1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lookup (unit_vec n i) [j] = (if [j] = [i] then 1::?'b1 else (0::?'b1))

goal (1 subgoal):
 1. lookup (unit_vec n i) [j] = (if i = j then 1::'a else (0::'a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lookup (unit_vec n i) [j] = (if i = j then 1::'a else (0::'a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma curry_le[simp]: "curry f \<le> curry g \<longleftrightarrow> f \<le> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (curry f \<le> curry g) = (f \<le> g)
[PROOF STEP]
unfolding le_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x xa. curry f x xa \<le> curry g x xa) = (\<forall>x. f x \<le> g x)
[PROOF STEP]
by force


[STATEMENT]
lemma seteq_qle_trans: "A =\<^sub>\<preceq> B \<Longrightarrow> B =\<^sub>\<preceq> C \<Longrightarrow> A =\<^sub>\<preceq> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A =\<^sub>\<preceq> B; B =\<^sub>\<preceq> C\<rbrakk> \<Longrightarrow> A =\<^sub>\<preceq> C
[PROOF STEP]
by (simp add: seteq_qle_def) (metis subseteq_qle_trans)


[STATEMENT]
lemma group_Int_image_ker:
  assumes f: "f \<in> hom G H" and g: "g \<in> hom H K" and "inj_on (g \<circ> f) (carrier G)" "group G" "group H" "group K"
  shows "(f ` carrier G) \<inter> (kernel H K g) = {\<one>\<^bsub>H\<^esub>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
have "(f ` carrier G) \<inter> (kernel H K g) \<subseteq> {\<one>\<^bsub>H\<^esub>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g \<subseteq> {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> hom G H
g \<in> hom H K
inj_on (g \<circ> f) (carrier G)
Group.group G
Group.group H
Group.group K

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g \<subseteq> {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
apply (clarsimp simp: kernel_def o_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. \<lbrakk>f \<in> hom G H; g \<in> hom H K; inj_on (\<lambda>x. g (f x)) (carrier G); Group.group G; Group.group H; Group.group K; xa \<in> carrier G; f xa \<in> carrier H; g (f xa) = \<one>\<^bsub>K\<^esub>\<rbrakk> \<Longrightarrow> f xa = \<one>\<^bsub>H\<^esub>
[PROOF STEP]
by (metis group.is_monoid hom_one inj_on_eq_iff monoid.one_closed)
[PROOF STATE]
proof (state)
this:
f ` carrier G \<inter> kernel H K g \<subseteq> {\<one>\<^bsub>H\<^esub>}

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f ` carrier G \<inter> kernel H K g \<subseteq> {\<one>\<^bsub>H\<^esub>}

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
have "one H \<in> f ` carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one>\<^bsub>H\<^esub> \<in> f ` carrier G
[PROOF STEP]
by (metis f \<open>group G\<close> \<open>group H\<close> group.is_monoid hom_one image_iff monoid.one_closed)
[PROOF STATE]
proof (state)
this:
\<one>\<^bsub>H\<^esub> \<in> f ` carrier G

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<one>\<^bsub>H\<^esub> \<in> f ` carrier G

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
have "one H \<in> kernel H K g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one>\<^bsub>H\<^esub> \<in> kernel H K g
[PROOF STEP]
apply (simp add: kernel_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<one>\<^bsub>H\<^esub> \<in> carrier H \<and> g \<one>\<^bsub>H\<^esub> = \<one>\<^bsub>K\<^esub>
[PROOF STEP]
using g group.is_monoid hom_one \<open>group H\<close> \<open>group K\<close>
[PROOF STATE]
proof (prove)
using this:
g \<in> hom H K
Group.group ?G \<Longrightarrow> Group.monoid ?G
\<lbrakk>?h \<in> hom ?G ?H; Group.group ?G; Group.group ?H\<rbrakk> \<Longrightarrow> ?h \<one>\<^bsub>?G\<^esub> = \<one>\<^bsub>?H\<^esub>
Group.group H
Group.group K

goal (1 subgoal):
 1. \<one>\<^bsub>H\<^esub> \<in> carrier H \<and> g \<one>\<^bsub>H\<^esub> = \<one>\<^bsub>K\<^esub>
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<one>\<^bsub>H\<^esub> \<in> kernel H K g

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f ` carrier G \<inter> kernel H K g \<subseteq> {\<one>\<^bsub>H\<^esub>}
\<one>\<^bsub>H\<^esub> \<in> f ` carrier G
\<one>\<^bsub>H\<^esub> \<in> kernel H K g
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f ` carrier G \<inter> kernel H K g \<subseteq> {\<one>\<^bsub>H\<^esub>}
\<one>\<^bsub>H\<^esub> \<in> f ` carrier G
\<one>\<^bsub>H\<^esub> \<in> kernel H K g

goal (1 subgoal):
 1. f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f ` carrier G \<inter> kernel H K g = {\<one>\<^bsub>H\<^esub>}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma finite_mult_not_eq_zero_rightI:
  fixes f :: "'b \<Rightarrow> 'a :: mult_zero"
  assumes "finite {a. f a \<noteq> 0}"
  shows "finite {a. f a * g a \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {a. f a * g a \<noteq> (0::'a)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. finite {a. f a * g a \<noteq> (0::'a)}
[PROOF STEP]
have "{a. f a * g a \<noteq> 0} \<subseteq> {a. f a \<noteq> 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a. f a * g a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{a. f a * g a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. finite {a. f a * g a \<noteq> (0::'a)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
{a. f a * g a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
{a. f a * g a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. finite {a. f a * g a \<noteq> (0::'a)}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
{a. f a * g a \<noteq> (0::'a)} \<subseteq> {a. f a \<noteq> (0::'a)}
finite {a. f a \<noteq> (0::'a)}

goal (1 subgoal):
 1. finite {a. f a * g a \<noteq> (0::'a)}
[PROOF STEP]
by (rule finite_subset)
[PROOF STATE]
proof (state)
this:
finite {a. f a * g a \<noteq> (0::'a)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma r2f_rtrancl_hom: "\<F> (rtrancl R) = kstar (\<F> R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<F> (R\<^sup>*) = kstar (\<F> R)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<F> (R\<^sup>*) = kstar (\<F> R)
[PROOF STEP]
have "\<F> (rtrancl R) = \<F> (\<Union>i. R ^^ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<F> (R\<^sup>*) = \<F> (\<mu> (range ((^^) R)))
[PROOF STEP]
by (simp add: full_SetCompr_eq rtrancl_is_UN_relpow)
[PROOF STATE]
proof (state)
this:
\<F> (R\<^sup>*) = \<F> (\<mu> (range ((^^) R)))

goal (1 subgoal):
 1. \<F> (R\<^sup>*) = kstar (\<F> R)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<F> (R\<^sup>*) = \<F> (\<mu> (range ((^^) R)))

goal (1 subgoal):
 1. \<F> (R\<^sup>*) = kstar (\<F> R)
[PROOF STEP]
have "... = (\<Squnion>i. kpower (\<F> R) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<F> (\<mu> (range ((^^) R))) = \<Squnion> range (kpower (\<F> R))
[PROOF STEP]
by (auto simp: r2f_Sup_pres_var r2f_pow)
[PROOF STATE]
proof (state)
this:
\<F> (\<mu> (range ((^^) R))) = \<Squnion> range (kpower (\<F> R))

goal (1 subgoal):
 1. \<F> (R\<^sup>*) = kstar (\<F> R)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<F> (R\<^sup>*) = \<Squnion> range (kpower (\<F> R))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<F> (R\<^sup>*) = \<Squnion> range (kpower (\<F> R))

goal (1 subgoal):
 1. \<F> (R\<^sup>*) = kstar (\<F> R)
[PROOF STEP]
by (simp add: kstar_def)
[PROOF STATE]
proof (state)
this:
\<F> (R\<^sup>*) = kstar (\<F> R)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dvd_imp_degree:
  \<open>degree x \<le> degree y\<close> if \<open>x dvd y\<close> \<open>x \<noteq> 0\<close> \<open>y \<noteq> 0\<close>
    for x y :: \<open>'a::{comm_semiring_1,semiring_no_zero_divisors} poly\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree x \<le> degree y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree x \<le> degree y
[PROOF STEP]
from \<open>x dvd y\<close>
[PROOF STATE]
proof (chain)
picking this:
x dvd y
[PROOF STEP]
obtain z where \<open>y = x * z\<close>
[PROOF STATE]
proof (prove)
using this:
x dvd y

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

goal (1 subgoal):
 1. degree x \<le> degree y
[PROOF STEP]
with \<open>x \<noteq> 0\<close> \<open>y \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> 0
y \<noteq> 0
y = x * z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0
y \<noteq> 0
y = x * z

goal (1 subgoal):
 1. degree x \<le> degree y
[PROOF STEP]
by (simp add: degree_mult_eq)
[PROOF STATE]
proof (state)
this:
degree x \<le> degree y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma smult_normalize_field_eq:
  fixes p::"'a::{field,semidom_divide_unit_factor} poly"
  shows "p = smult (lead_coeff p) (normalize p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p = smult (lead_coeff p) (normalize p)
[PROOF STEP]
proof (rule poly_eqI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. coeff p n = coeff (smult (lead_coeff p) (normalize p)) n
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. coeff p n = coeff (smult (lead_coeff p) (normalize p)) n
[PROOF STEP]
have "unit_factor (lead_coeff p) = lead_coeff p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unit_factor (lead_coeff p) = lead_coeff p
[PROOF STEP]
by (metis dvd_field_iff is_unit_unit_factor unit_factor_0)
[PROOF STATE]
proof (state)
this:
unit_factor (lead_coeff p) = lead_coeff p

goal (1 subgoal):
 1. \<And>n. coeff p n = coeff (smult (lead_coeff p) (normalize p)) n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
unit_factor (lead_coeff p) = lead_coeff p
[PROOF STEP]
show "coeff p n = coeff (smult (lead_coeff p) (normalize p)) n"
[PROOF STATE]
proof (prove)
using this:
unit_factor (lead_coeff p) = lead_coeff p

goal (1 subgoal):
 1. coeff p n = coeff (smult (lead_coeff p) (normalize p)) n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
coeff p n = coeff (smult (lead_coeff p) (normalize p)) n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nn_integral_ge_point:
  assumes "x \<in> A"
  shows "p x \<le> \<integral>\<^sup>+ x. p x \<partial>count_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> A
[PROOF STEP]
have "p x \<le> \<integral>\<^sup>+ x. p x \<partial>count_space {x}"
[PROOF STATE]
proof (prove)
using this:
x \<in> A

goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space {x}) p
[PROOF STEP]
by(auto simp add: nn_integral_count_space_finite max_def)
[PROOF STATE]
proof (state)
this:
p x \<le> integral\<^sup>N (count_space {x}) p

goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p x \<le> integral\<^sup>N (count_space {x}) p

goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (count_space {x}) p = \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> A

goal (1 subgoal):
 1. integral\<^sup>N (count_space {x}) p = \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A
[PROOF STEP]
by(auto simp add: nn_integral_count_space_indicator indicator_def intro!: nn_integral_cong)
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space {x}) p = \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A

goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
integral\<^sup>N (count_space {x}) p = \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A

goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
have "\<dots> \<le> \<integral>\<^sup>+ x. p x \<partial>count_space A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
by(rule nn_integral_mono)(simp add: indicator_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x'. p x' * indicator {x} x' \<partial>count_space A \<le> integral\<^sup>N (count_space A) p

goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p x \<le> integral\<^sup>N (count_space A) p

goal (1 subgoal):
 1. p x \<le> integral\<^sup>N (count_space A) p
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
p x \<le> integral\<^sup>N (count_space A) p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma PredicatePairFunctions2:
fixes
  P::"'a \<Rightarrow> 'b \<Rightarrow> 'c \<Rightarrow> 'd \<Rightarrow> bool"
assumes
  A1: "\<forall>x1 x2 . \<exists>y1 y2 . (P x1 x2 y1 y2)"
obtains f1 f2  where
  "\<forall>x1 x2 . \<exists>y1 y2 .
    (f1 x1 x2) = y1 \<and> (f2 x1 x2) = y2
    \<and> (P x1 x2 (f1 x1 x2) (f2 x1 x2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f1 f2. \<forall>x1 x2. \<exists>y1 y2. f1 x1 x2 = y1 \<and> f2 x1 x2 = y2 \<and> P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof (cases thesis, auto)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>f1 f2. \<forall>x1 x2. P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> False; \<not> thesis\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
assume ass: "\<And>f1 f2. \<forall>x1 x2. P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> False"
[PROOF STATE]
proof (state)
this:
\<forall>x1 x2. P x1 x2 (?f1.0 x1 x2) (?f2.0 x1 x2) \<Longrightarrow> False

goal (1 subgoal):
 1. \<lbrakk>\<And>f1 f2. \<forall>x1 x2. P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> False; \<not> thesis\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
obtain f where F: "\<forall>x1 x2. \<exists>y1 y2. f x1 x2 = (y1, y2) \<and> P x1 x2 (fst (f x1 x2)) (snd (f x1 x2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<forall>x1 x2. \<exists>y1 y2. f x1 x2 = (y1, y2) \<and> P x1 x2 (fst (f x1 x2)) (snd (f x1 x2)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using PredicatePairFunction[OF A1]
[PROOF STATE]
proof (prove)
using this:
\<exists>f. \<forall>x1 x2. \<exists>y1 y2. f x1 x2 = (y1, y2) \<and> P x1 x2 (fst (f x1 x2)) (snd (f x1 x2))

goal (1 subgoal):
 1. (\<And>f. \<forall>x1 x2. \<exists>y1 y2. f x1 x2 = (y1, y2) \<and> P x1 x2 (fst (f x1 x2)) (snd (f x1 x2)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>x1 x2. \<exists>y1 y2. f x1 x2 = (y1, y2) \<and> P x1 x2 (fst (f x1 x2)) (snd (f x1 x2))

goal (1 subgoal):
 1. \<lbrakk>\<And>f1 f2. \<forall>x1 x2. P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> False; \<not> thesis\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define f1 where "f1 x1 x2 = fst (f x1 x2)" for x1 x2
[PROOF STATE]
proof (state)
this:
f1 ?x1.0 ?x2.0 = fst (f ?x1.0 ?x2.0)

goal (1 subgoal):
 1. \<lbrakk>\<And>f1 f2. \<forall>x1 x2. P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> False; \<not> thesis\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
define f2 where "f2 x1 x2 = snd (f x1 x2)" for x1 x2
[PROOF STATE]
proof (state)
this:
f2 ?x1.0 ?x2.0 = snd (f ?x1.0 ?x2.0)

goal (1 subgoal):
 1. \<lbrakk>\<And>f1 f2. \<forall>x1 x2. P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> False; \<not> thesis\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
using ass[of f1 f2] F
[PROOF STATE]
proof (prove)
using this:
\<forall>x1 x2. P x1 x2 (f1 x1 x2) (f2 x1 x2) \<Longrightarrow> False
\<forall>x1 x2. \<exists>y1 y2. f x1 x2 = (y1, y2) \<and> P x1 x2 (fst (f x1 x2)) (snd (f x1 x2))

goal (1 subgoal):
 1. False
[PROOF STEP]
unfolding f1_def f2_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x1 x2. P x1 x2 (fst (f x1 x2)) (snd (f x1 x2)) \<Longrightarrow> False
\<forall>x1 x2. \<exists>y1 y2. f x1 x2 = (y1, y2) \<and> P x1 x2 (fst (f x1 x2)) (snd (f x1 x2))

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ind_in_set_inj:
  fixes a b :: nat and A :: "nat set"
  assumes "a \<in> A" "b \<in> A" "ind_in_set A a = ind_in_set A b"
  shows "a = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a = b
[PROOF STEP]
have "ind_in_set A a < ind_in_set A b" if "a < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ind_in_set A a < ind_in_set A b
[PROOF STEP]
by (rule ind_in_set_mono[OF assms(1) assms(2) that])
[PROOF STATE]
proof (state)
this:
a < b \<Longrightarrow> ind_in_set A a < ind_in_set A b

goal (1 subgoal):
 1. a = b
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a < b \<Longrightarrow> ind_in_set A a < ind_in_set A b

goal (1 subgoal):
 1. a = b
[PROOF STEP]
have "ind_in_set A b < ind_in_set A a" if "b < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ind_in_set A b < ind_in_set A a
[PROOF STEP]
by (rule ind_in_set_mono[OF assms(2) assms(1) that])
[PROOF STATE]
proof (state)
this:
b < a \<Longrightarrow> ind_in_set A b < ind_in_set A a

goal (1 subgoal):
 1. a = b
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a < b \<Longrightarrow> ind_in_set A a < ind_in_set A b
b < a \<Longrightarrow> ind_in_set A b < ind_in_set A a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a < b \<Longrightarrow> ind_in_set A a < ind_in_set A b
b < a \<Longrightarrow> ind_in_set A b < ind_in_set A a

goal (1 subgoal):
 1. a = b
[PROOF STEP]
using assms(3)
[PROOF STATE]
proof (prove)
using this:
a < b \<Longrightarrow> ind_in_set A a < ind_in_set A b
b < a \<Longrightarrow> ind_in_set A b < ind_in_set A a
ind_in_set A a = ind_in_set A b

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in group) compl_fam_cong:
  assumes "compl_fam (f \<circ> g) A" "inj_on g A"
  shows "compl_fam f (g ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compl_fam f (g ` A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compl_fam f (g ` A)
[PROOF STEP]
have "((f \<circ> g) ` (A - {i})) =  (f ` (g ` A - {g i}))" if "i \<in> A" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<circ> g) ` (A - {i}) = f ` (g ` A - {g i})
[PROOF STEP]
using assms that
[PROOF STATE]
proof (prove)
using this:
compl_fam (f \<circ> g) A
inj_on g A
i \<in> A

goal (1 subgoal):
 1. (f \<circ> g) ` (A - {i}) = f ` (g ` A - {g i})
[PROOF STEP]
unfolding inj_on_def comp_def
[PROOF STATE]
proof (prove)
using this:
compl_fam (\<lambda>x. f (g x)) A
\<forall>x\<in>A. \<forall>y\<in>A. g x = g y \<longrightarrow> x = y
i \<in> A

goal (1 subgoal):
 1. (\<lambda>x. f (g x)) ` (A - {i}) = f ` (g ` A - {g i})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
?i1 \<in> A \<Longrightarrow> (f \<circ> g) ` (A - {?i1}) = f ` (g ` A - {g ?i1})

goal (1 subgoal):
 1. compl_fam f (g ` A)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> A \<Longrightarrow> (f \<circ> g) ` (A - {?i1}) = f ` (g ` A - {g ?i1})

goal (1 subgoal):
 1. compl_fam f (g ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> A \<Longrightarrow> (f \<circ> g) ` (A - {?i1}) = f ` (g ` A - {g ?i1})
compl_fam (f \<circ> g) A
inj_on g A

goal (1 subgoal):
 1. compl_fam f (g ` A)
[PROOF STEP]
unfolding compl_fam_def IDirProds_def complementary_def
[PROOF STATE]
proof (prove)
using this:
?i1 \<in> A \<Longrightarrow> (f \<circ> g) ` (A - {?i1}) = f ` (g ` A - {g ?i1})
\<forall>i\<in>A. (f \<circ> g) i \<inter> generate G (\<Union> ((f \<circ> g) ` (A - {i}))) = {\<one>}
inj_on g A

goal (1 subgoal):
 1. \<forall>i\<in>g ` A. f i \<inter> generate G (\<Union> (f ` (g ` A - {i}))) = {\<one>}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
compl_fam f (g ` A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Polygamma_approx_2_complex:
  assumes "Re x > 0" "m > 0"
  shows   "Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
have "Polygamma_approx (Suc (Suc 0)) m x = deriv (Polygamma_approx (Suc 0) m) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = deriv (Polygamma_approx (Suc 0) m) x
[PROOF STEP]
by (simp add: Polygamma_approx_Suc)
[PROOF STATE]
proof (state)
this:
Polygamma_approx (Suc (Suc 0)) m x = deriv (Polygamma_approx (Suc 0) m) x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Polygamma_approx (Suc (Suc 0)) m x = deriv (Polygamma_approx (Suc 0) m) x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
have "\<dots> = deriv (\<lambda>x. ln x - 1 / (2*x) + stirling_sum (Suc 0) m x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (Polygamma_approx (Suc 0) m) x = deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x
[PROOF STEP]
using eventually_nhds_in_open[of "{s. Re s > 0}" x] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>open {s. 0 < Re s}; x \<in> {s. 0 < Re s}\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F y in nhds x. y \<in> {s. 0 < Re s}
0 < Re x
0 < m

goal (1 subgoal):
 1. deriv (Polygamma_approx (Suc 0) m) x = deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x
[PROOF STEP]
by (intro deriv_cong_ev)
       (auto simp: open_halfspace_Re_gt elim!: eventually_mono simp: Polygamma_approx_1_complex)
[PROOF STATE]
proof (state)
this:
deriv (Polygamma_approx (Suc 0) m) x = deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv (Polygamma_approx (Suc 0) m) x = deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
have "\<dots> = 1 / x + 1 / (2*x^2) + stirling_sum (Suc (Suc 0)) m x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x = 1 / x + 1 / (2 * x\<^sup>2) + stirling_sum (Suc (Suc 0)) m x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < Re x
0 < m

goal (1 subgoal):
 1. deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x = 1 / x + 1 / (2 * x\<^sup>2) + stirling_sum (Suc (Suc 0)) m x
[PROOF STEP]
by (intro DERIV_imp_deriv) (auto intro!: derivative_eq_intros
           elim!: nonpos_Reals_cases simp: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x = 1 / x + 1 / (2 * x\<^sup>2) + stirling_sum (Suc (Suc 0)) m x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deriv (\<lambda>x. Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x) x = 1 / x + 1 / (2 * x\<^sup>2) + stirling_sum (Suc (Suc 0)) m x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
have "\<dots> = stirling_sum' 1 m x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / x + 1 / (2 * x\<^sup>2) + stirling_sum (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
using stirling_sum_2_conv_stirling_sum'_1[of m x] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < m; x \<noteq> 0\<rbrakk> \<Longrightarrow> stirling_sum' 1 m x = 1 / x + 1 / (2 * x\<^sup>2) + stirling_sum 2 m x
0 < Re x
0 < m

goal (1 subgoal):
 1. 1 / x + 1 / (2 * x\<^sup>2) + stirling_sum (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
by (subst stirling_sum_2_conv_stirling_sum'_1) (auto simp: eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
1 / x + 1 / (2 * x\<^sup>2) + stirling_sum (Suc (Suc 0)) m x = stirling_sum' 1 m x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x

goal (1 subgoal):
 1. Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Polygamma_approx (Suc (Suc 0)) m x = stirling_sum' 1 m x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nat_power2_diff: "a \<ge> (b::nat) \<Longrightarrow> (a-b)^2 = a^2 + b^2 - 2*a*b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
assume a_ge_b: "a \<ge> b"
[PROOF STATE]
proof (state)
this:
b \<le> a

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
hence a2_ge_b2: "a^2 \<ge> b^2"
[PROOF STATE]
proof (prove)
using this:
b \<le> a

goal (1 subgoal):
 1. b\<^sup>2 \<le> a\<^sup>2
[PROOF STEP]
by (simp only: power_mono)
[PROOF STATE]
proof (state)
this:
b\<^sup>2 \<le> a\<^sup>2

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
from a_ge_b
[PROOF STATE]
proof (chain)
picking this:
b \<le> a
[PROOF STEP]
have ab_ge_b2: "a*b \<ge> b^2"
[PROOF STATE]
proof (prove)
using this:
b \<le> a

goal (1 subgoal):
 1. b\<^sup>2 \<le> a * b
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
b\<^sup>2 \<le> a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
have "b*(a-b) + (a-b)^2 = a*(a-b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b * (a - b) + (a - b)\<^sup>2 = a * (a - b)
[PROOF STEP]
by (simp add: power2_eq_square diff_mult_distrib)
[PROOF STATE]
proof (state)
this:
b * (a - b) + (a - b)\<^sup>2 = a * (a - b)

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
b * (a - b) + (a - b)\<^sup>2 = a * (a - b)

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
have "\<dots> = a*b + a^2 + (b^2 - b^2) - 2*a*b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * (a - b) = a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b
[PROOF STEP]
by (simp add: diff_mult_distrib2 power2_eq_square)
[PROOF STATE]
proof (state)
this:
a * (a - b) = a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * (a - b) = a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
with a2_ge_b2
[PROOF STATE]
proof (chain)
picking this:
b\<^sup>2 \<le> a\<^sup>2
a * (a - b) = a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b
[PROOF STEP]
have "\<dots> = a*b + (a^2 - b^2) + b^2 - 2*a*b"
[PROOF STATE]
proof (prove)
using this:
b\<^sup>2 \<le> a\<^sup>2
a * (a - b) = a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b

goal (1 subgoal):
 1. a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b = a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b
[PROOF STEP]
by (simp add: power2_eq_square)
[PROOF STATE]
proof (state)
this:
a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b = a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b = a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
with ab_ge_b2
[PROOF STATE]
proof (chain)
picking this:
b\<^sup>2 \<le> a * b
a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b = a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b
[PROOF STEP]
have "\<dots> = (a*b - b^2) + a^2 + b^2 - 2*a*b"
[PROOF STATE]
proof (prove)
using this:
b\<^sup>2 \<le> a * b
a * b + a\<^sup>2 + (b\<^sup>2 - b\<^sup>2) - 2 * a * b = a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b

goal (1 subgoal):
 1. a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b = a * b - b\<^sup>2 + a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b = a * b - b\<^sup>2 + a\<^sup>2 + b\<^sup>2 - 2 * a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a * b + (a\<^sup>2 - b\<^sup>2) + b\<^sup>2 - 2 * a * b = a * b - b\<^sup>2 + a\<^sup>2 + b\<^sup>2 - 2 * a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
have "\<dots> = b*(a-b) + a^2 + b^2 - 2*a*b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * b - b\<^sup>2 + a\<^sup>2 + b\<^sup>2 - 2 * a * b = b * (a - b) + a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
by (simp only: diff_mult_distrib2 power2_eq_square mult.commute)
[PROOF STATE]
proof (state)
this:
a * b - b\<^sup>2 + a\<^sup>2 + b\<^sup>2 - 2 * a * b = b * (a - b) + a\<^sup>2 + b\<^sup>2 - 2 * a * b

goal (1 subgoal):
 1. b \<le> a \<Longrightarrow> (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
b * (a - b) + (a - b)\<^sup>2 = b * (a - b) + a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
b * (a - b) + (a - b)\<^sup>2 = b * (a - b) + a\<^sup>2 + b\<^sup>2 - 2 * a * b

goal (1 subgoal):
 1. (a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b
[PROOF STEP]
by arith
[PROOF STATE]
proof (state)
this:
(a - b)\<^sup>2 = a\<^sup>2 + b\<^sup>2 - 2 * a * b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Zorns_po_lemma_nonempty:
  assumes po: "Partial_order r"
    and u: "\<And>C. \<lbrakk>C \<in> Chains r; C\<noteq>{}\<rbrakk> \<Longrightarrow> \<exists>u\<in>Field r. \<forall>a\<in>C. (a, u) \<in> r"
    and "r \<noteq> {}"
  shows "\<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m
[PROOF STEP]
from \<open>r \<noteq> {}\<close>
[PROOF STATE]
proof (chain)
picking this:
r \<noteq> {}
[PROOF STEP]
obtain x where "x \<in> Field r"
[PROOF STATE]
proof (prove)
using this:
r \<noteq> {}

goal (1 subgoal):
 1. (\<And>x. x \<in> Field r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using FieldI2
[PROOF STATE]
proof (prove)
using this:
r \<noteq> {}
(?i, ?j) \<in> ?R \<Longrightarrow> ?j \<in> Field ?R

goal (1 subgoal):
 1. (\<And>x. x \<in> Field r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
x \<in> Field r

goal (1 subgoal):
 1. \<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
Partial_order r
\<lbrakk>?C \<in> Chains r; ?C \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>u\<in>Field r. \<forall>a\<in>?C. (a, u) \<in> r
r \<noteq> {}
x \<in> Field r
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Partial_order r
\<lbrakk>?C \<in> Chains r; ?C \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>u\<in>Field r. \<forall>a\<in>?C. (a, u) \<in> r
r \<noteq> {}
x \<in> Field r

goal (1 subgoal):
 1. \<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m
[PROOF STEP]
using Zorns_po_lemma
[PROOF STATE]
proof (prove)
using this:
Partial_order r
\<lbrakk>?C \<in> Chains r; ?C \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>u\<in>Field r. \<forall>a\<in>?C. (a, u) \<in> r
r \<noteq> {}
x \<in> Field r
\<lbrakk>Partial_order ?r; \<And>C. C \<in> Chains ?r \<Longrightarrow> \<exists>u\<in>Field ?r. \<forall>a\<in>C. (a, u) \<in> ?r\<rbrakk> \<Longrightarrow> \<exists>m\<in>Field ?r. \<forall>a\<in>Field ?r. (m, a) \<in> ?r \<longrightarrow> a = m

goal (1 subgoal):
 1. \<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m
[PROOF STEP]
by (metis empty_iff)
[PROOF STATE]
proof (state)
this:
\<exists>m\<in>Field r. \<forall>a\<in>Field r. (m, a) \<in> r \<longrightarrow> a = m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma linord_of_list_antisym:
  assumes "distinct xs"
  shows "antisym (linord_of_list xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. antisym (linord_of_list xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. antisym (linord_of_list xs)
[PROOF STEP]
unfolding linord_of_list_def
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. antisym {(x, y). linord_of_listP x y xs}
[PROOF STEP]
by (induct xs) (auto intro!: antisymI dest: linord_of_listP_domain simp: antisymD)


[STATEMENT]
lemma coplanar_perm_11:
  assumes "Coplanar A B C D"
  shows "Coplanar B D C A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar B D C A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar B D C A
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar B D C A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar B D C A
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar B D C A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar B D C A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma coplanar_perm_4:
  assumes "Coplanar A B C D"
  shows "Coplanar A D B C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Coplanar A D B C
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Coplanar A D B C
[PROOF STEP]
obtain X where P1: "(Col A B X \<and> Col C D X) \<or> (Col A C X \<and> Col B D X) \<or> (Col A D X \<and> Col B C X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Coplanar_def assms
[PROOF STATE]
proof (prove)
using this:
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Coplanar A B C D

goal (1 subgoal):
 1. (\<And>X. Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar A D B C
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X

goal (1 subgoal):
 1. Coplanar A D B C
[PROOF STEP]
using Coplanar_def col_permutation_4
[PROOF STATE]
proof (prove)
using this:
Col A B X \<and> Col C D X \<or> Col A C X \<and> Col B D X \<or> Col A D X \<and> Col B C X
Coplanar ?A ?B ?C ?D \<equiv> \<exists>X. Col ?A ?B X \<and> Col ?C ?D X \<or> Col ?A ?C X \<and> Col ?B ?D X \<or> Col ?A ?D X \<and> Col ?B ?C X
Col ?A ?B ?C \<Longrightarrow> Col ?B ?A ?C

goal (1 subgoal):
 1. Coplanar A D B C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Coplanar A D B C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem post_th_0: "(computable A) = (total_recursive (chf A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. computable A = total_recursive (chf A)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. computable A \<Longrightarrow> total_recursive (chf A)
 2. total_recursive (chf A) \<Longrightarrow> computable A
[PROOF STEP]
assume "computable A"
[PROOF STATE]
proof (state)
this:
computable A

goal (2 subgoals):
 1. computable A \<Longrightarrow> total_recursive (chf A)
 2. total_recursive (chf A) \<Longrightarrow> computable A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
computable A
[PROOF STEP]
show "total_recursive (chf A)"
[PROOF STATE]
proof (prove)
using this:
computable A

goal (1 subgoal):
 1. total_recursive (chf A)
[PROOF STEP]
by (rule comp_impl_tot_rec)
[PROOF STATE]
proof (state)
this:
total_recursive (chf A)

goal (1 subgoal):
 1. total_recursive (chf A) \<Longrightarrow> computable A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. total_recursive (chf A) \<Longrightarrow> computable A
[PROOF STEP]
assume "total_recursive (chf A)"
[PROOF STATE]
proof (state)
this:
total_recursive (chf A)

goal (1 subgoal):
 1. total_recursive (chf A) \<Longrightarrow> computable A
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
total_recursive (chf A)
[PROOF STEP]
show "computable A"
[PROOF STATE]
proof (prove)
using this:
total_recursive (chf A)

goal (1 subgoal):
 1. computable A
[PROOF STEP]
by (rule tot_rec_impl_comp)
[PROOF STATE]
proof (state)
this:
computable A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem FL_equivalence_implies_bisimilarity: assumes "FL_logically_equivalent F P Q" shows "P \<sim>\<cdot>[F] Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P \<sim>\<cdot>[F] Q
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
FL_logically_equivalent F P Q

goal (1 subgoal):
 1. P \<sim>\<cdot>[F] Q
[PROOF STEP]
by (metis FL_bisimilar_def FL_equivalence_is_L_bisimulation)


[STATEMENT]
lemma inf_INF:
  "Y \<noteq> {} \<Longrightarrow> inf x (INF y\<in>Y . f y) = (INF y\<in>Y. inf x (f y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Y \<noteq> {} \<Longrightarrow> x \<sqinter> Inf (f ` Y) = (INF y\<in>Y. x \<sqinter> f y)
[PROOF STEP]
apply (subst inf_Inf)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. Y \<noteq> {} \<Longrightarrow> f ` Y \<noteq> {}
 2. Y \<noteq> {} \<Longrightarrow> Inf ((\<sqinter>) x ` f ` Y) = (INF y\<in>Y. x \<sqinter> f y)
[PROOF STEP]
by (simp_all add: image_image)


[STATEMENT]
lemma frees'_list_comb: "frees' (list_comb f xs) = concat (rev (map frees' xs)) @ frees' f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frees' (list_comb f xs) = concat (rev (map frees' xs)) @ frees' f
[PROOF STEP]
by (induction xs arbitrary: f) (auto simp: app_term_def)


[STATEMENT]
lemma Cons_less_Cons [simp]: "a # x < b # y \<longleftrightarrow> a < b \<or> a = b \<and> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a # x < b # y) = (a < b \<or> a = b \<and> x < y)
[PROOF STEP]
by (simp add: list_less_def)


[STATEMENT]
lemma ceiling_unique: "of_int z - 1 < x \<Longrightarrow> x \<le> of_int z \<Longrightarrow> \<lceil>x\<rceil> = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>of_int z - (1::'a) < x; x \<le> of_int z\<rbrakk> \<Longrightarrow> \<lceil>x\<rceil> = z
[PROOF STEP]
unfolding ceiling_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>of_int z - (1::'a) < x; x \<le> of_int z\<rbrakk> \<Longrightarrow> - \<lfloor>- x\<rfloor> = z
[PROOF STEP]
using floor_unique [of "- z" "- x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>of_int (- z) \<le> - x; - x < of_int (- z) + (1::'a)\<rbrakk> \<Longrightarrow> \<lfloor>- x\<rfloor> = - z

goal (1 subgoal):
 1. \<lbrakk>of_int z - (1::'a) < x; x \<le> of_int z\<rbrakk> \<Longrightarrow> - \<lfloor>- x\<rfloor> = z
[PROOF STEP]
by simp


[STATEMENT]
lemma ordertype_eq_0_iff [simp]: "\<lbrakk>small X; wf r\<rbrakk> \<Longrightarrow> ordertype X r = 0 \<longleftrightarrow> X = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>small X; wf r\<rbrakk> \<Longrightarrow> (ordertype X r = 0) = (X = {})
[PROOF STEP]
by (metis ordertype_def elts_of_set replacement image_is_empty zero_V_def)


[STATEMENT]
lemma ereal_mult_cancel_left:
  fixes a b c :: ereal
  shows "a * b = a * c \<longleftrightarrow> (\<bar>a\<bar> = \<infinity> \<and> 0 < b * c) \<or> a = 0 \<or> b = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * b = a * c) = (\<bar>a\<bar> = \<infinity> \<and> 0 < b * c \<or> a = 0 \<or> b = c)
[PROOF STEP]
by (cases rule: ereal3_cases[of a b c]) (simp_all add: zero_less_mult_iff)


[STATEMENT]
lemma pochhammer_of_int: "pochhammer (of_int x) n = of_int (pochhammer x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer (of_int x) n = of_int (pochhammer x n)
[PROOF STEP]
by (simp add: pochhammer_prod Factorial.pochhammer_prod)


[STATEMENT]
lemma span_image: "m2.span (f ` S) = f ` (m1.span S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m2.span (f ` S) = f ` m1.span S
[PROOF STEP]
proof (rule m2.span_unique)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. f ` S \<subseteq> f ` m1.span S
 2. m2.subspace (f ` m1.span S)
 3. \<And>T'. \<lbrakk>f ` S \<subseteq> T'; m2.subspace T'\<rbrakk> \<Longrightarrow> f ` m1.span S \<subseteq> T'
[PROOF STEP]
show "f ` S \<subseteq> f ` m1.span S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` S \<subseteq> f ` m1.span S
[PROOF STEP]
by (rule image_mono, rule m1.span_superset)
[PROOF STATE]
proof (state)
this:
f ` S \<subseteq> f ` m1.span S

goal (2 subgoals):
 1. m2.subspace (f ` m1.span S)
 2. \<And>T'. \<lbrakk>f ` S \<subseteq> T'; m2.subspace T'\<rbrakk> \<Longrightarrow> f ` m1.span S \<subseteq> T'
[PROOF STEP]
show "m2.subspace (f ` m1.span S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m2.subspace (f ` m1.span S)
[PROOF STEP]
using m1.subspace_span
[PROOF STATE]
proof (prove)
using this:
m1.subspace (m1.span ?S)

goal (1 subgoal):
 1. m2.subspace (f ` m1.span S)
[PROOF STEP]
by (rule subspace_image)
[PROOF STATE]
proof (state)
this:
m2.subspace (f ` m1.span S)

goal (1 subgoal):
 1. \<And>T'. \<lbrakk>f ` S \<subseteq> T'; m2.subspace T'\<rbrakk> \<Longrightarrow> f ` m1.span S \<subseteq> T'
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>T'. \<lbrakk>f ` S \<subseteq> T'; m2.subspace T'\<rbrakk> \<Longrightarrow> f ` m1.span S \<subseteq> T'
[PROOF STEP]
fix T
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>T'. \<lbrakk>f ` S \<subseteq> T'; m2.subspace T'\<rbrakk> \<Longrightarrow> f ` m1.span S \<subseteq> T'
[PROOF STEP]
assume "f ` S \<subseteq> T" and "m2.subspace T"
[PROOF STATE]
proof (state)
this:
f ` S \<subseteq> T
m2.subspace T

goal (1 subgoal):
 1. \<And>T'. \<lbrakk>f ` S \<subseteq> T'; m2.subspace T'\<rbrakk> \<Longrightarrow> f ` m1.span S \<subseteq> T'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ` S \<subseteq> T
m2.subspace T
[PROOF STEP]
show "f ` m1.span S \<subseteq> T"
[PROOF STATE]
proof (prove)
using this:
f ` S \<subseteq> T
m2.subspace T

goal (1 subgoal):
 1. f ` m1.span S \<subseteq> T
[PROOF STEP]
unfolding image_subset_iff_subset_vimage
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> f -` T
m2.subspace T

goal (1 subgoal):
 1. m1.span S \<subseteq> f -` T
[PROOF STEP]
by (metis subspace_vimage m1.span_minimal)
[PROOF STATE]
proof (state)
this:
f ` m1.span S \<subseteq> T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vdisjnt_vunion_right: "vdisjnt C (A \<union>\<^sub>\<circ> B) \<longleftrightarrow> vdisjnt C A \<and> vdisjnt C B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vdisjnt C (A \<union>\<^sub>\<circ> B) = (vdisjnt C A \<and> vdisjnt C B)
[PROOF STEP]
by auto


[STATEMENT]
lemma InternalSets_Int: "X \<in> InternalSets \<Longrightarrow> Y \<in> InternalSets \<Longrightarrow> X \<inter> Y \<in> InternalSets"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<in> InternalSets; Y \<in> InternalSets\<rbrakk> \<Longrightarrow> X \<inter> Y \<in> InternalSets
[PROOF STEP]
by (auto simp add: InternalSets_def starset_n_Int [symmetric])


[STATEMENT]
lemma (in PO) monotone_dual:
     "monotone f (pset cl) (order cl)
     ==> monotone f (pset (dual cl)) (order(dual cl))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tarski.monotone f (pset cl) (order cl) \<Longrightarrow> Tarski.monotone f (pset (dual cl)) (order (dual cl))
[PROOF STEP]
by (simp add: monotone_def dualA_iff dualr_iff)


[STATEMENT]
lemma lift_add : "insertion (f::nat\<Rightarrow>real)  (liftPoly 0 z (a + b)) = insertion f (liftPoly 0 z a + liftPoly 0 z b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insertion f (liftPoly 0 z (a + b)) = insertion f (liftPoly 0 z a + liftPoly 0 z b)
[PROOF STEP]
using liftPoly_add[of 0 z a b]
[PROOF STATE]
proof (prove)
using this:
liftPoly 0 z (a + b) = liftPoly 0 z a + liftPoly 0 z b

goal (1 subgoal):
 1. insertion f (liftPoly 0 z (a + b)) = insertion f (liftPoly 0 z a + liftPoly 0 z b)
[PROOF STEP]
by simp


[STATEMENT]
lemma ex1_iff_Collect_singleton: "P x \<Longrightarrow> (\<exists>!x. P x) \<longleftrightarrow> Collect P = {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x \<Longrightarrow> (\<exists>!x. P x) = (Collect P = {x})
[PROOF STEP]
by (subst ex1_imp_Collect_singleton[symmetric], auto)


[STATEMENT]
lemma const_map_equality:
  "(const_map v S = const_map v' S') = (S = S' \<and> (S = {} \<or> v = v'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (const_map v S = const_map v' S') = (S = S' \<and> (S = {} \<or> v = v'))
[PROOF STEP]
apply(simp add: const_map_def restrict_map_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> S then Some v else None) = (\<lambda>x. if x \<in> S' then Some v' else None)) = (S = S' \<and> (S = {} \<or> v = v'))
[PROOF STEP]
by (metis equals0D option.distinct(2) option.inject subsetI subset_antisym)


[STATEMENT]
lemma nonneg_le_mult_right_mono_zhmset:
  fixes x y z :: zhmultiset
  assumes x: "0 \<le> x" and y: "0 < y" and z: "x \<le> z"
  shows "x \<le> y * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y * z
[PROOF STEP]
using x zero_less_iff_1_le_zhmset[THEN iffD1, OF y] z
[PROOF STATE]
proof (prove)
using this:
0 \<le> x
1 \<le> y
x \<le> z

goal (1 subgoal):
 1. x \<le> y * z
[PROOF STEP]
by (meson dual_order.trans leD mult_less_cancel_right2 not_le_imp_less)


[STATEMENT]
lemma (in is_functor) cf_umap_of_is_arr:
  assumes "category \<alpha> \<AA>"
    and "category \<alpha> \<BB>"
    and "r \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and "d \<in>\<^sub>\<circ> \<AA>\<lparr>Obj\<rparr>"
    and "u : c \<mapsto>\<^bsub>\<BB>\<^esub> \<FF>\<lparr>ObjMap\<rparr>\<lparr>r\<rparr>"
  shows "umap_of \<FF> c r u d : Hom \<AA> r d \<mapsto>\<^bsub>cat_Set \<alpha>\<^esub> Hom \<BB> c (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. umap_of \<FF> c r u d : Hom \<AA> r d \<mapsto>\<^bsub>cat_Set \<alpha>\<^esub> Hom \<BB> c (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>)
[PROOF STEP]
proof(intro cat_Set_is_arrI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. arr_Set \<alpha> (umap_of \<FF> c r u d)
 2. umap_of \<FF> c r u d\<lparr>ArrDom\<rparr> = Hom \<AA> r d
 3. umap_of \<FF> c r u d\<lparr>ArrCod\<rparr> = Hom \<BB> c (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>)
[PROOF STEP]
show "arr_Set \<alpha> (umap_of \<FF> c r u d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. arr_Set \<alpha> (umap_of \<FF> c r u d)
[PROOF STEP]
by (rule cf_arr_Set_umap_of[OF assms])
[PROOF STATE]
proof (state)
this:
arr_Set \<alpha> (umap_of \<FF> c r u d)

goal (2 subgoals):
 1. umap_of \<FF> c r u d\<lparr>ArrDom\<rparr> = Hom \<AA> r d
 2. umap_of \<FF> c r u d\<lparr>ArrCod\<rparr> = Hom \<BB> c (\<FF>\<lparr>ObjMap\<rparr>\<lparr>d\<rparr>)
[PROOF STEP]
qed (simp_all add: umap_of_components[OF assms(5)])


[STATEMENT]
lemma wellformed_alt_snd:  "{x, y} \<in> E \<Longrightarrow> y \<in> V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x, y} \<in> E \<Longrightarrow> y \<in> V
[PROOF STEP]
using wellformed
[PROOF STATE]
proof (prove)
using this:
?e \<in> E \<Longrightarrow> ?e \<subseteq> V

goal (1 subgoal):
 1. {x, y} \<in> E \<Longrightarrow> y \<in> V
[PROOF STEP]
by auto


[STATEMENT]
lemma Vinv1_finite_vote_set:
   "s \<in> Vinv1 \<Longrightarrow> finite (vote_set (votes s) Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s \<in> Vinv1 \<Longrightarrow> finite (vote_set (votes s) Q)
[PROOF STEP]
apply(drule Vinv1_finite_map_graph)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (map_graph (\<lambda>(x, y). votes s x y)) \<Longrightarrow> finite (vote_set (votes s) Q)
[PROOF STEP]
apply(clarsimp simp add: map_graph_def fun_graph_def vote_set_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {((a, b), y) |a b y. Some y = votes s a b} \<Longrightarrow> finite {uu_. \<exists>a r v. uu_ = (r, v) \<and> Some v = votes s r a \<and> a \<in> Q}
[PROOF STEP]
apply(erule finite_surj[where f="\<lambda>((r, a), v). (r, v)"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {uu_. \<exists>a r v. uu_ = (r, v) \<and> Some v = votes s r a \<and> a \<in> Q} \<subseteq> (\<lambda>((r, a), v). (r, v)) ` {((a, b), y) |a b y. Some y = votes s a b}
[PROOF STEP]
by(force simp add: image_def)


[STATEMENT]
lemma frontier_convex_hull_cases:
  fixes S :: "'a::euclidean_space set"
  assumes "\<not> affine_dependent S"
  shows "frontier(convex hull S) =
           (if card S \<le> DIM ('a) then convex hull S else \<Union>{convex hull (S - {x}) |x. x \<in> S})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier (convex hull S) = (if card S \<le> DIM('a) then convex hull S else \<Union> {convex hull (S - {x}) |x. x \<in> S})
[PROOF STEP]
by (simp add: assms frontier_convex_hull_eq_rel_frontier rel_frontier_convex_hull_cases)


[STATEMENT]
lemma dim_poly_of_append_vec:
  "dim_poly (vec_to_lpoly (a@\<^sub>vb)) \<le> dim_vec a + dim_vec b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_poly (vec_to_lpoly (a @\<^sub>v b)) \<le> dim_vec a + dim_vec b
[PROOF STEP]
using vec_to_poly_dim_less[of "a@\<^sub>vb"] index_append_vec(2)[of a b]
[PROOF STATE]
proof (prove)
using this:
dim_poly (vec_to_lpoly (a @\<^sub>v b)) \<le> dim_vec (a @\<^sub>v b)
dim_vec (a @\<^sub>v b) = dim_vec a + dim_vec b

goal (1 subgoal):
 1. dim_poly (vec_to_lpoly (a @\<^sub>v b)) \<le> dim_vec a + dim_vec b
[PROOF STEP]
by auto


[STATEMENT]
lemma extending_UN:
     "[| !!i. i \<in> I ==> extending C h F (Y' i) (Y i) |]
      ==> extending C h F (\<Union>i \<in> I. Y' i) (\<Union>i \<in> I. Y i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> extending C h F (Y' i) (Y i)) \<Longrightarrow> extending C h F (\<Union> (Y' ` I)) (\<Union> (Y ` I))
[PROOF STEP]
by (unfold extending_def, blast)


[STATEMENT]
lemma monic_prod_mset:
  fixes as :: "'a :: idom poly multiset"
  assumes "\<And> a. a \<in> set_mset as \<Longrightarrow> monic a"
  shows "monic (prod_mset as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monic (\<Prod>\<^sub># as)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?a \<in># as \<Longrightarrow> monic ?a

goal (1 subgoal):
 1. monic (\<Prod>\<^sub># as)
[PROOF STEP]
by (induct as, auto intro: monic_mult)


[STATEMENT]
lemma closed_contains_Inf:
  fixes S :: "real set"
  shows "S \<noteq> {} \<Longrightarrow> bdd_below S \<Longrightarrow> closed S \<Longrightarrow> Inf S \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S \<noteq> {}; bdd_below S; closed S\<rbrakk> \<Longrightarrow> Inf S \<in> S
[PROOF STEP]
by (metis closure_contains_Inf closure_closed)


[STATEMENT]
lemma mset_le_subtract_add_mset_right: "add_mset x B \<subseteq># (X::'a multiset) \<Longrightarrow> {#x#} \<subseteq># X-B \<and> B\<subseteq>#X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset x B \<subseteq># X \<Longrightarrow> {#x#} \<subseteq># X - B \<and> B \<subseteq># X
[PROOF STEP]
by (auto dest: mset_le_subtract[of "add_mset x B" "X" "B"] mset_le_add_mset)


[STATEMENT]
theorem fold_steps_correct:
  assumes "effect (foldM (doProofStep2 a) steps rcs) h h' res"
  assumes "correctArray rcs a h"
  shows "correctArray res a h'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. correctArray res a h'
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
effect (foldM (doProofStep2 a) steps rcs) h h' res
correctArray rcs a h

goal (1 subgoal):
 1. correctArray res a h'
[PROOF STEP]
by (induct steps arbitrary: rcs h h' res)
 (auto elim!: effect_bindE effect_returnE dest:step_correct2)


[STATEMENT]
lemma row_elems_subset_mat: "i < dim_row N \<Longrightarrow> vec_set (row N i) \<subseteq> elements_mat N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < dim_row N \<Longrightarrow> set\<^sub>v (row N i) \<subseteq> elements_mat N
[PROOF STEP]
by (auto simp add: vec_set_def elements_matI)


[STATEMENT]
lemma elems_mat_setv_col_0m: "j < dim_col M \<Longrightarrow> elements_mat M \<subseteq> {0..<m} \<Longrightarrow> set\<^sub>v (col M j) \<subseteq> {0..<m}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < dim_col M; elements_mat M \<subseteq> {0..<m}\<rbrakk> \<Longrightarrow> set\<^sub>v (col M j) \<subseteq> {0..<m}
[PROOF STEP]
by (metis col_elems_subset_mat subset_trans)


[STATEMENT]
lemma inext_nth_iNext_Suc: "(\<circle> t (I \<rightarrow> n) I. P t) = P (I \<rightarrow> Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. iNext (I \<rightarrow> n) I P = P (I \<rightarrow> Suc n)
[PROOF STEP]
by (simp add: iNext_def)


[STATEMENT]
lemma Clopen_Fzero: "\<forall>A. Cl A \<and> Op A \<longleftrightarrow> \<F> A \<^bold>\<approx> \<^bold>\<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>A. ((\<forall>w. \<C> A w = A w) \<and> (\<forall>w. \<I> A w = A w)) = (\<forall>w. \<F> A w = \<^bold>\<bottom> w)
[PROOF STEP]
using Cl_fr_def Int_fr_def
[PROOF STATE]
proof (prove)
using this:
\<C>\<^sub>F ?\<F> \<equiv> \<lambda>A. A \<^bold>\<or> ?\<F> A
\<I>\<^sub>F ?\<F> \<equiv> \<lambda>A. A \<^bold>\<leftharpoonup> ?\<F> A

goal (1 subgoal):
 1. \<forall>A. ((\<forall>w. \<C> A w = A w) \<and> (\<forall>w. \<I> A w = A w)) = (\<forall>w. \<F> A w = \<^bold>\<bottom> w)
[PROOF STEP]
unfolding conn
[PROOF STATE]
proof (prove)
using this:
\<C>\<^sub>F ?\<F> \<equiv> \<lambda>A w. A w \<or> ?\<F> A w
\<I>\<^sub>F ?\<F> \<equiv> \<lambda>A w. A w \<and> \<not> ?\<F> A w

goal (1 subgoal):
 1. \<forall>A. ((\<forall>w. \<C> A w = A w) \<and> (\<forall>w. \<I> A w = A w)) = (\<forall>w. \<F> A w = False)
[PROOF STEP]
by auto


[STATEMENT]
lemma leibniz_rule_field_derivative_real:
  fixes f::"'a::{real_normed_field, banach} \<Rightarrow> real \<Rightarrow> 'a"
  assumes fx: "\<And>x t. x \<in> U \<Longrightarrow> t \<in> {a..b} \<Longrightarrow> ((\<lambda>x. f x t) has_field_derivative fx x t) (at x within U)"
  assumes integrable_f2: "\<And>x. x \<in> U \<Longrightarrow> (f x) integrable_on {a..b}"
  assumes cont_fx: "continuous_on (U \<times> {a..b}) (\<lambda>(x, t). fx x t)"
  assumes U: "x0 \<in> U" "convex U"
  shows "((\<lambda>x. integral {a..b} (f x)) has_field_derivative integral {a..b} (fx x0)) (at x0 within U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. integral {a..b} (f x)) has_field_derivative integral {a..b} (fx x0)) (at x0 within U)
[PROOF STEP]
using leibniz_rule_field_derivative[of U a b f fx x0] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x t. \<lbrakk>x \<in> U; t \<in> cbox a b\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x t) has_field_derivative fx x t) (at x within U); \<And>x. x \<in> U \<Longrightarrow> f x integrable_on cbox a b; continuous_on (U \<times> cbox a b) (\<lambda>(x, t). fx x t); x0 \<in> U; convex U\<rbrakk> \<Longrightarrow> ((\<lambda>x. integral (cbox a b) (f x)) has_field_derivative integral (cbox a b) (fx x0)) (at x0 within U)
\<lbrakk>?x \<in> U; ?t \<in> {a..b}\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x ?t) has_field_derivative fx ?x ?t) (at ?x within U)
?x \<in> U \<Longrightarrow> f ?x integrable_on {a..b}
continuous_on (U \<times> {a..b}) (\<lambda>(x, t). fx x t)
x0 \<in> U
convex U

goal (1 subgoal):
 1. ((\<lambda>x. integral {a..b} (f x)) has_field_derivative integral {a..b} (fx x0)) (at x0 within U)
[PROOF STEP]
by simp


[STATEMENT]
lemma iterate_add_diff_add_eq2:
  "i \<le> (j::nat) \<Longrightarrow> ((iterate_add i u + m) - (iterate_add j u + n)) = (m - (iterate_add (j-i) u + n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<le> j \<Longrightarrow> iterate_add i u + m - (iterate_add j u + n) = m - (iterate_add (j - i) u + n)
[PROOF STEP]
by (auto dest!: le_Suc_ex add_right_imp_eq simp: ab_semigroup_add_class.add_ac(1))


[STATEMENT]
lemma mem_cball [simp, metric_unfold]: "y \<in> cball x e \<longleftrightarrow> dist x y \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y \<in> cball x e) = (dist x y \<le> e)
[PROOF STEP]
by (simp add: cball_def)


[STATEMENT]
lemma singlPart_bij_betw[simp]:
"bij_betw (image f) (singlPart I) (singlPart J) = bij_betw f I J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((`) f) (singlPart I) (singlPart J) = bij_betw f I J
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inj_on ((`) f) (singlPart I) \<and> (`) f ` singlPart I = singlPart J) = (inj_on f I \<and> f ` I = J)
[PROOF STEP]
by auto


[STATEMENT]
lemma closest_point_lipschitz:
  assumes "convex S"
    and "closed S" "S \<noteq> {}"
  shows "dist (closest_point S x) (closest_point S y) \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist (closest_point S x) (closest_point S y) \<le> dist x y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist (closest_point S x) (closest_point S y) \<le> dist x y
[PROOF STEP]
have "inner (x - closest_point S x) (closest_point S y - closest_point S x) \<le> 0"
    and "inner (y - closest_point S y) (closest_point S x - closest_point S y) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x - closest_point S x) \<bullet> (closest_point S y - closest_point S x) \<le> 0 &&& (y - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> 0
[PROOF STEP]
by (simp_all add: assms closest_point_dot closest_point_in_set)
[PROOF STATE]
proof (state)
this:
(x - closest_point S x) \<bullet> (closest_point S y - closest_point S x) \<le> 0
(y - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> 0

goal (1 subgoal):
 1. dist (closest_point S x) (closest_point S y) \<le> dist x y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(x - closest_point S x) \<bullet> (closest_point S y - closest_point S x) \<le> 0
(y - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(x - closest_point S x) \<bullet> (closest_point S y - closest_point S x) \<le> 0
(y - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> 0

goal (1 subgoal):
 1. dist (closest_point S x) (closest_point S y) \<le> dist x y
[PROOF STEP]
unfolding dist_norm and norm_le
[PROOF STATE]
proof (prove)
using this:
(x - closest_point S x) \<bullet> (closest_point S y - closest_point S x) \<le> 0
(y - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> 0

goal (1 subgoal):
 1. (closest_point S x - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> (x - y) \<bullet> (x - y)
[PROOF STEP]
using inner_ge_zero[of "(x - closest_point S x) - (y - closest_point S y)"]
[PROOF STATE]
proof (prove)
using this:
(x - closest_point S x) \<bullet> (closest_point S y - closest_point S x) \<le> 0
(y - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> 0
0 \<le> (x - closest_point S x - (y - closest_point S y)) \<bullet> (x - closest_point S x - (y - closest_point S y))

goal (1 subgoal):
 1. (closest_point S x - closest_point S y) \<bullet> (closest_point S x - closest_point S y) \<le> (x - y) \<bullet> (x - y)
[PROOF STEP]
by (simp add: inner_add inner_diff inner_commute)
[PROOF STATE]
proof (state)
this:
dist (closest_point S x) (closest_point S y) \<le> dist x y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summable_iff_suminf_neq_top: "(\<And>n. f n \<ge> 0) \<Longrightarrow> \<not> summable f \<Longrightarrow> (\<Sum>i. ennreal (f i)) = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>n. 0 \<le> f n; \<not> summable f\<rbrakk> \<Longrightarrow> (\<Sum>i. ennreal (f i)) = top
[PROOF STEP]
by (metis summable_suminf_not_top)


[STATEMENT]
lemma mult_pCons_right [simp]: "p * pCons a q = smult a p + pCons 0 (p * q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * pCons a q = smult a p + pCons (0::'a) (p * q)
[PROOF STEP]
by (induct p) (simp_all add: mult_poly_0_left algebra_simps)