[STATEMENT]
lemma sorted_merge_wrt:
  assumes "transp rel" and "\<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x"
    and "sorted_wrt rel xs" and "sorted_wrt rel ys"
  shows "sorted_wrt rel (merge_wrt rel xs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
proof (induct rel xs ys rule: merge_wrt.induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>uu_ xs. \<lbrakk>transp uu_; \<And>x y. x \<noteq> y \<Longrightarrow> uu_ x y \<or> uu_ y x; sorted_wrt uu_ xs; sorted_wrt uu_ []\<rbrakk> \<Longrightarrow> sorted_wrt uu_ (merge_wrt uu_ xs [])
 2. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 3. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case (1 rel xs)
[PROOF STATE]
proof (state)
this:
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel []

goal (3 subgoals):
 1. \<And>uu_ xs. \<lbrakk>transp uu_; \<And>x y. x \<noteq> y \<Longrightarrow> uu_ x y \<or> uu_ y x; sorted_wrt uu_ xs; sorted_wrt uu_ []\<rbrakk> \<Longrightarrow> sorted_wrt uu_ (merge_wrt uu_ xs [])
 2. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 3. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
from 1(3)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel xs

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

goal (2 subgoals):
 1. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 2. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 2. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case (2 rel y ys)
[PROOF STATE]
proof (state)
this:
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel []
sorted_wrt rel (y # ys)

goal (2 subgoals):
 1. \<And>rel v va. \<lbrakk>transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel []; sorted_wrt rel (v # va)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel [] (v # va))
 2. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
from 2(4)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel [] (y # ys))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel [] (y # ys))

goal (1 subgoal):
 1. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case (3 rel x xs y ys)
[PROOF STATE]
proof (state)
this:
\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys)
\<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys))
\<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys)
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. \<And>rel x xs y ys. \<lbrakk>\<lbrakk>x = y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs ys); \<lbrakk>x \<noteq> y; rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel xs; sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel xs (y # ys)); \<lbrakk>x \<noteq> y; \<not> rel x y; transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel ys\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) ys); transp rel; \<And>x y. x \<noteq> y \<Longrightarrow> rel x y \<or> rel y x; sorted_wrt rel (x # xs); sorted_wrt rel (y # ys)\<rbrakk> \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (cases "x = y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = y

goal (2 subgoals):
 1. x = y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (auto simp add: True)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
assume "z \<in> set (merge_wrt rel xs ys)"
[PROOF STATE]
proof (state)
this:
z \<in> set (merge_wrt rel xs ys)

goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
hence "z \<in> set xs \<union> set ys"
[PROOF STATE]
proof (prove)
using this:
z \<in> set (merge_wrt rel xs ys)

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys
[PROOF STEP]
by (simp only: set_merge_wrt)
[PROOF STATE]
proof (state)
this:
z \<in> set xs \<union> set ys

goal (2 subgoals):
 1. \<And>x. x \<in> set (merge_wrt rel xs ys) \<Longrightarrow> rel y x
 2. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
thus "rel y z"
[PROOF STATE]
proof (prove)
using this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set xs"
[PROOF STATE]
proof (state)
this:
z \<in> set xs

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
z \<in> set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)
z \<in> set xs

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp add: True)
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set ys

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
z \<in> set ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)
z \<in> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel y z

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

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
note True 3(4, 5)
[PROOF STATE]
proof (state)
this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
from 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
[PROOF STEP]
have "sorted_wrt rel xs"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)

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

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sorted_wrt rel xs

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
from 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
[PROOF STEP]
have "sorted_wrt rel ys"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel ys
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel ys
[PROOF STEP]
show "sorted_wrt rel (merge_wrt rel xs ys)"
[PROOF STATE]
proof (prove)
using this:
x = y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs ys)
[PROOF STEP]
by (rule 3(1))
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel xs ys)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> y

goal (1 subgoal):
 1. x \<noteq> y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (cases "rel x y")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
rel x y

goal (2 subgoals):
 1. rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
 2. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (auto simp add: False True)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
assume "z \<in> set (merge_wrt rel xs (y # ys))"
[PROOF STATE]
proof (state)
this:
z \<in> set (merge_wrt rel xs (y # ys))

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
hence "z \<in> insert y (set xs \<union> set ys)"
[PROOF STATE]
proof (prove)
using this:
z \<in> set (merge_wrt rel xs (y # ys))

goal (1 subgoal):
 1. z \<in> insert y (set xs \<union> set ys)
[PROOF STEP]
by (simp add: set_merge_wrt)
[PROOF STATE]
proof (state)
this:
z \<in> insert y (set xs \<union> set ys)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel xs (y # ys)) \<Longrightarrow> rel x xa
 2. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
thus "rel x z"
[PROOF STATE]
proof (prove)
using this:
z \<in> insert y (set xs \<union> set ys)

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = y \<Longrightarrow> rel x z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z = y"
[PROOF STATE]
proof (state)
this:
z = y

goal (2 subgoals):
 1. z = y \<Longrightarrow> rel x z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
rel x y
z = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel x y
z = y

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

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z \<in> set xs \<union> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel x z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel x z
 2. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z \<in> set xs"
[PROOF STATE]
proof (state)
this:
z \<in> set xs

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel x z
 2. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
z \<in> set xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)
z \<in> set xs

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

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
assume "z \<in> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set ys

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
z \<in> set ys
[PROOF STEP]
have "rel y z"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)
z \<in> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel x z
[PROOF STEP]
with 3(4) True
[PROOF STATE]
proof (chain)
picking this:
transp rel
rel x y
rel y z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transp rel
rel x y
rel y z

goal (1 subgoal):
 1. rel x z
[PROOF STEP]
by (rule transpD)
[PROOF STATE]
proof (state)
this:
rel x z

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

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

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
note False True 3(4, 5)
[PROOF STATE]
proof (state)
this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
from 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
[PROOF STEP]
have "sorted_wrt rel xs"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)

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

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
[PROOF STEP]
show "sorted_wrt rel (merge_wrt rel xs (y # ys))"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
using 3(7)
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel xs
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel xs (y # ys))
[PROOF STEP]
by (rule 3(2))
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel xs (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
assume "\<not> rel x y"
[PROOF STATE]
proof (state)
this:
\<not> rel x y

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
from \<open>x \<noteq> y\<close>
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
[PROOF STEP]
have "rel x y \<or> rel y x"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y

goal (1 subgoal):
 1. rel x y \<or> rel y x
[PROOF STEP]
by (rule 3(5))
[PROOF STATE]
proof (state)
this:
rel x y \<or> rel y x

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
with \<open>\<not> rel x y\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> rel x y
rel x y \<or> rel y x
[PROOF STEP]
have *: "rel y x"
[PROOF STATE]
proof (prove)
using this:
\<not> rel x y
rel x y \<or> rel y x

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

goal (1 subgoal):
 1. \<not> rel x y \<Longrightarrow> sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))
[PROOF STEP]
proof (auto simp add: False \<open>\<not> rel x y\<close>)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
fix z
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
assume "z \<in> set (merge_wrt rel (x # xs) ys)"
[PROOF STATE]
proof (state)
this:
z \<in> set (merge_wrt rel (x # xs) ys)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
hence "z \<in> insert x (set xs \<union> set ys)"
[PROOF STATE]
proof (prove)
using this:
z \<in> set (merge_wrt rel (x # xs) ys)

goal (1 subgoal):
 1. z \<in> insert x (set xs \<union> set ys)
[PROOF STEP]
by (simp add: set_merge_wrt)
[PROOF STATE]
proof (state)
this:
z \<in> insert x (set xs \<union> set ys)

goal (2 subgoals):
 1. \<And>xa. xa \<in> set (merge_wrt rel (x # xs) ys) \<Longrightarrow> rel y xa
 2. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
thus "rel y z"
[PROOF STATE]
proof (prove)
using this:
z \<in> insert x (set xs \<union> set ys)

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z = x \<Longrightarrow> rel y z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z = x"
[PROOF STATE]
proof (state)
this:
z = x

goal (2 subgoals):
 1. z = x \<Longrightarrow> rel y z
 2. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with *
[PROOF STATE]
proof (chain)
picking this:
rel y x
z = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rel y x
z = x

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set xs \<union> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. z \<in> set xs \<union> set ys \<Longrightarrow> rel y z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
z \<in> set xs \<union> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set xs"
[PROOF STATE]
proof (state)
this:
z \<in> set xs

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(6)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (x # xs)
z \<in> set xs
[PROOF STEP]
have "rel x z"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (x # xs)
z \<in> set xs

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

goal (2 subgoals):
 1. z \<in> set xs \<Longrightarrow> rel y z
 2. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(4) *
[PROOF STATE]
proof (chain)
picking this:
transp rel
rel y x
rel x z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
transp rel
rel y x
rel x z

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (rule transpD)
[PROOF STATE]
proof (state)
this:
rel y z

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
assume "z \<in> set ys"
[PROOF STATE]
proof (state)
this:
z \<in> set ys

goal (1 subgoal):
 1. z \<in> set ys \<Longrightarrow> rel y z
[PROOF STEP]
with 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
z \<in> set ys
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)
z \<in> set ys

goal (1 subgoal):
 1. rel y z
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
rel y z

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

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

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
note False \<open>\<not> rel x y\<close> 3(4, 5, 6)
[PROOF STATE]
proof (state)
this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
from 3(7)
[PROOF STATE]
proof (chain)
picking this:
sorted_wrt rel (y # ys)
[PROOF STEP]
have "sorted_wrt rel ys"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt rel (y # ys)

goal (1 subgoal):
 1. sorted_wrt rel ys
[PROOF STEP]
by (simp)
[PROOF STATE]
proof (state)
this:
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)
sorted_wrt rel ys
[PROOF STEP]
show "sorted_wrt rel (merge_wrt rel (x # xs) ys)"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y
\<not> rel x y
transp rel
?x \<noteq> ?y \<Longrightarrow> rel ?x ?y \<or> rel ?y ?x
sorted_wrt rel (x # xs)
sorted_wrt rel ys

goal (1 subgoal):
 1. sorted_wrt rel (merge_wrt rel (x # xs) ys)
[PROOF STEP]
by (rule 3(3))
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) ys)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
sorted_wrt rel (merge_wrt rel (x # xs) (y # ys))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma croots: assumes "p \<noteq> 0" "degree p \<le> 2"
  shows "set (croots p) = {x. poly p x = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (croots p) = {x. poly p x = 0}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
degree p \<le> 2

goal (1 subgoal):
 1. set (croots p) = {x. poly p x = 0}
[PROOF STEP]
unfolding croots_def
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
degree p \<le> 2

goal (1 subgoal):
 1. set (if p = 0 \<or> 2 < degree p then [] else if degree p = 0 then [] else if degree p = 1 then [roots1 p] else croots2 p) = {x. poly p x = 0}
[PROOF STEP]
using roots0[of p] roots1[of p] croots2[of p]
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
degree p \<le> 2
\<lbrakk>p \<noteq> 0; degree p = 0\<rbrakk> \<Longrightarrow> {x. poly p x = 0} = {}
degree p = 1 \<Longrightarrow> {x. poly p x = 0} = {roots1 p}
degree p = 2 \<Longrightarrow> {x. poly p x = 0} = set (croots2 p)

goal (1 subgoal):
 1. set (if p = 0 \<or> 2 < degree p then [] else if degree p = 0 then [] else if degree p = 1 then [roots1 p] else croots2 p) = {x. poly p x = 0}
[PROOF STEP]
by (auto split: if_splits)


[STATEMENT]
lemma chinese_remainder:
  fixes a::nat  assumes ab: "coprime a b" and a: "a \<noteq> 0" and b: "b \<noteq> 0"
  shows "\<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
from bezout_add_strong_nat[OF a, of b] bezout_add_strong_nat[OF b, of a]
[PROOF STATE]
proof (chain)
picking this:
\<exists>d x y. d dvd a \<and> d dvd b \<and> a * x = b * y + d
\<exists>d x y. d dvd b \<and> d dvd a \<and> b * x = a * y + d
[PROOF STEP]
obtain d1 x1 y1 d2 x2 y2 where dxy1: "d1 dvd a" "d1 dvd b" "a * x1 = b * y1 + d1"
    and dxy2: "d2 dvd b" "d2 dvd a" "b * x2 = a * y2 + d2"
[PROOF STATE]
proof (prove)
using this:
\<exists>d x y. d dvd a \<and> d dvd b \<and> a * x = b * y + d
\<exists>d x y. d dvd b \<and> d dvd a \<and> b * x = a * y + d

goal (1 subgoal):
 1. (\<And>d1 x1 y1 d2 x2 y2. \<lbrakk>d1 dvd a; d1 dvd b; a * x1 = b * y1 + d1; d2 dvd b; d2 dvd a; b * x2 = a * y2 + d2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
d1 dvd a
d1 dvd b
a * x1 = b * y1 + d1
d2 dvd b
d2 dvd a
b * x2 = a * y2 + d2

goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
d1 dvd a
d1 dvd b
a * x1 = b * y1 + d1
d2 dvd b
d2 dvd a
b * x2 = a * y2 + d2
[PROOF STEP]
have d12: "d1 = 1" "d2 = 1"
[PROOF STATE]
proof (prove)
using this:
d1 dvd a
d1 dvd b
a * x1 = b * y1 + d1
d2 dvd b
d2 dvd a
b * x2 = a * y2 + d2

goal (1 subgoal):
 1. d1 = 1 &&& d2 = 1
[PROOF STEP]
using ab coprime_common_divisor_nat [of a b]
[PROOF STATE]
proof (prove)
using this:
d1 dvd a
d1 dvd b
a * x1 = b * y1 + d1
d2 dvd b
d2 dvd a
b * x2 = a * y2 + d2
coprime a b
\<lbrakk>coprime a b; ?x dvd a; ?x dvd b\<rbrakk> \<Longrightarrow> ?x = 1

goal (1 subgoal):
 1. d1 = 1 &&& d2 = 1
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
d1 = 1
d2 = 1

goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
let ?x = "v * a * x1 + u * b * x2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
let ?q1 = "v * x1 + u * y2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
let ?q2 = "v * y1 + u * x2"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
from dxy2(3)[simplified d12] dxy1(3)[simplified d12]
[PROOF STATE]
proof (chain)
picking this:
b * x2 = a * y2 + 1
a * x1 = b * y1 + 1
[PROOF STEP]
have "?x = u + ?q1 * a" "?x = v + ?q2 * b"
[PROOF STATE]
proof (prove)
using this:
b * x2 = a * y2 + 1
a * x1 = b * y1 + 1

goal (1 subgoal):
 1. v * a * x1 + u * b * x2 = u + (v * x1 + u * y2) * a &&& v * a * x1 + u * b * x2 = v + (v * y1 + u * x2) * b
[PROOF STEP]
by algebra+
[PROOF STATE]
proof (state)
this:
v * a * x1 + u * b * x2 = u + (v * x1 + u * y2) * a
v * a * x1 + u * b * x2 = v + (v * y1 + u * x2) * b

goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
v * a * x1 + u * b * x2 = u + (v * x1 + u * y2) * a
v * a * x1 + u * b * x2 = v + (v * y1 + u * x2) * b

goal (1 subgoal):
 1. \<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>x q1 q2. x = u + q1 * a \<and> x = v + q2 * b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in Group) isom2:"\<lbrakk>G \<triangleright> H; G \<triangleright> N; H \<subseteq> N\<rbrakk> \<Longrightarrow>
               ((G/H)/(carrier ((Gp G N)/H))) \<cong>  (G/N)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<triangleright> H; G \<triangleright> N; H \<subseteq> N\<rbrakk> \<Longrightarrow> (G / H / carrier (\<natural>N / H)) \<cong> (G / N)
[PROOF STEP]
apply (frule homom2 [of "H" "N"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<triangleright> H; G \<triangleright> N; H \<subseteq> N; gbij\<^bsub>(G / H / carrier (\<natural>N / H)),(G / N)\<^esub> (Qm\<^bsub>G H,N\<^esub>\<dieresis>\<^bsub>(G / H),(G / N)\<^esub>)\<rbrakk> \<Longrightarrow> (G / H / carrier (\<natural>N / H)) \<cong> (G / N)
[PROOF STEP]
apply (simp add:isomorphic_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>G \<triangleright> H; G \<triangleright> N; H \<subseteq> N; gbij\<^bsub>(G / H / carrier (\<natural>N / H)),(G / N)\<^esub> (Qm\<^bsub>G H,N\<^esub>\<dieresis>\<^bsub>(G / H),(G / N)\<^esub>)\<rbrakk> \<Longrightarrow> \<exists>f. gbij\<^bsub>(G / H / carrier (\<natural>N / H)),(G / N)\<^esub> f
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma count_list_append: "count_list (xs@ys) v = count_list xs v + count_list ys v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (xs @ ys) v = count_list xs v + count_list ys v
[PROOF STEP]
by (induction xs, simp, simp)


[STATEMENT]
lemma R_therm_dyn_up:
  assumes "a > 0" and "0 \<le> \<tau>" and "0 < Tmin" and "Tmax < L"
  shows "Ref \<lceil>\<lambda>s. s$4 \<noteq> 0 \<and> I Tmin Tmax s \<and> s$2 = 0 \<and> s$3 = s$1\<rceil> \<lceil>I Tmin Tmax\<rceil> \<ge>
    (x\<acute>= (\<lambda>t. f a L) & G Tmin Tmax a L on (\<lambda>s. {0..\<tau>}) UNIV @ 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<acute>= \<lambda>t. f a L & G Tmin Tmax a L on \<lambda>s. {0..\<tau>} UNIV @ 0 \<le> Ref \<lceil>\<lambda>s. s $ 4 \<noteq> 0 \<and> I Tmin Tmax s \<and> s $ 2 = 0 \<and> s $ 3 = s $ 1\<rceil> \<lceil>I Tmin Tmax\<rceil>
[PROOF STEP]
apply(rule local_flow.R_g_ode_ivl[OF local_flow_therm])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. 0 < a
 2. 0 \<le> \<tau>
 3. s2p UNIV \<tau>
 4. \<forall>s\<in>UNIV. s $ 4 \<noteq> 0 \<and> I Tmin Tmax s \<and> s $ 2 = 0 \<and> s $ 3 = s $ 1 \<longrightarrow> (\<forall>t\<in>{0..\<tau>}. (\<forall>\<tau>\<in>{0..t}. G Tmin Tmax a L (\<phi> a L \<tau> s)) \<longrightarrow> I Tmin Tmax (\<phi> a L t s))
[PROOF STEP]
using assms therm_dyn_up_real_arith[OF assms(1) _ _ assms(4), of Tmin]
[PROOF STATE]
proof (prove)
using this:
0 < a
0 \<le> \<tau>
0 < Tmin
Tmax < L
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?\<tau>; \<forall>\<tau>\<in>{0..?\<tau>}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> L - Tmax \<le> exp (- (a \<cdot> ?\<tau>)) \<cdot> (L - ?T)
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?\<tau>; \<forall>\<tau>\<in>{0..?\<tau>}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> L - exp (- (a \<cdot> ?\<tau>)) \<cdot> (L - ?T) \<le> Tmax
\<lbrakk>Tmin \<le> ?T; ?T \<le> Tmax; 0 \<le> ?\<tau>; \<forall>\<tau>\<in>{0..?\<tau>}. \<tau> \<le> - (ln ((L - Tmax) / (L - ?T)) / a)\<rbrakk> \<Longrightarrow> Tmin \<le> L - exp (- (a \<cdot> ?\<tau>)) \<cdot> (L - ?T)

goal (4 subgoals):
 1. 0 < a
 2. 0 \<le> \<tau>
 3. s2p UNIV \<tau>
 4. \<forall>s\<in>UNIV. s $ 4 \<noteq> 0 \<and> I Tmin Tmax s \<and> s $ 2 = 0 \<and> s $ 3 = s $ 1 \<longrightarrow> (\<forall>t\<in>{0..\<tau>}. (\<forall>\<tau>\<in>{0..t}. G Tmin Tmax a L (\<phi> a L \<tau> s)) \<longrightarrow> I Tmin Tmax (\<phi> a L t s))
[PROOF STEP]
by auto


[STATEMENT]
lemma measure_Union:
  "emeasure M A \<noteq> \<infinity> \<Longrightarrow> emeasure M B \<noteq> \<infinity> \<Longrightarrow> A \<in> sets M \<Longrightarrow> B \<in> sets M \<Longrightarrow> A \<inter> B = {} \<Longrightarrow>
    measure M (A \<union> B) = measure M A + measure M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>emeasure M A \<noteq> \<infinity>; emeasure M B \<noteq> \<infinity>; A \<in> sets M; B \<in> sets M; A \<inter> B = {}\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M (A \<union> B) = Sigma_Algebra.measure M A + Sigma_Algebra.measure M B
[PROOF STEP]
by (simp add: measure_def plus_emeasure[symmetric] enn2real_plus less_top)


[STATEMENT]
lemma is_pref_profile_iff:
  "is_pref_profile A \<longleftrightarrow> set_mset A \<subseteq> Pow parties - {{}} \<and> size A = n_voters"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_pref_profile A = (set_mset A \<subseteq> Pow parties - {{}} \<and> size A = n_voters)
[PROOF STEP]
unfolding anon_papp_profile_def anon_papp_profile_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (anon_papp_election n_voters parties \<and> (\<forall>X. X \<in># A \<longrightarrow> X \<subseteq> parties) \<and> {} \<notin># A \<and> size A = n_voters) = (set_mset A \<subseteq> Pow parties - {{}} \<and> size A = n_voters)
[PROOF STEP]
using anon_papp_election_axioms
[PROOF STATE]
proof (prove)
using this:
anon_papp_election n_voters parties

goal (1 subgoal):
 1. (anon_papp_election n_voters parties \<and> (\<forall>X. X \<in># A \<longrightarrow> X \<subseteq> parties) \<and> {} \<notin># A \<and> size A = n_voters) = (set_mset A \<subseteq> Pow parties - {{}} \<and> size A = n_voters)
[PROOF STEP]
by auto


[STATEMENT]
lemma topologyI:
  "\<lbrakk> \<And> x y. \<lbrakk> is_open T x; is_open T y\<rbrakk> \<Longrightarrow> is_open T (x \<inter> y);
     \<And> M. \<forall> m \<in> M. is_open T m \<Longrightarrow> is_open T (\<Union> M)
   \<rbrakk> \<Longrightarrow> topology T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. \<lbrakk>x open\<^bsub>T\<^esub>; y open\<^bsub>T\<^esub>\<rbrakk> \<Longrightarrow> x \<inter> y open\<^bsub>T\<^esub>; \<And>M. \<forall>m\<in>M. m open\<^bsub>T\<^esub> \<Longrightarrow> \<Union> M open\<^bsub>T\<^esub>\<rbrakk> \<Longrightarrow> topology T
[PROOF STEP]
by (auto simp: topology_def)


[STATEMENT]
lemma volumeI:
  assumes "f {} = 0"
  assumes "\<And>a. a \<in> M \<Longrightarrow> 0 \<le> f a"
  assumes "\<And>C. C \<subseteq> M \<Longrightarrow> disjoint C \<Longrightarrow> finite C \<Longrightarrow> \<Union>C \<in> M \<Longrightarrow> f (\<Union>C) = (\<Sum>c\<in>C. f c)"
  shows "volume M f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. volume M f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f {} = 0
?a \<in> M \<Longrightarrow> 0 \<le> f ?a
\<lbrakk>?C \<subseteq> M; disjoint ?C; finite ?C; \<Union> ?C \<in> M\<rbrakk> \<Longrightarrow> f (\<Union> ?C) = sum f ?C

goal (1 subgoal):
 1. volume M f
[PROOF STEP]
by (auto simp: volume_def)


[STATEMENT]
lemma vifunion_iff: "b \<in>\<^sub>\<circ> (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. f i) \<longleftrightarrow> (\<exists>i\<in>\<^sub>\<circ>I. b \<in>\<^sub>\<circ> f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<in>\<^sub>\<circ> \<Union>\<^sub>\<circ> (VLambda I f `\<^sub>\<circ> I)) = (\<exists>i\<in>elts I. b \<in>\<^sub>\<circ> f i)
[PROOF STEP]
by force


[STATEMENT]
lemma capped_omega_isotone:
  "y \<le> u \<Longrightarrow> u * v \<le> v \<Longrightarrow> t \<le> y \<Longrightarrow> t\<^sup>\<omega>\<^sub>v \<le> y\<^sup>\<omega>\<^sub>v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<le> u; u * v \<le> v; t \<le> y\<rbrakk> \<Longrightarrow> t\<^sup>\<omega>\<^sub>v \<le> y\<^sup>\<omega>\<^sub>v
[PROOF STEP]
by (metis capped_omega_induct_meet capped_omega_unfold le_iff_sup inf.sup_left_isotone mult_right_sub_dist_sup_left)


[STATEMENT]
lemma inext_less_mono_rev: "
  \<lbrakk> inext a I < inext b I; a \<in> I; b \<in> I \<rbrakk> \<Longrightarrow> a < b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inext a I < inext b I; a \<in> I; b \<in> I\<rbrakk> \<Longrightarrow> a < b
[PROOF STEP]
by (metis inext_le_mono not_le)


[STATEMENT]
lemma fixp_induct_set_scott:
  fixes F :: "'c \<Rightarrow> 'c"
  and U :: "'c \<Rightarrow> 'b \<Rightarrow> 'a set"
  and C :: "('b \<Rightarrow> 'a set) \<Rightarrow> 'c"
  and P :: "'b \<Rightarrow> 'a \<Rightarrow> bool"
  and x and y
  assumes mono: "\<And>x. mono_set (\<lambda>f. U (F (C f)) x)"
  and eq: "f \<equiv> C (ccpo.fixp (fun_lub Sup) (fun_ord (\<le>)) (\<lambda>f. U (F (C f))))"
  and inverse2: "\<And>f. U (C f) = f"
  and step: "\<And>f x y. \<lbrakk> \<And>x y. y \<in> U f x \<Longrightarrow> P x y; y \<in> U (F f) x \<rbrakk> \<Longrightarrow> P x y"
  and enforce_variable_ordering: "x = x"
  and elem: "y \<in> U f x"
  shows "P x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x y
[PROOF STEP]
using step elem set.fixp_induct_uc[of U F C, OF mono eq inverse2 set_admissible, of P]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x y. y \<in> U ?f x \<Longrightarrow> P x y; ?y \<in> U (F ?f) ?x\<rbrakk> \<Longrightarrow> P ?x ?y
y \<in> U f x
\<lbrakk>\<forall>x y. y \<in> \<Union> {} \<longrightarrow> P x y; \<And>f. \<forall>x y. y \<in> U f x \<longrightarrow> P x y \<Longrightarrow> \<forall>x y. y \<in> U (F f) x \<longrightarrow> P x y\<rbrakk> \<Longrightarrow> \<forall>x y. y \<in> U f x \<longrightarrow> P x y

goal (1 subgoal):
 1. P x y
[PROOF STEP]
by blast


[STATEMENT]
lemma powsum_mpoly_recurrence':
  assumes k: "k > card X" and X: "finite X"
  shows   "(powsum_mpoly X k :: 'a :: comm_ring_1 mpoly) =
             -(\<Sum>i=1..card X. (-1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
define e p :: "nat \<Rightarrow> 'a mpoly" where [simp]: "e = sym_mpoly X" "p = powsum_mpoly X"
[PROOF STATE]
proof (state)
this:
e = sym_mpoly X
p = powsum_mpoly X

goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "p k = (-1) ^ (k + 1) * of_nat k * e k - (\<Sum>i=1..<k. (-1) ^ i * e i * p (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p k = (- 1) ^ (k + 1) * of_nat k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
unfolding e_p_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. powsum_mpoly X k = (- 1) ^ (k + 1) * of_nat k * sym_mpoly X k - (\<Sum>i = 1..<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card X < k
finite X

goal (1 subgoal):
 1. powsum_mpoly X k = (- 1) ^ (k + 1) * of_nat k * sym_mpoly X k - (\<Sum>i = 1..<k. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
by (intro powsum_mpoly_recurrence) auto
[PROOF STATE]
proof (state)
this:
p k = (- 1) ^ (k + 1) * of_nat k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))

goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p k = (- 1) ^ (k + 1) * of_nat k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))

goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "\<dots> = -(\<Sum>i=1..<k. (-1) ^ i * e i * p (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ (k + 1) * of_nat k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i)) = - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card X < k
finite X

goal (1 subgoal):
 1. (- 1) ^ (k + 1) * of_nat k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i)) = - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- 1) ^ (k + 1) * of_nat k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i)) = - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))

goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(- 1) ^ (k + 1) * of_nat k * e k - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i)) = - (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i))

goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
have "(\<Sum>i=1..<k. (-1) ^ i * e i * p (k - i)) = (\<Sum>i=1..card X. (-1) ^ i * e i * p (k - i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i)) = (\<Sum>i = 1..card X. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
card X < k
finite X

goal (1 subgoal):
 1. (\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i)) = (\<Sum>i = 1..card X. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
by (intro sum.mono_neutral_right) auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 1..<k. (- 1) ^ i * e i * p (k - i)) = (\<Sum>i = 1..card X. (- 1) ^ i * e i * p (k - i))

goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p k = - (\<Sum>i = 1..card X. (- 1) ^ i * e i * p (k - i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p k = - (\<Sum>i = 1..card X. (- 1) ^ i * e i * p (k - i))

goal (1 subgoal):
 1. powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
powsum_mpoly X k = - (\<Sum>i = 1..card X. (- 1) ^ i * sym_mpoly X i * powsum_mpoly X (k - i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma padd_one_ineq_sum:
  assumes "padd a b = pwrite"
      and "pgte x aa"
      and "pgte x bb"
    shows "pgte x (padd (pmult a aa) (pmult b bb))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pgte x (padd (pmult a aa) (pmult b bb))
[PROOF STEP]
by (metis (mono_tags, lifting) Rep_prat assms(1) assms(2) assms(3) convex_bound_le mem_Collect_eq padd.rep_eq pgte.rep_eq pmult.rep_eq pwrite.rep_eq)


[STATEMENT]
lemma continuity_lem_gt0:
  fixes r:: "real"
  fixes a b c:: "real"
  shows "poly [:c, b, a:] r > 0 \<Longrightarrow>
    \<exists>y'> r. \<forall>x\<in>{r<..y'}. poly [:c, b, a:] x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
assume r_gtz: "poly [:c, b, a:] r > 0 "
[PROOF STATE]
proof (state)
this:
0 < poly [:c, b, a:] r

goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
let ?p = "[:-c, -b, -a:]"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
have revpoly: "\<forall>x. -1*(poly [:c, b, a:] x) = poly [:-c, -b, -a:] x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. - 1 * poly [:c, b, a:] x = poly [:- c, - b, - a:] x
[PROOF STEP]
by (metis (no_types, opaque_lifting) Polynomial.poly_minus minus_pCons mult_minus1 neg_equal_0_iff_equal)
[PROOF STATE]
proof (state)
this:
\<forall>x. - 1 * poly [:c, b, a:] x = poly [:- c, - b, - a:] x

goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. - 1 * poly [:c, b, a:] x = poly [:- c, - b, - a:] x
[PROOF STEP]
have "poly ?p r < 0"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. - 1 * poly [:c, b, a:] x = poly [:- c, - b, - a:] x

goal (1 subgoal):
 1. poly [:- c, - b, - a:] r < 0
[PROOF STEP]
using r_gtz
[PROOF STATE]
proof (prove)
using this:
\<forall>x. - 1 * poly [:c, b, a:] x = poly [:- c, - b, - a:] x
0 < poly [:c, b, a:] r

goal (1 subgoal):
 1. poly [:- c, - b, - a:] r < 0
[PROOF STEP]
by (metis mult_minus1 neg_less_0_iff_less)
[PROOF STATE]
proof (state)
this:
poly [:- c, - b, - a:] r < 0

goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
poly [:- c, - b, - a:] r < 0
[PROOF STEP]
have "\<exists>y'> r. \<forall>x\<in>{r<..y'}. poly ?p x < 0"
[PROOF STATE]
proof (prove)
using this:
poly [:- c, - b, - a:] r < 0

goal (1 subgoal):
 1. \<exists>y'>r. \<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0
[PROOF STEP]
using continuity_lem_lt0
[PROOF STATE]
proof (prove)
using this:
poly [:- c, - b, - a:] r < 0
poly [:?c, ?b, ?a:] ?r < 0 \<Longrightarrow> \<exists>y'>?r. \<forall>x\<in>{?r<..y'}. poly [:?c, ?b, ?a:] x < 0

goal (1 subgoal):
 1. \<exists>y'>r. \<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>y'>r. \<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0

goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>y'>r. \<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0
[PROOF STEP]
obtain y' where y_prop: "y' > r \<and> (\<forall>x\<in>{r<..y'}. poly ?p x < 0)"
[PROOF STATE]
proof (prove)
using this:
\<exists>y'>r. \<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0

goal (1 subgoal):
 1. (\<And>y'. r < y' \<and> (\<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r < y' \<and> (\<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0)

goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
r < y' \<and> (\<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0)
[PROOF STEP]
have "\<forall>x\<in>{r<..y'}. poly [:c, b, a:] x > 0 "
[PROOF STATE]
proof (prove)
using this:
r < y' \<and> (\<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0)

goal (1 subgoal):
 1. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
using revpoly
[PROOF STATE]
proof (prove)
using this:
r < y' \<and> (\<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0)
\<forall>x. - 1 * poly [:c, b, a:] x = poly [:- c, - b, - a:] x

goal (1 subgoal):
 1. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
using neg_less_0_iff_less
[PROOF STATE]
proof (prove)
using this:
r < y' \<and> (\<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0)
\<forall>x. - 1 * poly [:c, b, a:] x = poly [:- c, - b, - a:] x
(- ?a < (0::?'a)) = ((0::?'a) < ?a)

goal (1 subgoal):
 1. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x

goal (1 subgoal):
 1. 0 < poly [:c, b, a:] r \<Longrightarrow> \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x

goal (1 subgoal):
 1. \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
using y_prop
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
r < y' \<and> (\<forall>x\<in>{r<..y'}. poly [:- c, - b, - a:] x < 0)

goal (1 subgoal):
 1. \<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>y'>r. \<forall>x\<in>{r<..y'}. 0 < poly [:c, b, a:] x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iMOD_iff: "x \<in> [r, mod m] = (x mod m = r mod m \<and> r \<le> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> [ r, mod m ]) = (x mod m = r mod m \<and> r \<le> x)
[PROOF STEP]
by (simp add: iMOD_def)


[STATEMENT]
lemma powreal_divide:
  "\<lbrakk> 0 \<le> a; 0 \<le> b \<rbrakk> \<Longrightarrow> (a/b) pow\<^sub>\<real> x = (a pow\<^sub>\<real> x) / (b pow\<^sub>\<real> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; 0 \<le> b\<rbrakk> \<Longrightarrow> (a / b) pow\<^sub>\<real> x = a pow\<^sub>\<real> x / b pow\<^sub>\<real> x
[PROOF STEP]
by (simp add: divide_inverse powreal_inverse powreal_mult_base)


[STATEMENT]
lemma xor_list_left_inverse [simp]:
  fixes xs :: "'a :: boolean_algebra list"
  shows "length ys \<le> length xs \<Longrightarrow> xs [\<oplus>] (xs [\<oplus>] ys) = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length ys \<le> length xs \<Longrightarrow> xs [\<oplus>] xs [\<oplus>] ys = ys
[PROOF STEP]
by(subst xor_list_assoc[symmetric])(simp)


[STATEMENT]
lemma greaterThanAtMost_eq_atLeastAtMost_diff: "{a<\<^sub>a..\<le>\<^sub>ab} = {a\<le>\<^sub>a..\<le>\<^sub>ab} - {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a<\<^sub>a..\<le>\<^sub>ab} = {a\<le>\<^sub>a..\<le>\<^sub>ab} - {a}
[PROOF STEP]
unfolding interval_def ray_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x \<in> UNIV. a <\<^sub>a x} \<inter> {x \<in> UNIV. x \<le>\<^sub>a b} = {x \<in> UNIV. a \<le>\<^sub>a x} \<inter> {x \<in> UNIV. x \<le>\<^sub>a b} - {a}
[PROOF STEP]
by (auto simp: less_imp_le le_less)


[STATEMENT]
lemma excess_eq1:
  "\<lbrakk> inv g; final g; tame g; except g v = 0; v \<in> set(vertices g) \<rbrakk> \<Longrightarrow>
   ExcessAt g v + (tri g v) * \<d> 3 + (quad g v) * \<d>  4
   = \<b> (tri g v) (quad g v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Invariants.inv g; final g; tame g; except g v = 0; v \<in> \<V> g\<rbrakk> \<Longrightarrow> ExcessAt g v + tri g v * \<d> 3 + quad g v * \<d> 4 = \<b> (tri g v) (quad g v)
[PROOF STEP]
apply(subgoal_tac "finalVertex g v")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Invariants.inv g; final g; tame g; except g v = 0; v \<in> \<V> g; finalVertex g v\<rbrakk> \<Longrightarrow> ExcessAt g v + tri g v * \<d> 3 + quad g v * \<d> 4 = \<b> (tri g v) (quad g v)
 2. \<lbrakk>Invariants.inv g; final g; tame g; except g v = 0; v \<in> \<V> g\<rbrakk> \<Longrightarrow> finalVertex g v
[PROOF STEP]
apply(simp add: ExcessAt_def excess_eq faceCountMax_bound)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Invariants.inv g; final g; tame g; except g v = 0; v \<in> \<V> g\<rbrakk> \<Longrightarrow> finalVertex g v
[PROOF STEP]
apply(auto simp:finalVertex_def plane_final_facesAt)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma dtree_size_decr[termination_simp]:
  assumes "(x, y) \<in> fset (xs:: (('a, 'b) dtree \<times> 'b) fset)"
  shows "size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
let ?xs = "(map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y)) ` fset xs"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
have "size x < (\<Sum>u\<in>?xs. Suc (size_prod snd (\<lambda>_. 0) u)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. size x < (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (size_prod snd (\<lambda>_. 0) u)) + 1
[PROOF STEP]
using dtree_size_decr_aux assms
[PROOF STATE]
proof (prove)
using this:
(?x, ?y) \<in> fset ?xs \<Longrightarrow> size ?x < size (Node ?r ?xs)
(x, y) \<in> fset xs

goal (1 subgoal):
 1. size x < (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (size_prod snd (\<lambda>_. 0) u)) + 1
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
size x < (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (size_prod snd (\<lambda>_. 0) u)) + 1

goal (1 subgoal):
 1. size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
size x < (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (size_prod snd (\<lambda>_. 0) u)) + 1

goal (1 subgoal):
 1. size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
have "\<dots> = Suc (\<Sum>u\<in>?xs. Suc (Suc (snd (fst u))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (size_prod snd (\<lambda>_. 0) u)) + 1 = Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
by (simp add: size_prod_simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (size_prod snd (\<lambda>_. 0) u)) + 1 = Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))

goal (1 subgoal):
 1. size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))

goal (1 subgoal):
 1. size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
size x < Suc (\<Sum>u\<in>map_prod (\<lambda>x. (x, size x)) (\<lambda>y. y) ` fset xs. Suc (Suc (snd (fst u))))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lookup_times_monomial_right: "lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)"
  for c::"'b::semiring_0" and t::"'a::comm_powerprod"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
proof (induct p rule: poly_mapping_except_induct, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
fix p::"'a \<Rightarrow>\<^sub>0 'b" and w
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
assume "p \<noteq> 0" and "w \<in> keys p"
    and IH: "lookup (except p {w} * monomial c t) s =
             ((lookup (except p {w}) (s - t)) * c when t adds s)"
            (is "_ = ?x")
[PROOF STATE]
proof (state)
this:
p \<noteq> 0
w \<in> keys p
lookup (except p {w} * monomial c t) s = (lookup (except p {w}) (s - t) * c when t adds s)

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
have "p * monomial c t = (monomial (lookup p w) w + except p {w}) * monomial c t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * monomial c t = (monomial (lookup p w) w + except p {w}) * monomial c t
[PROOF STEP]
by (simp only: plus_except[symmetric])
[PROOF STATE]
proof (state)
this:
p * monomial c t = (monomial (lookup p w) w + except p {w}) * monomial c t

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p * monomial c t = (monomial (lookup p w) w + except p {w}) * monomial c t

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
have "... = monomial (lookup p w) w * monomial c t + except p {w} * monomial c t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (monomial (lookup p w) w + except p {w}) * monomial c t = monomial (lookup p w) w * monomial c t + except p {w} * monomial c t
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
(monomial (lookup p w) w + except p {w}) * monomial c t = monomial (lookup p w) w * monomial c t + except p {w} * monomial c t

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(monomial (lookup p w) w + except p {w}) * monomial c t = monomial (lookup p w) w * monomial c t + except p {w} * monomial c t

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
have "... = monomial (lookup p w * c) (w + t) + except p {w} * monomial c t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial (lookup p w) w * monomial c t + except p {w} * monomial c t = monomial (lookup p w * c) (w + t) + except p {w} * monomial c t
[PROOF STEP]
by (simp only: mult_single)
[PROOF STATE]
proof (state)
this:
monomial (lookup p w) w * monomial c t + except p {w} * monomial c t = monomial (lookup p w * c) (w + t) + except p {w} * monomial c t

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p * monomial c t = monomial (lookup p w * c) (w + t) + except p {w} * monomial c t
[PROOF STEP]
have "lookup (p * monomial c t) s = lookup (monomial (lookup p w * c) (w + t)) s + ?x"
[PROOF STATE]
proof (prove)
using this:
p * monomial c t = monomial (lookup p w * c) (w + t) + except p {w} * monomial c t

goal (1 subgoal):
 1. lookup (p * monomial c t) s = lookup (monomial (lookup p w * c) (w + t)) s + (lookup (except p {w}) (s - t) * c when t adds s)
[PROOF STEP]
by (simp only: lookup_add IH)
[PROOF STATE]
proof (state)
this:
lookup (p * monomial c t) s = lookup (monomial (lookup p w * c) (w + t)) s + (lookup (except p {w}) (s - t) * c when t adds s)

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lookup (p * monomial c t) s = lookup (monomial (lookup p w * c) (w + t)) s + (lookup (except p {w}) (s - t) * c when t adds s)

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
have "... = (lookup (monomial (lookup p w * c) (w + t)) s +
                    lookup (except p {w}) (s - t) * c when t adds s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (monomial (lookup p w * c) (w + t)) s + (lookup (except p {w}) (s - t) * c when t adds s) = (lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c when t adds s)
[PROOF STEP]
by (rule when_distrib, auto simp add: lookup_single when_def)
[PROOF STATE]
proof (state)
this:
lookup (monomial (lookup p w * c) (w + t)) s + (lookup (except p {w}) (s - t) * c when t adds s) = (lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c when t adds s)

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lookup (monomial (lookup p w * c) (w + t)) s + (lookup (except p {w}) (s - t) * c when t adds s) = (lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c when t adds s)

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
from refl
[PROOF STATE]
proof (chain)
picking this:
?t = ?t
[PROOF STEP]
have "... = (lookup p (s - t) * c when t adds s)"
[PROOF STATE]
proof (prove)
using this:
?t = ?t

goal (1 subgoal):
 1. (lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c when t adds s) = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
proof (rule when_cong)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t adds s \<Longrightarrow> lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c = lookup p (s - t) * c
[PROOF STEP]
assume "t adds s"
[PROOF STATE]
proof (state)
this:
t adds s

goal (1 subgoal):
 1. t adds s \<Longrightarrow> lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c = lookup p (s - t) * c
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
t adds s
[PROOF STEP]
obtain u where u: "s = t + u"
[PROOF STATE]
proof (prove)
using this:
t adds s

goal (1 subgoal):
 1. (\<And>u. s = t + u \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
s = t + u

goal (1 subgoal):
 1. t adds s \<Longrightarrow> lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c = lookup p (s - t) * c
[PROOF STEP]
show "lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c =
          lookup p (s - t) * c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c = lookup p (s - t) * c
[PROOF STEP]
by (simp add: u, cases "u = w", simp_all add: lookup_except lookup_single add.commute)
[PROOF STATE]
proof (state)
this:
lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c = lookup p (s - t) * c

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(lookup (monomial (lookup p w * c) (w + t)) s + lookup (except p {w}) (s - t) * c when t adds s) = (lookup p (s - t) * c when t adds s)

goal (1 subgoal):
 1. \<And>p ta. \<lbrakk>p \<noteq> 0; ta \<in> keys p; lookup (except p {ta} * monomial c t) s = (lookup (except p {ta}) (s - t) * c when t adds s)\<rbrakk> \<Longrightarrow> lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
show "lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)"
[PROOF STATE]
proof (prove)
using this:
lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)

goal (1 subgoal):
 1. lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lookup (p * monomial c t) s = (lookup p (s - t) * c when t adds s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma language_state_for_inputs_union :
  shows "LS\<^sub>i\<^sub>n M q T1 \<union> LS\<^sub>i\<^sub>n M q T2 = LS\<^sub>i\<^sub>n M q (T1 \<union> T2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LS\<^sub>i\<^sub>n M q T1 \<union> LS\<^sub>i\<^sub>n M q T2 = LS\<^sub>i\<^sub>n M q (T1 \<union> T2)
[PROOF STEP]
unfolding language_state_for_inputs.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xs || ys |xs ys. xs \<in> T1 \<and> length xs = length ys \<and> xs || ys \<in> LS M q} \<union> {xs || ys |xs ys. xs \<in> T2 \<and> length xs = length ys \<and> xs || ys \<in> LS M q} = {xs || ys |xs ys. xs \<in> T1 \<union> T2 \<and> length xs = length ys \<and> xs || ys \<in> LS M q}
[PROOF STEP]
by blast


[STATEMENT]
lemma not_UINF: "(\<not> (\<Sqinter> i\<in>A\<bullet> P(i))) = (\<Squnion> i\<in>A\<bullet> \<not> P(i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (\<Sqinter> i \<in> A \<bullet> P i)) = (\<Squnion> i \<in> A \<bullet> \<not> P i)
[PROOF STEP]
by (pred_auto)


[STATEMENT]
lemma Healthy_INFIMUM:
  "A \<subseteq> \<lbrakk>H\<rbrakk>\<^sub>H \<Longrightarrow> Inf (H ` A) = \<Squnion> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> \<lbrakk>H\<rbrakk>\<^sub>H \<Longrightarrow> \<And>(H ` A) = \<And>A
[PROOF STEP]
by (drule Healthy_carrier_image, presburger)


[STATEMENT]
lemma self_list_diff:
  "xs - xs = replicate (length(xs::'a::group_add list)) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. xs - xs = replicate (length xs) (0::'a)
[PROOF STEP]
by(induct xs) simp_all


[STATEMENT]
lemma (in normal) normal_oVeblen_0:
"0 < F 0 \<Longrightarrow> normal (\<lambda>x. oVeblen F x 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < F 0 \<Longrightarrow> normal (\<lambda>x. oVeblen F x 0)
[PROOF STEP]
apply (rule normalI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>f. \<lbrakk>0 < F 0; OrdinalInduct.strict_mono f\<rbrakk> \<Longrightarrow> oVeblen F (oLimit f) 0 = oLimit (\<lambda>n. oVeblen F (f n) 0)
 2. \<And>x. 0 < F 0 \<Longrightarrow> oVeblen F x 0 < oVeblen F (oSuc x) 0
[PROOF STEP]
apply (rule oVeblen_oLimit_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < F 0 \<Longrightarrow> oVeblen F x 0 < oVeblen F (oSuc x) 0
[PROOF STEP]
apply (simp only: oVeblen_oSuc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < F 0 \<Longrightarrow> oVeblen F x 0 < oDeriv (oVeblen F x) 0
[PROOF STEP]
apply (subst oDeriv_fixed[OF normal_oVeblen, symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < F 0 \<Longrightarrow> oVeblen F x 0 < oVeblen F x (oDeriv (oVeblen F x) 0)
[PROOF STEP]
apply (rule normal.strict_monoD[OF normal_oVeblen])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < F 0 \<Longrightarrow> 0 < oDeriv (oVeblen F x) 0
[PROOF STEP]
apply (simp add: zero_less_oFix_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. 0 < F 0 \<Longrightarrow> 0 < oVeblen F x 0
[PROOF STEP]
apply (erule order_less_le_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. F 0 \<le> oVeblen F x 0
[PROOF STEP]
apply (subgoal_tac "oVeblen F 0 0 \<le> oVeblen F x 0")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. oVeblen F 0 0 \<le> oVeblen F x 0 \<Longrightarrow> F 0 \<le> oVeblen F x 0
 2. \<And>x. oVeblen F 0 0 \<le> oVeblen F x 0
[PROOF STEP]
apply (simp add: oVeblen_0)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. oVeblen F 0 0 \<le> oVeblen F x 0
[PROOF STEP]
apply (rule continuous.monoD[OF _ ordinal_0_le])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. continuous (\<lambda>a. oVeblen F a 0)
[PROOF STEP]
apply (rule continuous_oVeblen_0)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma subst_idx_map:
  assumes "\<forall>i \<in> set I. i < length T"
  shows "(map ((!) T) I) \<cdot>\<^sub>l\<^sub>i\<^sub>s\<^sub>t \<delta> = map ((!) (map (\<lambda>t. t \<cdot> \<delta>) T)) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map ((!) T) I \<cdot>\<^sub>l\<^sub>i\<^sub>s\<^sub>t \<delta> = map ((!) (T \<cdot>\<^sub>l\<^sub>i\<^sub>s\<^sub>t \<delta>)) I
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>set I. i < length T

goal (1 subgoal):
 1. map ((!) T) I \<cdot>\<^sub>l\<^sub>i\<^sub>s\<^sub>t \<delta> = map ((!) (T \<cdot>\<^sub>l\<^sub>i\<^sub>s\<^sub>t \<delta>)) I
[PROOF STEP]
by auto


[STATEMENT]
lemma length_pps_to_list: "length (pps_to_list S) = card S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (pps_to_list S) = card S
[PROOF STEP]
proof (cases "finite S")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite S \<Longrightarrow> length (pps_to_list S) = card S
 2. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite S

goal (2 subgoals):
 1. finite S \<Longrightarrow> length (pps_to_list S) = card S
 2. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
from distinct_card[OF distinct_pps_to_list]
[PROOF STATE]
proof (chain)
picking this:
card (set (pps_to_list ?S1)) = length (pps_to_list ?S1)
[PROOF STEP]
have "length (pps_to_list S) = card (set (pps_to_list S))"
[PROOF STATE]
proof (prove)
using this:
card (set (pps_to_list ?S1)) = length (pps_to_list ?S1)

goal (1 subgoal):
 1. length (pps_to_list S) = card (set (pps_to_list S))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (pps_to_list S) = card (set (pps_to_list S))

goal (2 subgoals):
 1. finite S \<Longrightarrow> length (pps_to_list S) = card S
 2. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
length (pps_to_list S) = card (set (pps_to_list S))

goal (2 subgoals):
 1. finite S \<Longrightarrow> length (pps_to_list S) = card S
 2. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
finite S
[PROOF STEP]
have "... = card S"
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. card (set (pps_to_list S)) = card S
[PROOF STEP]
by (simp only: set_pps_to_list)
[PROOF STATE]
proof (state)
this:
card (set (pps_to_list S)) = card S

goal (2 subgoals):
 1. finite S \<Longrightarrow> length (pps_to_list S) = card S
 2. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
length (pps_to_list S) = card S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (pps_to_list S) = card S

goal (1 subgoal):
 1. length (pps_to_list S) = card S
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
length (pps_to_list S) = card S

goal (1 subgoal):
 1. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite S

goal (1 subgoal):
 1. infinite S \<Longrightarrow> length (pps_to_list S) = card S
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
infinite S

goal (1 subgoal):
 1. length (pps_to_list S) = card S
[PROOF STEP]
by (simp add: pps_to_list_def)
[PROOF STATE]
proof (state)
this:
length (pps_to_list S) = card S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subst_cls_lists_append[simp]:
  "length Cs = length \<sigma>s \<Longrightarrow> length Cs' = length \<sigma>s' \<Longrightarrow>
   (Cs @ Cs') \<cdot>\<cdot>cl (\<sigma>s @ \<sigma>s') = Cs \<cdot>\<cdot>cl \<sigma>s @ Cs' \<cdot>\<cdot>cl \<sigma>s'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length Cs = length \<sigma>s; length Cs' = length \<sigma>s'\<rbrakk> \<Longrightarrow> (Cs @ Cs') \<cdot>\<cdot>cl (\<sigma>s @ \<sigma>s') = Cs \<cdot>\<cdot>cl \<sigma>s @ Cs' \<cdot>\<cdot>cl \<sigma>s'
[PROOF STEP]
unfolding subst_cls_lists_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length Cs = length \<sigma>s; length Cs' = length \<sigma>s'\<rbrakk> \<Longrightarrow> Map2.map2 (\<cdot>) (Cs @ Cs') (\<sigma>s @ \<sigma>s') = Map2.map2 (\<cdot>) Cs \<sigma>s @ Map2.map2 (\<cdot>) Cs' \<sigma>s'
[PROOF STEP]
by auto


[STATEMENT]
lemma (in prob_space) indep_sets_finite:
  assumes I: "I \<noteq> {}" "finite I"
    and F: "\<And>i. i \<in> I \<Longrightarrow> F i \<subseteq> events" "\<And>i. i \<in> I \<Longrightarrow> space M \<in> F i"
  shows "indep_sets F I \<longleftrightarrow> (\<forall>A\<in>Pi I F. prob (\<Inter>j\<in>I. A j) = (\<Prod>j\<in>I. prob (A j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets F I = (\<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j)))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. indep_sets F I \<Longrightarrow> \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j))
 2. \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j)) \<Longrightarrow> indep_sets F I
[PROOF STEP]
assume *: "indep_sets F I"
[PROOF STATE]
proof (state)
this:
indep_sets F I

goal (2 subgoals):
 1. indep_sets F I \<Longrightarrow> \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j))
 2. \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j)) \<Longrightarrow> indep_sets F I
[PROOF STEP]
from I
[PROOF STATE]
proof (chain)
picking this:
I \<noteq> {}
finite I
[PROOF STEP]
show "\<forall>A\<in>Pi I F. prob (\<Inter>j\<in>I. A j) = (\<Prod>j\<in>I. prob (A j))"
[PROOF STATE]
proof (prove)
using this:
I \<noteq> {}
finite I

goal (1 subgoal):
 1. \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j))
[PROOF STEP]
by (intro indep_setsD[OF *] ballI) auto
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j))

goal (1 subgoal):
 1. \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j)) \<Longrightarrow> indep_sets F I
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j)) \<Longrightarrow> indep_sets F I
[PROOF STEP]
assume indep: "\<forall>A\<in>Pi I F. prob (\<Inter>j\<in>I. A j) = (\<Prod>j\<in>I. prob (A j))"
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j))

goal (1 subgoal):
 1. \<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j)) \<Longrightarrow> indep_sets F I
[PROOF STEP]
show "indep_sets F I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_sets F I
[PROOF STEP]
proof (rule indep_setsI[OF F(1)])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
fix A J
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
assume J: "J \<noteq> {}" "J \<subseteq> I" "finite J"
[PROOF STATE]
proof (state)
this:
J \<noteq> {}
J \<subseteq> I
finite J

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
assume A: "\<forall>j\<in>J. A j \<in> F j"
[PROOF STATE]
proof (state)
this:
\<forall>j\<in>J. A j \<in> F j

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
let ?A = "\<lambda>j. if j \<in> J then A j else space M"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
have "prob (\<Inter>j\<in>I. ?A j) = prob (\<Inter>j\<in>J. A j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob (\<Inter>j\<in>I. if j \<in> J then A j else space M) = prob (\<Inter> (A ` J))
[PROOF STEP]
using subset_trans[OF F(1) sets.space_closed] J A
[PROOF STATE]
proof (prove)
using this:
?i10 \<in> I \<Longrightarrow> F ?i10 \<subseteq> Pow (space M)
J \<noteq> {}
J \<subseteq> I
finite J
\<forall>j\<in>J. A j \<in> F j

goal (1 subgoal):
 1. prob (\<Inter>j\<in>I. if j \<in> J then A j else space M) = prob (\<Inter> (A ` J))
[PROOF STEP]
by (auto intro!: arg_cong[where f=prob] split: if_split_asm) blast
[PROOF STATE]
proof (state)
this:
prob (\<Inter>j\<in>I. if j \<in> J then A j else space M) = prob (\<Inter> (A ` J))

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob (\<Inter>j\<in>I. if j \<in> J then A j else space M) = prob (\<Inter> (A ` J))

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
from A F
[PROOF STATE]
proof (chain)
picking this:
\<forall>j\<in>J. A j \<in> F j
?i8 \<in> I \<Longrightarrow> F ?i8 \<subseteq> events
?i8 \<in> I \<Longrightarrow> space M \<in> F ?i8
[PROOF STEP]
have "(\<lambda>j. if j \<in> J then A j else space M) \<in> Pi I F" (is "?A \<in> _")
[PROOF STATE]
proof (prove)
using this:
\<forall>j\<in>J. A j \<in> F j
?i8 \<in> I \<Longrightarrow> F ?i8 \<subseteq> events
?i8 \<in> I \<Longrightarrow> space M \<in> F ?i8

goal (1 subgoal):
 1. (\<lambda>j. if j \<in> J then A j else space M) \<in> Pi I F
[PROOF STEP]
by (auto split: if_split_asm)
[PROOF STATE]
proof (state)
this:
(\<lambda>j. if j \<in> J then A j else space M) \<in> Pi I F

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
with indep
[PROOF STATE]
proof (chain)
picking this:
\<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j))
(\<lambda>j. if j \<in> J then A j else space M) \<in> Pi I F
[PROOF STEP]
have "prob (\<Inter>j\<in>I. ?A j) = (\<Prod>j\<in>I. prob (?A j))"
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>Pi I F. prob (\<Inter> (A ` I)) = (\<Prod>j\<in>I. prob (A j))
(\<lambda>j. if j \<in> J then A j else space M) \<in> Pi I F

goal (1 subgoal):
 1. prob (\<Inter>j\<in>I. if j \<in> J then A j else space M) = (\<Prod>j\<in>I. prob (if j \<in> J then A j else space M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
prob (\<Inter>j\<in>I. if j \<in> J then A j else space M) = (\<Prod>j\<in>I. prob (if j \<in> J then A j else space M))

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prob (\<Inter>j\<in>I. if j \<in> J then A j else space M) = (\<Prod>j\<in>I. prob (if j \<in> J then A j else space M))

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
have "\<dots> = (\<Prod>j\<in>J. prob (A j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>j\<in>I. prob (if j \<in> J then A j else space M)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
unfolding if_distrib prod.If_cases[OF \<open>finite I\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>j\<in>I \<inter> {j. j \<in> J}. prob (A j)) * (\<Prod>j\<in>I \<inter> - {j. j \<in> J}. prob (space M)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
using prob_space \<open>J \<subseteq> I\<close>
[PROOF STATE]
proof (prove)
using this:
prob (space M) = 1
J \<subseteq> I

goal (1 subgoal):
 1. (\<Prod>j\<in>I \<inter> {j. j \<in> J}. prob (A j)) * (\<Prod>j\<in>I \<inter> - {j. j \<in> J}. prob (space M)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
by (simp add: Int_absorb1 prod.neutral_const)
[PROOF STATE]
proof (state)
this:
(\<Prod>j\<in>I. prob (if j \<in> J then A j else space M)) = (\<Prod>j\<in>J. prob (A j))

goal (2 subgoals):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
 2. \<And>A J. \<lbrakk>J \<noteq> {}; J \<subseteq> I; finite J; \<forall>j\<in>J. A j \<in> F j\<rbrakk> \<Longrightarrow> prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>j\<in>J. prob (A j)) = prob (\<Inter> (A ` J))
[PROOF STEP]
show "prob (\<Inter>j\<in>J. A j) = (\<Prod>j\<in>J. prob (A j))"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>j\<in>J. prob (A j)) = prob (\<Inter> (A ` J))

goal (1 subgoal):
 1. prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
prob (\<Inter> (A ` J)) = (\<Prod>j\<in>J. prob (A j))

goal (1 subgoal):
 1. \<And>i. i \<in> I \<Longrightarrow> i \<in> I
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
indep_sets F I

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fixes a b c::ereal
  shows not_inftyI: "a < b \<Longrightarrow> b < c \<Longrightarrow> abs b \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; b < c\<rbrakk> \<Longrightarrow> \<bar>b\<bar> \<noteq> \<infinity>
[PROOF STEP]
by force


[STATEMENT]
lemma fres_bres_clop: "clop (\<lambda>x::'a::proto_quantale. (y \<leftarrow> x) \<rightarrow> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clop (\<lambda>x. (y \<leftarrow> x) \<rightarrow> y)
[PROOF STEP]
unfolding clop_def comp_def mono_def le_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. id x \<le> (y \<leftarrow> x) \<rightarrow> y) \<and> (\<forall>x ya. x \<le> ya \<longrightarrow> (y \<leftarrow> x) \<rightarrow> y \<le> (y \<leftarrow> ya) \<rightarrow> y) \<and> (\<forall>x. (y \<leftarrow> ((y \<leftarrow> x) \<rightarrow> y)) \<rightarrow> y \<le> (y \<leftarrow> x) \<rightarrow> y)
[PROOF STEP]
by (metis bres_anti bres_canc1 bres_galois_imp fres_anti fres_canc1 fres_galois id_apply)


[STATEMENT]
lemma comm_ring_ow: "class.comm_ring = comm_ring_ow UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.comm_ring = comm_ring_ow UNIV
[PROOF STEP]
unfolding
    class.comm_ring_def comm_ring_ow_def
    ab_group_add_ow comm_semiring_ow
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>plus zero minus uminus times. ab_group_add_ow UNIV plus zero minus uminus \<and> comm_semiring_ow UNIV plus times) = (\<lambda>plus zero minus uminus times. comm_semiring_ow UNIV plus times \<and> ab_group_add_ow UNIV plus zero minus uminus)
[PROOF STEP]
by (simp add: conj_commute)


[STATEMENT]
lemma observable_transition_unique :
  assumes "observable M"
      and "t \<in> transitions M"
    shows "\<exists>! t' \<in> transitions M . t_source t' = t_source t \<and>
                                    t_input t' = t_input t \<and>
                                    t_output t' = t_output t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!t'. t' \<in> FSM.transitions M \<and> t_source t' = t_source t \<and> t_input t' = t_input t \<and> t_output t' = t_output t
[PROOF STEP]
by (metis assms observable.elims(2) prod.expand)


[STATEMENT]
lemma star_iso: "x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> x\<^sup>\<star> \<le> y\<^sup>\<star>
[PROOF STEP]
by (metis less_eq_def star_subdist)


[STATEMENT]
lemma "filterlim (\<lambda>x::real. \<lfloor>x\<rfloor>) at_top at_top"
      "filterlim (\<lambda>x::real. \<lceil>x\<rceil>) at_top at_top"
      "filterlim (\<lambda>x::real. nat \<lfloor>x\<rfloor>) at_top at_top"
      "filterlim (\<lambda>x::real. nat \<lceil>x\<rceil>) at_top at_top"
      "filterlim (\<lambda>x::int. nat x) at_top at_top"
      "filterlim (\<lambda>x::int. nat x) at_top at_top"
      "filterlim (\<lambda>n::nat. real (n mod 42) + real n) at_top at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (filterlim floor at_top at_top &&& filterlim ceiling at_top at_top &&& LIM x at_top. nat \<lfloor>x\<rfloor> :> sequentially) &&& (LIM x at_top. nat \<lceil>x\<rceil> :> sequentially &&& filterlim nat sequentially at_top) &&& filterlim nat sequentially at_top &&& LIM n sequentially. real (n mod 42) + real n :> at_top
[PROOF STEP]
by real_asymp+


[STATEMENT]
lemma le_TC_succ: "x \<sqsubseteq> succ \<beta> \<longleftrightarrow> x \<sqsubseteq> \<beta> \<or> x = succ \<beta>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<sqsubseteq> ZFC_in_HOL.succ \<beta>) = (x \<sqsubseteq> \<beta> \<or> x = ZFC_in_HOL.succ \<beta>)
[PROOF STEP]
by (simp add: le_TC_def less_TC_succ)


[STATEMENT]
lemma l9_18:
  assumes "Col X Y P" and
    "Col A B P"
  shows "X Y TS A B \<longleftrightarrow> (Bet A P B \<and> \<not> Col X Y A \<and> \<not> Col X Y B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X Y TS A B) = (Bet A P B \<and> \<not> Col X Y A \<and> \<not> Col X Y B)
[PROOF STEP]
using l9_18_R1 l9_18_R2 assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Col ?X ?Y ?P; Col ?A ?B ?P; ?X ?Y TS ?A ?B\<rbrakk> \<Longrightarrow> Bet ?A ?P ?B \<and> \<not> Col ?X ?Y ?A \<and> \<not> Col ?X ?Y ?B
\<lbrakk>Col ?X ?Y ?P; Col ?A ?B ?P; Bet ?A ?P ?B; \<not> Col ?X ?Y ?A; \<not> Col ?X ?Y ?B\<rbrakk> \<Longrightarrow> ?X ?Y TS ?A ?B
Col X Y P
Col A B P

goal (1 subgoal):
 1. (X Y TS A B) = (Bet A P B \<and> \<not> Col X Y A \<and> \<not> Col X Y B)
[PROOF STEP]
by blast


[STATEMENT]
lemma lm019:
  "converse ` injectionsUniverse = injectionsUniverse"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. converse ` injectionsUniverse = injectionsUniverse
[PROOF STEP]
by auto


[STATEMENT]
lemma wqo_on_hom:
  assumes "transp_on Q (h ` A)"
    and "\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q (h x) (h y)"
    and "wqo_on P A"
  shows "wqo_on Q (h ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wqo_on Q (h ` A)
[PROOF STEP]
using assms and almost_full_on_hom [of A P Q h]
[PROOF STATE]
proof (prove)
using this:
transp_on Q (h ` A)
\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q (h x) (h y)
wqo_on P A
\<lbrakk>\<And>x y. \<lbrakk>x \<in> A; y \<in> A; P x y\<rbrakk> \<Longrightarrow> Q (h x) (h y); almost_full_on P A\<rbrakk> \<Longrightarrow> almost_full_on Q (h ` A)

goal (1 subgoal):
 1. wqo_on Q (h ` A)
[PROOF STEP]
unfolding wqo_on_def
[PROOF STATE]
proof (prove)
using this:
transp_on Q (h ` A)
\<forall>x\<in>A. \<forall>y\<in>A. P x y \<longrightarrow> Q (h x) (h y)
transp_on P A \<and> almost_full_on P A
\<lbrakk>\<And>x y. \<lbrakk>x \<in> A; y \<in> A; P x y\<rbrakk> \<Longrightarrow> Q (h x) (h y); almost_full_on P A\<rbrakk> \<Longrightarrow> almost_full_on Q (h ` A)

goal (1 subgoal):
 1. transp_on Q (h ` A) \<and> almost_full_on Q (h ` A)
[PROOF STEP]
by blast


[STATEMENT]
lemma mset_merge: "mset_heap (merge h1 h2) = mset_heap h1 + mset_heap h2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mset_heap (merge h1 h2) = mset_heap h1 + mset_heap h2
[PROOF STEP]
by(induction h1 h2 rule: merge.induct)(auto simp: add_ac)


[STATEMENT]
lemma conjugation_multl: "x\<cdot>y \<sqinter> z = \<bottom> \<longleftrightarrow> x \<sqinter> (z \<lhd> y) = \<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> y \<sqinter> z = \<bottom>) = (x \<sqinter> (z \<lhd> y) = \<bottom>)
[PROOF STEP]
by (metis conjugate_l_def double_compl le_iff_inf_bot resl_galois)