[STATEMENT]
lemma avl_delete_max:
  assumes "avl x" and "x \<noteq> ET"
  shows "avl (snd (delete_max x))" "height x = height(snd (delete_max x)) \<or>
         height x = height(snd (delete_max x)) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. avl (snd (delete_max x)) &&& height x = height (snd (delete_max x)) \<or> height x = height (snd (delete_max x)) + 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
avl x
x \<noteq> ET

goal (1 subgoal):
 1. avl (snd (delete_max x)) &&& height x = height (snd (delete_max x)) \<or> height x = height (snd (delete_max x)) + 1
[PROOF STEP]
proof (induct x rule: delete_max_induct)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l (MKT v va vb vc) h)))
 4. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 6. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
case (MKT n l rn rl rr rh h)
[PROOF STATE]
proof (state)
this:
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1

goal (6 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l (MKT v va vb vc) h)))
 4. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 6. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET

goal (6 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l (MKT v va vb vc) h)))
 4. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 6. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
with MKT
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET
[PROOF STEP]
have "avl l" "avl (snd (delete_max (MKT rn rl rr rh)))"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET

goal (1 subgoal):
 1. avl l &&& avl (snd (delete_max (MKT rn rl rr rh)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
avl l
avl (snd (delete_max (MKT rn rl rr rh)))

goal (6 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l (MKT v va vb vc) h)))
 4. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 6. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
with 1 MKT
[PROOF STATE]
proof (chain)
picking this:
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1
avl l
avl (snd (delete_max (MKT rn rl rr rh)))
[PROOF STEP]
have "avl (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh))))"
[PROOF STATE]
proof (prove)
using this:
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1
avl l
avl (snd (delete_max (MKT rn rl rr rh)))

goal (1 subgoal):
 1. avl (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh))))
[PROOF STEP]
by (intro avl_mkt_bal_l) fastforce+
[PROOF STATE]
proof (state)
this:
avl (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh))))

goal (6 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l (MKT v va vb vc) h)))
 4. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 6. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
avl (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh))))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
avl (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh))))

goal (1 subgoal):
 1. avl (snd (delete_max (MKT n l (MKT rn rl rr rh) h)))
[PROOF STEP]
by (auto simp: height_mkt_bal_l height_mkt_bal_l2
      linorder_class.max.absorb1 linorder_class.max.absorb2
      split:prod.split simp del:mkt_bal_l.simps)
[PROOF STATE]
proof (state)
this:
avl (snd (delete_max (MKT n l (MKT rn rl rr rh) h)))

goal (5 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
case (MKT n l rn rl rr rh h)
[PROOF STATE]
proof (state)
this:
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1

goal (5 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET

goal (5 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
let ?r = "MKT rn rl rr rh"
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
let ?r' = "snd (delete_max ?r)"
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
from \<open>avl x\<close> MKT 2
[PROOF STATE]
proof (chain)
picking this:
avl x
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET
[PROOF STEP]
have "avl l" and "avl ?r"
[PROOF STATE]
proof (prove)
using this:
avl x
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET

goal (1 subgoal):
 1. avl l &&& avl (MKT rn rl rr rh)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
avl l
avl (MKT rn rl rr rh)

goal (5 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<And>n l v va vb vc h. \<lbrakk>\<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT v va vb vc))); \<lbrakk>avl (MKT v va vb vc); MKT v va vb vc \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) \<or> height (MKT v va vb vc) = height (snd (delete_max (MKT v va vb vc))) + 1; avl (MKT n l (MKT v va vb vc) h); MKT n l (MKT v va vb vc) h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) \<or> height (MKT n l (MKT v va vb vc) h) = height (snd (delete_max (MKT n l (MKT v va vb vc) h))) + 1
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 5. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
avl l
avl (MKT rn rl rr rh)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
avl l
avl (MKT rn rl rr rh)

goal (1 subgoal):
 1. height (MKT n l (MKT rn rl rr rh) h) = height (snd (delete_max (MKT n l (MKT rn rl rr rh) h))) \<or> height (MKT n l (MKT rn rl rr rh) h) = height (snd (delete_max (MKT n l (MKT rn rl rr rh) h))) + 1
[PROOF STEP]
using MKT 2 height_mkt_bal_l[of l ?r' n] height_mkt_bal_l2[of l ?r' n]
[PROOF STATE]
proof (prove)
using this:
avl l
avl (MKT rn rl rr rh)
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT rn rl rr rh)))
\<lbrakk>avl (MKT rn rl rr rh); MKT rn rl rr rh \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) \<or> height (MKT rn rl rr rh) = height (snd (delete_max (MKT rn rl rr rh))) + 1
avl (MKT n l (MKT rn rl rr rh) h)
MKT n l (MKT rn rl rr rh) h \<noteq> ET
\<lbrakk>height l = height (snd (delete_max (MKT rn rl rr rh))) + 2; avl l; avl (snd (delete_max (MKT rn rl rr rh)))\<rbrakk> \<Longrightarrow> height (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh)))) = height (snd (delete_max (MKT rn rl rr rh))) + 2 \<or> height (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh)))) = height (snd (delete_max (MKT rn rl rr rh))) + 3
\<lbrakk>avl l; avl (snd (delete_max (MKT rn rl rr rh))); height l \<noteq> height (snd (delete_max (MKT rn rl rr rh))) + 2\<rbrakk> \<Longrightarrow> height (mkt_bal_l n l (snd (delete_max (MKT rn rl rr rh)))) = 1 + max (height l) (height (snd (delete_max (MKT rn rl rr rh))))

goal (1 subgoal):
 1. height (MKT n l (MKT rn rl rr rh) h) = height (snd (delete_max (MKT n l (MKT rn rl rr rh) h))) \<or> height (MKT n l (MKT rn rl rr rh) h) = height (snd (delete_max (MKT n l (MKT rn rl rr rh) h))) + 1
[PROOF STEP]
apply (auto split:prod.splits simp del:avl.simps mkt_bal_l.simps)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2. \<lbrakk>avl l; avl (MKT rn rl rr rh); avl x2; avl (MKT n l (MKT rn rl rr rh) h); height l = Suc (Suc (height x2)) \<Longrightarrow> height (mkt_bal_l n l x2) = Suc (Suc (height x2)) \<or> height (mkt_bal_l n l x2) = height x2 + 3; height l \<noteq> Suc (Suc (height x2)) \<Longrightarrow> height (mkt_bal_l n l x2) = Suc (max (height l) (height x2)); delete_max (MKT rn rl rr rh) = (x1, x2); max (height l) (height x2) \<noteq> height (mkt_bal_l n l x2); Suc (max (height rl) (height rr)) = height x2\<rbrakk> \<Longrightarrow> Suc (max (height l) (height x2)) = height (mkt_bal_l n l x2)
 2. \<And>x1 x2. \<lbrakk>avl l; avl (MKT rn rl rr rh); avl x2; avl (MKT n l (MKT rn rl rr rh) h); height l = Suc (Suc (height x2)) \<Longrightarrow> height (mkt_bal_l n l x2) = Suc (Suc (height x2)) \<or> height (mkt_bal_l n l x2) = height x2 + 3; height l \<noteq> Suc (Suc (height x2)) \<Longrightarrow> height (mkt_bal_l n l x2) = Suc (max (height l) (height x2)); delete_max (MKT rn rl rr rh) = (x1, x2); max (height l) (Suc (height x2)) \<noteq> height (mkt_bal_l n l x2); max (height rl) (height rr) = height x2\<rbrakk> \<Longrightarrow> Suc (max (height l) (Suc (height x2))) = height (mkt_bal_l n l x2)
[PROOF STEP]
by arith+
[PROOF STATE]
proof (state)
this:
height (MKT n l (MKT rn rl rr rh) h) = height (snd (delete_max (MKT n l (MKT rn rl rr rh) h))) \<or> height (MKT n l (MKT rn rl rr rh) h) = height (snd (delete_max (MKT n l (MKT rn rl rr rh) h))) + 1

goal (4 subgoals):
 1. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max (MKT n l ET h)))
 2. \<And>n l h. \<lbrakk>avl (MKT n l ET h); MKT n l ET h \<noteq> ET\<rbrakk> \<Longrightarrow> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) \<or> height (MKT n l ET h) = height (snd (delete_max (MKT n l ET h))) + 1
 3. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> avl (snd (delete_max ET))
 4. \<lbrakk>avl ET; ET \<noteq> ET\<rbrakk> \<Longrightarrow> height ET = height (snd (delete_max ET)) \<or> height ET = height (snd (delete_max ET)) + 1
[PROOF STEP]
qed auto


[STATEMENT]
lemma forest_delete_node: "forest (delete_node n G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. forest (delete_node n G)
[PROOF STEP]
using forest_subsets[OF delete_node_valid[OF valid_graph_axioms]]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>edges (delete_node ?v1 G) \<subseteq> E; nodes (delete_node ?v1 G) \<subseteq> V\<rbrakk> \<Longrightarrow> forest (delete_node ?v1 G)

goal (1 subgoal):
 1. forest (delete_node n G)
[PROOF STEP]
unfolding delete_node_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>edges \<lparr>nodes = V - {?v1}, edges = E \<inter> (- {?v1}) \<times> UNIV \<times> - {?v1}\<rparr> \<subseteq> E; nodes \<lparr>nodes = V - {?v1}, edges = E \<inter> (- {?v1}) \<times> UNIV \<times> - {?v1}\<rparr> \<subseteq> V\<rbrakk> \<Longrightarrow> forest \<lparr>nodes = V - {?v1}, edges = E \<inter> (- {?v1}) \<times> UNIV \<times> - {?v1}\<rparr>

goal (1 subgoal):
 1. forest \<lparr>nodes = V - {n}, edges = E \<inter> (- {n}) \<times> UNIV \<times> - {n}\<rparr>
[PROOF STEP]
by auto


[STATEMENT]
lemma fInf_subdistl_var:
  fixes f :: "'a::complete_lattice \<Rightarrow> 'b::complete_lattice"
  shows "mono f \<Longrightarrow> f \<circ> \<Sqinter>G \<le> (\<Sqinter>g \<in> G. f \<circ> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mono f \<Longrightarrow> f \<circ> \<Sqinter> G \<le> \<Sqinter> ((\<circ>) f ` G)
[PROOF STEP]
by (simp add: fun_isol mono_Inf)


[STATEMENT]
lemma map_spmf_mono [partial_function_mono]: "mono_spmf B \<Longrightarrow> mono_spmf (\<lambda>g. map_spmf f (B g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone spmf.le_fun (ord_spmf (=)) B \<Longrightarrow> monotone spmf.le_fun (ord_spmf (=)) (\<lambda>g. map_spmf f (B g))
[PROOF STEP]
unfolding map_spmf_conv_bind_spmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monotone spmf.le_fun (ord_spmf (=)) B \<Longrightarrow> monotone spmf.le_fun (ord_spmf (=)) (\<lambda>g. B g \<bind> (\<lambda>x. return_spmf (f x)))
[PROOF STEP]
by(rule bind_spmf_mono) simp_all


[STATEMENT]
lemma vec_coeff_append2:
  "i \<in> {dim_vec a..<dim_vec (a@\<^sub>vb)} \<Longrightarrow> coeff (vec_to_lpoly (a@\<^sub>vb)) i = b$(i-dim_vec a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> {dim_vec a..<dim_vec (a @\<^sub>v b)} \<Longrightarrow> Abstract_Linear_Poly.coeff (vec_to_lpoly (a @\<^sub>v b)) i = b $ (i - dim_vec a)
[PROOF STEP]
by (metis atLeastLessThan_iff index_append_vec(1) index_append_vec(2) leD vec_to_lin_poly_coeff_access)


[STATEMENT]
lemma separation_t1: "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<noteq> y) = (\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U)
[PROOF STEP]
using t1_space[of x y]
[PROOF STATE]
proof (prove)
using this:
x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> x \<in> U \<and> y \<notin> U

goal (1 subgoal):
 1. (x \<noteq> y) = (\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U)
[PROOF STEP]
by blast


[STATEMENT]
lemma nn_integral_finite_imp_abs_sumable_on:
  fixes f :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  assumes "nn_integral (count_space A) (\<lambda>x. norm (f x)) < \<infinity>"
  shows   "f abs_summable_on A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f abs_summable_on A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>count_space A < \<infinity>

goal (1 subgoal):
 1. f abs_summable_on A
[PROOF STEP]
unfolding abs_summable_on_def integrable_iff_bounded
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>count_space A < \<infinity>

goal (1 subgoal):
 1. f \<in> borel_measurable (count_space A) \<and> \<integral>\<^sup>+ x. ennreal (norm (f x)) \<partial>count_space A < \<infinity>
[PROOF STEP]
by auto


[STATEMENT]
lemma r01_r01_to_r01_binary_nth:
  assumes "0 < r1" "r1 < 1"
      and "0 < r2" "r2 < 1"
    shows "r01_binary_expansion' r1 n = r01_binary_expansion' (r01_r01_to_r01 (r1,r2)) (2*n) \<and>
           r01_binary_expansion' r2 n = r01_binary_expansion' (r01_r01_to_r01 (r1,r2)) (2*n + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r01_binary_expansion' r1 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n) \<and> r01_binary_expansion' r2 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r01_binary_expansion' r1 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n) \<and> r01_binary_expansion' r2 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)
[PROOF STEP]
have "\<And>n. r01_binary_expansion' (r01_r01_to_r01 (r1,r2)) n = r01_r01_to_r01' (r1,r2) n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) n = r01_r01_to_r01' (r1, r2) n
[PROOF STEP]
using r01_r01_to_r01_def'[of r1 r2] biexp01_well_formed_an[of "r01_r01_to_r01' (r1,r2)"] r01_r01_to_r01'_well_formed[of r1 r2] assms
[PROOF STATE]
proof (prove)
using this:
r01_r01_to_r01 (r1, r2) = (\<Sum>n. real (r01_r01_to_r01' (r1, r2) n) * (1 / 2) ^ (n + 1))
biexp01_well_formed (r01_r01_to_r01' (r1, r2)) \<Longrightarrow> r01_binary_expansion' (\<Sum>m. real (r01_r01_to_r01' (r1, r2) m) * (1 / 2) ^ Suc m) ?n = r01_r01_to_r01' (r1, r2) ?n
\<lbrakk>0 < r1; r1 < 1; 0 < r2; r2 < 1\<rbrakk> \<Longrightarrow> biexp01_well_formed (r01_r01_to_r01' (r1, r2))
0 < r1
r1 < 1
0 < r2
r2 < 1

goal (1 subgoal):
 1. \<And>n. r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) n = r01_r01_to_r01' (r1, r2) n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) ?n = r01_r01_to_r01' (r1, r2) ?n

goal (1 subgoal):
 1. r01_binary_expansion' r1 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n) \<and> r01_binary_expansion' r2 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) ?n = r01_r01_to_r01' (r1, r2) ?n

goal (1 subgoal):
 1. r01_binary_expansion' r1 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n) \<and> r01_binary_expansion' r2 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)
[PROOF STEP]
by(simp add: r01_r01_to_r01'_def)
[PROOF STATE]
proof (state)
this:
r01_binary_expansion' r1 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n) \<and> r01_binary_expansion' r2 n = r01_binary_expansion' (r01_r01_to_r01 (r1, r2)) (2 * n + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sinh_real_pos_iff [simp]: "sinh (x :: real) > 0 \<longleftrightarrow> x > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < sinh x) = (0 < x)
[PROOF STEP]
by (simp add: sinh_def)


[STATEMENT]
lemma ListSum_compl1:
  "(\<Sum>\<^bsub>x \<in> [x\<leftarrow>xs. \<not> P x]\<^esub> f x) + (\<Sum>\<^bsub>x \<in> [x\<leftarrow>xs. P x]\<^esub> f x) = (\<Sum>\<^bsub>x \<in> xs\<^esub> (f x::nat))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ListSum (filter (\<lambda>x. \<not> P x) xs) f + ListSum (filter P xs) f = ListSum xs f
[PROOF STEP]
by (induct xs) simp_all


[STATEMENT]
lemma Hausdorff_space_finite_topspace:
   "Hausdorff_space X \<Longrightarrow> X derived_set_of (topspace X) = {} \<and> compact_space X \<longleftrightarrow> finite(topspace X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hausdorff_space X \<Longrightarrow> (X derived_set_of topspace X = {} \<and> compact_space X) = finite (topspace X)
[PROOF STEP]
using derived_set_of_finite discrete_compact_space_eq_finite
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Hausdorff_space ?X; finite ?S\<rbrakk> \<Longrightarrow> ?X derived_set_of ?S = {}
?X derived_set_of topspace ?X = {} \<Longrightarrow> compact_space ?X = finite (topspace ?X)

goal (1 subgoal):
 1. Hausdorff_space X \<Longrightarrow> (X derived_set_of topspace X = {} \<and> compact_space X) = finite (topspace X)
[PROOF STEP]
by auto


[STATEMENT]
lemma less_mset_zmsetE:
  assumes "M < N"
  obtains A B C where
    "M = zmset_of A + C" and "N = zmset_of B + C" and "A < B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A C B. \<lbrakk>M = zmset_of A + C; N = zmset_of B + C; A < B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis add_less_imp_less_right assms decompose_zmset_of2 zmset_of_less)


[STATEMENT]
lemma maddux_3_3[simp]:
  "-(x \<squnion> y) \<squnion> -(x \<squnion> -y) = -x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x \<squnion> y) \<squnion> - (x \<squnion> - y) = - x
[PROOF STEP]
by (metis double_complement_dist_sup sba1_double_complement sba2_commutative sub_complement)


[STATEMENT]
lemma space_prob_algebra: "space (prob_algebra M) = {N. sets N = sets M \<and> prob_space N}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (prob_algebra M) = {N. sets N = sets M \<and> prob_space N}
[PROOF STEP]
unfolding prob_algebra_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (restrict_space (subprob_algebra M) (Collect prob_space)) = {N. sets N = sets M \<and> prob_space N}
[PROOF STEP]
by (auto simp: space_subprob_algebra space_restrict_space prob_space_imp_subprob_space)


[STATEMENT]
theorem Borho_Rule_breeders_Amicable:
  fixes a u r c q x :: nat
  assumes "x \<ge> 1" and "a \<ge> 1" and "u \<ge> 1"
      and "prime r" and "prime c" and  "prime q" and "r \<noteq> c"
      and "Esigma (a*u) = a*u + a*x" "Esigma (a*u) = (Esigma a)*(x+1)" and "gcd a (r * c) =1"
      and "gcd (a*u) q = 1" and "r * c = x+u + x*u +r*x +x*c" and "q = r+c+u"
  shows "(a*u*q) Amic (a*r*c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
have a: "Esigma(a*u*q) = Esigma(a*u)*Esigma(q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * u) * Esigma q
[PROOF STEP]
using assms gcd_Esigma_mult
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u
gcd ?m ?n = 1 \<Longrightarrow> Esigma (?m * ?n) = Esigma ?m * Esigma ?n

goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * u) * Esigma q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = Esigma (a * u) * Esigma q

goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
have a1: "Esigma(a*r*c) = (Esigma a)*Esigma(r*c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * r * c) = Esigma a * Esigma (r * c)
[PROOF STEP]
using assms gcd_Esigma_mult
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u
gcd ?m ?n = 1 \<Longrightarrow> Esigma (?m * ?n) = Esigma ?m * Esigma ?n

goal (1 subgoal):
 1. Esigma (a * r * c) = Esigma a * Esigma (r * c)
[PROOF STEP]
by (metis mult.assoc mult.commute)
[PROOF STATE]
proof (state)
this:
Esigma (a * r * c) = Esigma a * Esigma (r * c)

goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
have a2: "Esigma(a*r*c) = (Esigma a)*(r+1)*(c+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * r * c) = Esigma a * (r + 1) * (c + 1)
[PROOF STEP]
using a1 assms
[PROOF STATE]
proof (prove)
using this:
Esigma (a * r * c) = Esigma a * Esigma (r * c)
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u

goal (1 subgoal):
 1. Esigma (a * r * c) = Esigma a * (r + 1) * (c + 1)
[PROOF STEP]
by (metis mult.commute mult.left_commute prime_Esigma_mult prime_sum_div)
[PROOF STATE]
proof (state)
this:
Esigma (a * r * c) = Esigma a * (r + 1) * (c + 1)

goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
have A: "Esigma (a*u*q) = Esigma(a*r*c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * r * c)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * r * c)
[PROOF STEP]
have d: "Esigma(a)*(r+1)*(c+1) = Esigma(a*u)*(q+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)
[PROOF STEP]
have d1: "(r+1)*(c+1) =(x+1)*(q+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
have ce: "(r+1)*(c+1) = r*c+r+c+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r + 1) * (c + 1) = r * c + r + c + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(r + 1) * (c + 1) = r * c + r + c + 1

goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
have ce1: "(r+1)*(c+1) = x+u+x*u+r*x+x*c+r+c+1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r + 1) * (c + 1) = x + u + x * u + r * x + x * c + r + c + 1
[PROOF STEP]
using ce assms
[PROOF STATE]
proof (prove)
using this:
(r + 1) * (c + 1) = r * c + r + c + 1
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u

goal (1 subgoal):
 1. (r + 1) * (c + 1) = x + u + x * u + r * x + x * c + r + c + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(r + 1) * (c + 1) = x + u + x * u + r * x + x * c + r + c + 1

goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
have de: "(x+1)*(q+1) = x*q +1+x+q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + 1) * (q + 1) = x * q + 1 + x + q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x + 1) * (q + 1) = x * q + 1 + x + q

goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
have de1: "(x+1)*(q+1) = x*(r+c+u)+1+x+ r+c+u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x + 1) * (q + 1) = x * (r + c + u) + 1 + x + r + c + u
[PROOF STEP]
using assms de
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u
(x + 1) * (q + 1) = x * q + 1 + x + q

goal (1 subgoal):
 1. (x + 1) * (q + 1) = x * (r + c + u) + 1 + x + r + c + u
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(x + 1) * (q + 1) = x * (r + c + u) + 1 + x + r + c + u

goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
using de1 ce1 add_mult_distrib2
[PROOF STATE]
proof (prove)
using this:
(x + 1) * (q + 1) = x * (r + c + u) + 1 + x + r + c + u
(r + 1) * (c + 1) = x + u + x * u + r * x + x * c + r + c + 1
?k * (?m + ?n) = ?k * ?m + ?k * ?n

goal (1 subgoal):
 1. (r + 1) * (c + 1) = (x + 1) * (q + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(r + 1) * (c + 1) = (x + 1) * (q + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(r + 1) * (c + 1) = (x + 1) * (q + 1)

goal (1 subgoal):
 1. Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)
[PROOF STEP]
using d1 assms
[PROOF STATE]
proof (prove)
using this:
(r + 1) * (c + 1) = (x + 1) * (q + 1)
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u

goal (1 subgoal):
 1. Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)
[PROOF STEP]
by (metis semiring_normalization_rules(18))
[PROOF STATE]
proof (state)
this:
Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)

goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * r * c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * r * c)
[PROOF STEP]
using d a2
[PROOF STATE]
proof (prove)
using this:
Esigma a * (r + 1) * (c + 1) = Esigma (a * u) * (q + 1)
Esigma (a * r * c) = Esigma a * (r + 1) * (c + 1)

goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * r * c)
[PROOF STEP]
by (simp add: a assms(6) prime_sum_div)
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = Esigma (a * r * c)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = Esigma (a * r * c)

goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
have B: "Esigma (a*u*q) = a*u*q + a*r*c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * r * c
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * r * c
[PROOF STEP]
have i: "Esigma (a*u*q) = Esigma(a*u)*(q+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * u) * (q + 1)
[PROOF STEP]
using a assms
[PROOF STATE]
proof (prove)
using this:
Esigma (a * u * q) = Esigma (a * u) * Esigma q
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u

goal (1 subgoal):
 1. Esigma (a * u * q) = Esigma (a * u) * (q + 1)
[PROOF STEP]
by (simp add: prime_sum_div)
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = Esigma (a * u) * (q + 1)

goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * r * c
[PROOF STEP]
have ii:"Esigma (a*u*q) = (a*u+ a*x)*(q+1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = (a * u + a * x) * (q + 1)
[PROOF STEP]
using assms i
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u
Esigma (a * u * q) = Esigma (a * u) * (q + 1)

goal (1 subgoal):
 1. Esigma (a * u * q) = (a * u + a * x) * (q + 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = (a * u + a * x) * (q + 1)

goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * r * c
[PROOF STEP]
have iii:"Esigma (a*u*q) = a*u*q +a*u+ a*x*q+ a*x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * u + a * x * q + a * x
[PROOF STEP]
using assms ii add_mult_distrib
[PROOF STATE]
proof (prove)
using this:
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u
Esigma (a * u * q) = (a * u + a * x) * (q + 1)
(?m + ?n) * ?k = ?m * ?k + ?n * ?k

goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * u + a * x * q + a * x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = a * u * q + a * u + a * x * q + a * x

goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * r * c
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * r * c
[PROOF STEP]
using iii assms
[PROOF STATE]
proof (prove)
using this:
Esigma (a * u * q) = a * u * q + a * u + a * x * q + a * x
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u

goal (1 subgoal):
 1. Esigma (a * u * q) = a * u * q + a * r * c
[PROOF STEP]
by (smt distrib_left semiring_normalization_rules)
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = a * u * q + a * r * c

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Esigma (a * u * q) = a * u * q + a * r * c

goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
using A B assms Amicable_pair_equiv_def_conv assms  One_nat_def one_le_mult_iff
[PROOF STATE]
proof (prove)
using this:
Esigma (a * u * q) = Esigma (a * r * c)
Esigma (a * u * q) = a * u * q + a * r * c
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u
\<lbrakk>1 \<le> ?m; 1 \<le> ?n; Esigma ?m = Esigma ?n \<and> Esigma ?m = ?m + ?n\<rbrakk> \<Longrightarrow> ?m Amic ?n
1 \<le> x
1 \<le> a
1 \<le> u
prime r
prime c
prime q
r \<noteq> c
Esigma (a * u) = a * u + a * x
Esigma (a * u) = Esigma a * (x + 1)
gcd a (r * c) = 1
gcd (a * u) q = 1
r * c = x + u + x * u + r * x + x * c
q = r + c + u
1 = Suc 0
(Suc 0 \<le> ?m * ?n) = (Suc 0 \<le> ?m \<and> Suc 0 \<le> ?n)

goal (1 subgoal):
 1. (a * u * q) Amic (a * r * c)
[PROOF STEP]
by (smt prime_ge_1_nat)
[PROOF STATE]
proof (state)
this:
(a * u * q) Amic (a * r * c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma floorlog_mono: "x \<le> y \<Longrightarrow> floorlog b x \<le> floorlog b y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> y \<Longrightarrow> floorlog b x \<le> floorlog b y
[PROOF STEP]
by (auto simp: floorlog_def floor_mono nat_mono)


[STATEMENT]
lemma integral_measure_pmf_real:
  assumes [simp]: "finite A" and "\<And>a. a \<in> set_pmf M \<Longrightarrow> f a \<noteq> 0 \<Longrightarrow> a \<in> A"
  shows "(\<integral>x. f x \<partial>measure_pmf M) = (\<Sum>a\<in>A. f a * pmf M a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
have "(\<integral>x. f x \<partial>measure_pmf M) = (\<integral>x. f x * indicator A x \<partial>measure_pmf M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation M f = measure_pmf.expectation M (\<lambda>x. f x * indicat_real A x)
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> set_pmf M; f ?a \<noteq> 0\<rbrakk> \<Longrightarrow> ?a \<in> A

goal (1 subgoal):
 1. measure_pmf.expectation M f = measure_pmf.expectation M (\<lambda>x. f x * indicat_real A x)
[PROOF STEP]
by (intro integral_cong_AE) (auto split: split_indicator simp: AE_measure_pmf_iff)
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation M f = measure_pmf.expectation M (\<lambda>x. f x * indicat_real A x)

goal (1 subgoal):
 1. measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation M f = measure_pmf.expectation M (\<lambda>x. f x * indicat_real A x)

goal (1 subgoal):
 1. measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
have "\<dots> = (\<Sum>a\<in>A. f a * pmf M a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.expectation M (\<lambda>x. f x * indicat_real A x) = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
by (subst integral_indicator_finite_real)
       (auto simp: measure_def emeasure_measure_pmf_finite pmf_nonneg)
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation M (\<lambda>x. f x * indicat_real A x) = (\<Sum>a\<in>A. f a * pmf M a)

goal (1 subgoal):
 1. measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)

goal (1 subgoal):
 1. measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
measure_pmf.expectation M f = (\<Sum>a\<in>A. f a * pmf M a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma take_several_pers: assumes "period w n" and "m*n \<le> \<^bold>|w\<^bold>|"
  shows "(take n w)\<^sup>@m = take (m*n) w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n w \<^sup>@ m = take (m * n) w
[PROOF STEP]
proof (cases "m = 0", simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> take n w \<^sup>@ m = take (m * n) w
[PROOF STEP]
assume "m \<noteq> 0"
[PROOF STATE]
proof (state)
this:
m \<noteq> 0

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> take n w \<^sup>@ m = take (m * n) w
[PROOF STEP]
have "\<^bold>|(take n w)\<^sup>@m\<^bold>| = m*n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<^bold>|take n w \<^sup>@ m\<^bold>| = m * n
[PROOF STEP]
unfolding pow_len nat_prod_le[OF \<open>m \<noteq> 0\<close> \<open>m*n \<le> \<^bold>|w\<^bold>|\<close>, THEN take_len]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * n = m * n
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<^bold>|take n w \<^sup>@ m\<^bold>| = m * n

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> take n w \<^sup>@ m = take (m * n) w
[PROOF STEP]
have "(take n w)\<^sup>@m \<le>p w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n w \<^sup>@ m \<le>p w
[PROOF STEP]
using  \<open>period w n\<close>[unfolded period_def, THEN  per_exp[of w "take n w" m], THEN
        ruler_le[of "take n w\<^sup>@m" "take n w\<^sup>@m \<cdot> w" w, OF triv_pref], OF  \<open>m * n \<le> \<^bold>|w\<^bold>|\<close>[folded \<open>\<^bold>|take n w\<^sup>@m\<^bold>| = m * n\<close>]]
[PROOF STATE]
proof (prove)
using this:
take n w \<^sup>@ m \<le>p w

goal (1 subgoal):
 1. take n w \<^sup>@ m \<le>p w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
take n w \<^sup>@ m \<le>p w

goal (1 subgoal):
 1. m \<noteq> 0 \<Longrightarrow> take n w \<^sup>@ m = take (m * n) w
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take n w \<^sup>@ m = take (m * n) w
[PROOF STEP]
using pref_take[OF \<open>take n w\<^sup>@m \<le>p w\<close>, unfolded  \<open>\<^bold>|take n w\<^sup>@m\<^bold>| = m * n\<close>, symmetric]
[PROOF STATE]
proof (prove)
using this:
take n w \<^sup>@ m = take (m * n) w

goal (1 subgoal):
 1. take n w \<^sup>@ m = take (m * n) w
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
take n w \<^sup>@ m = take (m * n) w

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Zfun_diff: "Zfun f F \<Longrightarrow> Zfun g F \<Longrightarrow> Zfun (\<lambda>x. f x - g x) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Zfun f F; Zfun g F\<rbrakk> \<Longrightarrow> Zfun (\<lambda>x. f x - g x) F
[PROOF STEP]
using Zfun_add [of f F "\<lambda>x. - g x"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Zfun f F; Zfun (\<lambda>x. - g x) F\<rbrakk> \<Longrightarrow> Zfun (\<lambda>x. f x + - g x) F

goal (1 subgoal):
 1. \<lbrakk>Zfun f F; Zfun g F\<rbrakk> \<Longrightarrow> Zfun (\<lambda>x. f x - g x) F
[PROOF STEP]
by (simp add: Zfun_minus)


[STATEMENT]
lemma strict_monoI_comp[intro]:
      assumes "strict_mono f" "strict_mono g"
      shows "strict_mono (f \<circ> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. strict_mono (f \<circ> g)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
strict_mono f
strict_mono g

goal (1 subgoal):
 1. strict_mono (f \<circ> g)
[PROOF STEP]
by (intro strict_monoI, auto dest: strict_monoD)


[STATEMENT]
lemma mult_inf_left [simp]:
  assumes "z \<noteq> 0\<^sub>h"
  shows "\<infinity>\<^sub>h *\<^sub>h z = \<infinity>\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<infinity>\<^sub>h *\<^sub>h z = \<infinity>\<^sub>h
[PROOF STEP]
using mult_inf_right[OF assms]
[PROOF STATE]
proof (prove)
using this:
z *\<^sub>h \<infinity>\<^sub>h = \<infinity>\<^sub>h

goal (1 subgoal):
 1. \<infinity>\<^sub>h *\<^sub>h z = \<infinity>\<^sub>h
[PROOF STEP]
by (simp add: mult_commute)


[STATEMENT]
lemma emeasure_subadditive_countably:
  assumes "range f \<subseteq> sets M"
  shows "emeasure M (\<Union>i. f i) \<le> (\<Sum>i. emeasure M (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
have "emeasure M (\<Union>i. f i) = emeasure M (\<Union>i. disjointed f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) = emeasure M (\<Union> (range (disjointed f)))
[PROOF STEP]
unfolding UN_disjointed_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) = emeasure M (\<Union> (range f))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range f)) = emeasure M (\<Union> (range (disjointed f)))

goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range f)) = emeasure M (\<Union> (range (disjointed f)))

goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
have "\<dots> = (\<Sum>i. emeasure M (disjointed f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union> (range (disjointed f))) = (\<Sum>i. emeasure M (disjointed f i))
[PROOF STEP]
using sets.range_disjointed_sets[OF assms] suminf_emeasure[of "disjointed f"]
[PROOF STATE]
proof (prove)
using this:
range (disjointed f) \<subseteq> sets M
\<lbrakk>range (disjointed f) \<subseteq> sets ?M; disjoint_family (disjointed f)\<rbrakk> \<Longrightarrow> (\<Sum>i. emeasure ?M (disjointed f i)) = emeasure ?M (\<Union> (range (disjointed f)))

goal (1 subgoal):
 1. emeasure M (\<Union> (range (disjointed f))) = (\<Sum>i. emeasure M (disjointed f i))
[PROOF STEP]
by (simp add:  disjoint_family_disjointed comp_def)
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range (disjointed f))) = (\<Sum>i. emeasure M (disjointed f i))

goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range (disjointed f))) = (\<Sum>i. emeasure M (disjointed f i))

goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
have "\<dots> \<le> (\<Sum>i. emeasure M (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i. emeasure M (disjointed f i)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
using sets.range_disjointed_sets[OF assms] assms
[PROOF STATE]
proof (prove)
using this:
range (disjointed f) \<subseteq> sets M
range f \<subseteq> sets M

goal (1 subgoal):
 1. (\<Sum>i. emeasure M (disjointed f i)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
by (auto intro!: suminf_le emeasure_mono disjointed_subset)
[PROOF STATE]
proof (state)
this:
(\<Sum>i. emeasure M (disjointed f i)) \<le> (\<Sum>i. emeasure M (f i))

goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))

goal (1 subgoal):
 1. emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union> (range f)) \<le> (\<Sum>i. emeasure M (f i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma elts_mult_\<omega>E:
  assumes "x \<in> elts (y * \<omega>)"
  obtains n where "n \<noteq> 0" "x \<in> elts (y * ord_of_nat n)" "\<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>n. \<lbrakk>n \<noteq> 0; x \<in> elts (y * ord_of_nat n); \<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>n. \<lbrakk>n \<noteq> 0; x \<in> elts (y * ord_of_nat n); \<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
obtain k where k:  "k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x \<in> elts (y * \<omega>)

goal (1 subgoal):
 1. (\<And>k. k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
apply (simp add: mult_Limit elts_\<omega>)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>k. 0 < k \<and> x \<in> elts (y * ord_of_nat k) \<Longrightarrow> thesis; (\<exists>xa. (\<exists>n. xa = ord_of_nat n) \<and> x \<in> elts (y * xa)) \<and> small ((*) y ` {\<alpha>. \<exists>n. \<alpha> = ord_of_nat n})\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (metis mult_eq_0_iff elts_0 ex_in_conv ord_of_eq_0_iff that)
[PROOF STATE]
proof (state)
this:
k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k)

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>n \<noteq> 0; x \<in> elts (y * ord_of_nat n); \<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define n where "n \<equiv> (LEAST k. k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k))"
[PROOF STATE]
proof (state)
this:
n \<equiv> LEAST k. k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k)

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>n \<noteq> 0; x \<in> elts (y * ord_of_nat n); \<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
show thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. thesis
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. ?n \<noteq> 0
 2. x \<in> elts (y * ord_of_nat ?n)
 3. \<And>m. m < ?n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)
[PROOF STEP]
show "n \<noteq> 0" "x \<in> elts (y * ord_of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> 0 &&& x \<in> elts (y * ord_of_nat n)
[PROOF STEP]
unfolding n_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LEAST k. k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k)) \<noteq> 0 &&& x \<in> elts (y * ord_of_nat (LEAST k. k \<noteq> 0 \<and> x \<in> elts (y * ord_of_nat k)))
[PROOF STEP]
by (metis (mono_tags, lifting) LeastI_ex k)+
[PROOF STATE]
proof (state)
this:
n \<noteq> 0
x \<in> elts (y * ord_of_nat n)

goal (1 subgoal):
 1. \<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)
[PROOF STEP]
show "\<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>m. m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat m)
[PROOF STEP]
by (metis (mono_tags, lifting) mult_eq_0_iff elts_0 empty_iff n_def not_less_Least ord_of_eq_0_iff)
[PROOF STATE]
proof (state)
this:
?m < n \<Longrightarrow> x \<notin> elts (y * ord_of_nat ?m)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma less_eq_list_antisym:
  fixes xs ys :: "'a list"
  shows "\<lbrakk> less_eq_list xs ys; less_eq_list ys xs \<rbrakk> \<Longrightarrow> xs = ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.less_eq_list xs ys; local.less_eq_list ys xs\<rbrakk> \<Longrightarrow> xs = ys
[PROOF STEP]
by (induct xs ys rule: less_eq_list.induct) (auto dest: less_eq_list_nil_inv)


[STATEMENT]
lemma l2product_rzero [simp]: "l2product S f(\<lambda>x. 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2product S f (\<lambda>x. 0) = 0
[PROOF STEP]
by (simp add: l2product_def)


[STATEMENT]
lemma sin_45_positive_intervals:
  "(sin (x + pi/4) > 0) = (x \<in> (\<Union>n::int. {-pi/4 + 2*pi*n <..< 3*pi/4 + 2*pi*n}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < sin (x + pi / 4)) = (x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x}))
[PROOF STEP]
proof (standard ; (elim UnionE rangeE | -))
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < sin (x + pi / 4) \<Longrightarrow> x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
 2. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
obtain y :: real and n :: int
    where "x = y + 2*pi*n" and "- pi \<le> y" and "y \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>y n. \<lbrakk>x = y + 2 * pi * real_of_int n; - pi \<le> y; y \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using sincos_principal_value sin_cos_eq_iff less_eq_real_def
[PROOF STATE]
proof (prove)
using this:
\<exists>y. (- pi < y \<and> y \<le> pi) \<and> sin y = sin ?x \<and> cos y = cos ?x
(sin ?y = sin ?x \<and> cos ?y = cos ?x) = (\<exists>x. ?y = ?x + 2 * pi * real_of_int x)
(?x \<le> ?y) = (?x < ?y \<or> ?x = ?y)

goal (1 subgoal):
 1. (\<And>y n. \<lbrakk>x = y + 2 * pi * real_of_int n; - pi \<le> y; y \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
x = y + 2 * pi * real_of_int n
- pi \<le> y
y \<le> pi

goal (2 subgoals):
 1. 0 < sin (x + pi / 4) \<Longrightarrow> x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
 2. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
note yn = this
[PROOF STATE]
proof (state)
this:
x = y + 2 * pi * real_of_int n
- pi \<le> y
y \<le> pi

goal (2 subgoals):
 1. 0 < sin (x + pi / 4) \<Longrightarrow> x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
 2. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
assume "0 < sin (x + pi / 4)"
[PROOF STATE]
proof (state)
this:
0 < sin (x + pi / 4)

goal (2 subgoals):
 1. 0 < sin (x + pi / 4) \<Longrightarrow> x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
 2. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < sin (x + pi / 4)
[PROOF STEP]
have a: "0 < sin (y + pi / 4)"
[PROOF STATE]
proof (prove)
using this:
0 < sin (x + pi / 4)

goal (1 subgoal):
 1. 0 < sin (y + pi / 4)
[PROOF STEP]
using yn
[PROOF STATE]
proof (prove)
using this:
0 < sin (x + pi / 4)
x = y + 2 * pi * real_of_int n
- pi \<le> y
y \<le> pi

goal (1 subgoal):
 1. 0 < sin (y + pi / 4)
[PROOF STEP]
by (metis sin_add sin_cos_eq_iff)
[PROOF STATE]
proof (state)
this:
0 < sin (y + pi / 4)

goal (2 subgoals):
 1. 0 < sin (x + pi / 4) \<Longrightarrow> x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
 2. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < sin (y + pi / 4)
[PROOF STEP]
have "y \<in> {- pi / 4<..<3 * pi / 4}"
[PROOF STATE]
proof (prove)
using this:
0 < sin (y + pi / 4)

goal (1 subgoal):
 1. y \<in> {- pi / 4<..<3 * pi / 4}
[PROOF STEP]
proof (unfold greaterThanLessThan_iff, safe)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>0 < sin (y + pi / 4); 0 < sin (y + pi / 4)\<rbrakk> \<Longrightarrow> - pi / 4 < y
 2. \<lbrakk>0 < sin (y + pi / 4); 0 < sin (y + pi / 4)\<rbrakk> \<Longrightarrow> y < 3 * pi / 4
[PROOF STEP]
show "- pi / 4 < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - pi / 4 < y
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> - pi / 4 < y \<Longrightarrow> False
[PROOF STEP]
assume "\<not> - pi / 4 < y"
[PROOF STATE]
proof (state)
this:
\<not> - pi / 4 < y

goal (1 subgoal):
 1. \<not> - pi / 4 < y \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> - pi / 4 < y
[PROOF STEP]
have "y < - pi / 4 \<or> y = - pi / 4"
[PROOF STATE]
proof (prove)
using this:
\<not> - pi / 4 < y

goal (1 subgoal):
 1. y < - pi / 4 \<or> y = - pi / 4
[PROOF STEP]
by (simp add: not_less le_less)
[PROOF STATE]
proof (state)
this:
y < - pi / 4 \<or> y = - pi / 4

goal (1 subgoal):
 1. \<not> - pi / 4 < y \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y < - pi / 4 \<or> y = - pi / 4
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
y < - pi / 4 \<or> y = - pi / 4

goal (1 subgoal):
 1. False
[PROOF STEP]
using a sin_less_zero_pi[where x = "y + pi/4"] yn sin_zero
[PROOF STATE]
proof (prove)
using this:
y < - pi / 4 \<or> y = - pi / 4
0 < sin (y + pi / 4)
\<lbrakk>- pi < y + pi / 4; y + pi / 4 < 0\<rbrakk> \<Longrightarrow> sin (y + pi / 4) < 0
x = y + 2 * pi * real_of_int n
- pi \<le> y
y \<le> pi
sin (0::?'a) = (0::?'a)

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- pi / 4 < y

goal (1 subgoal):
 1. \<lbrakk>0 < sin (y + pi / 4); 0 < sin (y + pi / 4)\<rbrakk> \<Longrightarrow> y < 3 * pi / 4
[PROOF STEP]
show "y < 3 * pi / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y < 3 * pi / 4
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> y < 3 * pi / 4 \<Longrightarrow> False
[PROOF STEP]
assume "\<not> y < 3 * pi / 4"
[PROOF STATE]
proof (state)
this:
\<not> y < 3 * pi / 4

goal (1 subgoal):
 1. \<not> y < 3 * pi / 4 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> y < 3 * pi / 4
[PROOF STEP]
have "pi \<le> y + pi/4"
[PROOF STATE]
proof (prove)
using this:
\<not> y < 3 * pi / 4

goal (1 subgoal):
 1. pi \<le> y + pi / 4
[PROOF STEP]
by (simp add: not_less)
[PROOF STATE]
proof (state)
this:
pi \<le> y + pi / 4

goal (1 subgoal):
 1. \<not> y < 3 * pi / 4 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
pi \<le> y + pi / 4
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
pi \<le> y + pi / 4

goal (1 subgoal):
 1. False
[PROOF STEP]
using a sin_le_zero yn pi_ge_two
[PROOF STATE]
proof (prove)
using this:
pi \<le> y + pi / 4
0 < sin (y + pi / 4)
\<lbrakk>pi \<le> ?x; ?x < 2 * pi\<rbrakk> \<Longrightarrow> sin ?x \<le> 0
x = y + 2 * pi * real_of_int n
- pi \<le> y
y \<le> pi
2 \<le> pi

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y < 3 * pi / 4

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
y \<in> {- pi / 4<..<3 * pi / 4}

goal (2 subgoals):
 1. 0 < sin (x + pi / 4) \<Longrightarrow> x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
 2. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
y \<in> {- pi / 4<..<3 * pi / 4}
[PROOF STEP]
have "x \<in> {- pi / 4 + 2*pi*n<..<3 * pi / 4 + 2*pi*n}"
[PROOF STATE]
proof (prove)
using this:
y \<in> {- pi / 4<..<3 * pi / 4}

goal (1 subgoal):
 1. x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}
[PROOF STEP]
using yn greaterThanLessThan_iff
[PROOF STATE]
proof (prove)
using this:
y \<in> {- pi / 4<..<3 * pi / 4}
x = y + 2 * pi * real_of_int n
- pi \<le> y
y \<le> pi
(?i \<in> {?l<..<?u}) = (?l < ?i \<and> ?i < ?u)

goal (1 subgoal):
 1. x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}

goal (2 subgoals):
 1. 0 < sin (x + pi / 4) \<Longrightarrow> x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
 2. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}
[PROOF STEP]
show "x \<in> (\<Union>n::int. {- pi / 4 + 2*pi*n<..<3 * pi / 4 + 2*pi*n})"
[PROOF STATE]
proof (prove)
using this:
x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}

goal (1 subgoal):
 1. x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>x. {- pi / 4 + 2 * pi * real_of_int x<..<3 * pi / 4 + 2 * pi * real_of_int x})

goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
fix X and n :: int
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
assume "x \<in> X"
     and "X = {- pi / 4 + 2*pi*n<..<3 * pi / 4 + 2*pi*n}"
[PROOF STATE]
proof (state)
this:
x \<in> X
X = {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}

goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> X
X = {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}
[PROOF STEP]
have "x \<in> {- pi / 4 + 2*pi*n<..<3 * pi / 4 + 2*pi*n}"
[PROOF STATE]
proof (prove)
using this:
x \<in> X
X = {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}

goal (1 subgoal):
 1. x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}

goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}
[PROOF STEP]
obtain y :: real and n :: int
    where "x = y + 2*pi*n" and "- pi / 4 < y" and "y < 3 * pi / 4"
[PROOF STATE]
proof (prove)
using this:
x \<in> {- pi / 4 + 2 * pi * real_of_int n<..<3 * pi / 4 + 2 * pi * real_of_int n}

goal (1 subgoal):
 1. (\<And>y n. \<lbrakk>x = y + 2 * pi * real_of_int n; - pi / 4 < y; y < 3 * pi / 4\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (smt (z3) greaterThanLessThan_iff)
[PROOF STATE]
proof (state)
this:
x = y + 2 * pi * real_of_int n
- pi / 4 < y
y < 3 * pi / 4

goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
note yn = this
[PROOF STATE]
proof (state)
this:
x = y + 2 * pi * real_of_int n
- pi / 4 < y
y < 3 * pi / 4

goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
have "0 < sin (y + pi / 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < sin (y + pi / 4)
[PROOF STEP]
using sin_gt_zero yn
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?x; ?x < pi\<rbrakk> \<Longrightarrow> 0 < sin ?x
x = y + 2 * pi * real_of_int n
- pi / 4 < y
y < 3 * pi / 4

goal (1 subgoal):
 1. 0 < sin (y + pi / 4)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < sin (y + pi / 4)

goal (1 subgoal):
 1. \<And>X xa. \<lbrakk>x \<in> X; X = {- pi / 4 + 2 * pi * real_of_int xa<..<3 * pi / 4 + 2 * pi * real_of_int xa}\<rbrakk> \<Longrightarrow> 0 < sin (x + pi / 4)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < sin (y + pi / 4)
[PROOF STEP]
show "0 < sin (x + pi / 4)"
[PROOF STATE]
proof (prove)
using this:
0 < sin (y + pi / 4)

goal (1 subgoal):
 1. 0 < sin (x + pi / 4)
[PROOF STEP]
using yn sin_cos_eq_iff[of "x + pi / 4" "y + pi / 4"]
[PROOF STATE]
proof (prove)
using this:
0 < sin (y + pi / 4)
x = y + 2 * pi * real_of_int n
- pi / 4 < y
y < 3 * pi / 4
(sin (x + pi / 4) = sin (y + pi / 4) \<and> cos (x + pi / 4) = cos (y + pi / 4)) = (\<exists>xa. x + pi / 4 = y + pi / 4 + 2 * pi * real_of_int xa)

goal (1 subgoal):
 1. 0 < sin (x + pi / 4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < sin (x + pi / 4)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tree_enum_correct1: "t \<in> set (tree_enum n) \<Longrightarrow> size t = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> set (tree_enum n) \<Longrightarrow> size t = n
[PROOF STEP]
by (induct n arbitrary: t rule: tree_enum.induct) (simp, fastforce)


[STATEMENT]
lemma complex_inner_i_right [simp]: "inner x \<i> = Im x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner x \<i> = Im x
[PROOF STEP]
unfolding inner_complex_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Re x * Re \<i> + Im x * Im \<i> = Im x
[PROOF STEP]
by simp


[STATEMENT]
lemma inj2_distinct_concat_map_function:
  assumes "inj2 f"
  shows"\<lbrakk>\<forall> x \<in> set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct [f x y. x \<leftarrow> xs, y \<leftarrow> g x]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
[PROOF STEP]
proof(induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>\<forall>x\<in>set []. distinct (g x); distinct []\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) []))
 2. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
\<forall>x\<in>set []. distinct (g x)
distinct []

goal (2 subgoals):
 1. \<lbrakk>\<forall>x\<in>set []. distinct (g x); distinct []\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) []))
 2. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x\<in>set []. distinct (g x)
distinct []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>set []. distinct (g x)
distinct []

goal (1 subgoal):
 1. distinct (concat (map (\<lambda>x. map (f x) (g x)) []))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (concat (map (\<lambda>x. map (f x) (g x)) []))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
\<forall>x\<in>set (x # xs). distinct (g x)
distinct (x # xs)

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
have 1: "distinct (map (f x) (g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (map (f x) (g x))
[PROOF STEP]
using Cons assms inj2_distinct_map
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
\<forall>x\<in>set (x # xs). distinct (g x)
distinct (x # xs)
inj2 f
inj2 ?f \<Longrightarrow> distinct ?xs = distinct (map (?f ?x) ?xs)

goal (1 subgoal):
 1. distinct (map (f x) (g x))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
distinct (map (f x) (g x))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
have 2: "distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
\<forall>x\<in>set (x # xs). distinct (g x)
distinct (x # xs)

goal (1 subgoal):
 1. distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
have 3: "\<And>xa xb xc. \<lbrakk>xa \<in> set xs; xb \<in> set (g x); f x xb = f xa xc; xc \<in> set (g xa)\<rbrakk>
      \<Longrightarrow> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa xb xc. \<lbrakk>xa \<in> set xs; xb \<in> set (g x); f x xb = f xa xc; xc \<in> set (g xa)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using Cons assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
\<forall>x\<in>set (x # xs). distinct (g x)
distinct (x # xs)
inj2 f

goal (1 subgoal):
 1. \<And>xa xb xc. \<lbrakk>xa \<in> set xs; xb \<in> set (g x); f x xb = f xa xc; xc \<in> set (g xa)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
unfolding inj2_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
\<forall>x\<in>set (x # xs). distinct (g x)
distinct (x # xs)
\<forall>x1\<in>UNIV. \<forall>x2\<in>UNIV. \<forall>y1\<in>UNIV. \<forall>y2\<in>UNIV. f x1 y1 = f x2 y2 \<longrightarrow> x1 = x2 \<and> y1 = y2

goal (1 subgoal):
 1. \<And>xa xb xc. \<lbrakk>xa \<in> set xs; xb \<in> set (g x); f x xb = f xa xc; xc \<in> set (g xa)\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>?xa \<in> set xs; ?xb \<in> set (g x); f x ?xb = f ?xa ?xc; ?xc \<in> set (g ?xa)\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. \<And>a xs. \<lbrakk>\<lbrakk>\<forall>x\<in>set xs. distinct (g x); distinct xs\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) xs)); \<forall>x\<in>set (a # xs). distinct (g x); distinct (a # xs)\<rbrakk> \<Longrightarrow> distinct (concat (map (\<lambda>x. map (f x) (g x)) (a # xs)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct (concat (map (\<lambda>x. map (f x) (g x)) (x # xs)))
[PROOF STEP]
using 1 2 3
[PROOF STATE]
proof (prove)
using this:
distinct (map (f x) (g x))
distinct (concat (map (\<lambda>x. map (f x) (g x)) xs))
\<lbrakk>?xa \<in> set xs; ?xb \<in> set (g x); f x ?xb = f ?xa ?xc; ?xc \<in> set (g ?xa)\<rbrakk> \<Longrightarrow> False

goal (1 subgoal):
 1. distinct (concat (map (\<lambda>x. map (f x) (g x)) (x # xs)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct (concat (map (\<lambda>x. map (f x) (g x)) (x # xs)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_weak_mono_all_pos:
  fixes p :: "('v :: linorder,'a :: poly_carrier)poly"
  assumes pos_at_zero: "eval_poly (\<lambda> w. 0) p \<ge> 0"
  and mono: "poly_weak_mono_all p"
  shows "p \<ge>p zero_poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<ge>p zero_poly
[PROOF STEP]
unfolding poly_ge_def zero_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> [] \<le> eval_poly \<alpha> p
[PROOF STEP]
proof (intro allI impI, simp)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. pos_assign \<alpha> \<Longrightarrow> (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
fix  \<alpha> :: "('v,'a)assign"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>\<alpha>. pos_assign \<alpha> \<Longrightarrow> (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
assume pos: "pos_assign \<alpha>"
[PROOF STATE]
proof (state)
this:
pos_assign \<alpha>

goal (1 subgoal):
 1. \<And>\<alpha>. pos_assign \<alpha> \<Longrightarrow> (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
show "eval_poly \<alpha> p \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
let ?id = "\<lambda> w. poly_of (PVar w)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
let ?z = "\<lambda> w. zero_poly"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
have "poly_subst ?id p \<ge>p poly_subst ?z p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_subst (\<lambda>w. poly_of (PVar w)) p \<ge>p poly_subst (\<lambda>w. zero_poly) p
[PROOF STEP]
by (rule poly_weak_mono_all_E[OF mono],
        simp, simp add: poly_ge_def zero_poly_def pos_assign_def)
[PROOF STATE]
proof (state)
this:
poly_subst (\<lambda>w. poly_of (PVar w)) p \<ge>p poly_subst (\<lambda>w. zero_poly) p

goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
hence "eval_poly \<alpha> (poly_subst ?id p) \<ge> eval_poly \<alpha> (poly_subst ?z p)" (is "_ \<ge> ?res")
[PROOF STATE]
proof (prove)
using this:
poly_subst (\<lambda>w. poly_of (PVar w)) p \<ge>p poly_subst (\<lambda>w. zero_poly) p

goal (1 subgoal):
 1. eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)
[PROOF STEP]
unfolding poly_ge_def
[PROOF STATE]
proof (prove)
using this:
\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)

goal (1 subgoal):
 1. eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)
[PROOF STEP]
using pos
[PROOF STATE]
proof (prove)
using this:
\<forall>\<alpha>. pos_assign \<alpha> \<longrightarrow> eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)
pos_assign \<alpha>

goal (1 subgoal):
 1. eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)

goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)

goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
have "?res = eval_poly (\<lambda> w. 0) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) = eval_poly (\<lambda>w. 0::'a) p
[PROOF STEP]
by (simp add: poly_subst zero_poly_def)
[PROOF STATE]
proof (state)
this:
eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) = eval_poly (\<lambda>w. 0::'a) p

goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
eval_poly \<alpha> (poly_subst (\<lambda>w. zero_poly) p) = eval_poly (\<lambda>w. 0::'a) p

goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
have "\<dots> \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> eval_poly (\<lambda>w. 0::'a) p
[PROOF STEP]
by (rule pos_at_zero)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> eval_poly (\<lambda>w. 0::'a) p

goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> eval_poly \<alpha> (poly_subst (\<lambda>w. poly_of (PVar w)) p)

goal (1 subgoal):
 1. (0::'a) \<le> eval_poly \<alpha> p
[PROOF STEP]
by  (simp add: poly_subst)
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> eval_poly \<alpha> p

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> eval_poly \<alpha> p

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma exp_approx':
  assumes "n > 0" "0 \<le> x" "x \<le> 1"
  shows   "\<bar>exp (x::real) - (\<Sum>k\<le>n. x^k / fact k)\<bar> \<le> x ^ n / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
0 < n
0 \<le> x
x \<le> 1
[PROOF STEP]
have "x^n / (2 - x) \<le> x^n / 1"
[PROOF STATE]
proof (prove)
using this:
0 < n
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. x ^ n / (2 - x) \<le> x ^ n / 1
[PROOF STEP]
by (intro frac_le) simp_all
[PROOF STATE]
proof (state)
this:
x ^ n / (2 - x) \<le> x ^ n / 1

goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
hence "(2 * x^n / (2 - x)) / fact n \<le> 2 * x^n / fact n"
[PROOF STATE]
proof (prove)
using this:
x ^ n / (2 - x) \<le> x ^ n / 1

goal (1 subgoal):
 1. 2 * x ^ n / (2 - x) / fact n \<le> 2 * x ^ n / fact n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
x ^ n / (2 - x) \<le> x ^ n / 1
0 < n
0 \<le> x
x \<le> 1

goal (1 subgoal):
 1. 2 * x ^ n / (2 - x) / fact n \<le> 2 * x ^ n / fact n
[PROOF STEP]
by (simp add: field_split_simps)
[PROOF STATE]
proof (state)
this:
2 * x ^ n / (2 - x) / fact n \<le> 2 * x ^ n / fact n

goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
with exp_approx[of n x] assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>0 < n; 0 \<le> x; x < 2\<rbrakk> \<Longrightarrow> exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / (2 - x) / fact n}
0 < n
0 \<le> x
x \<le> 1
2 * x ^ n / (2 - x) / fact n \<le> 2 * x ^ n / fact n
[PROOF STEP]
have "exp (x::real) - (\<Sum>k<n. x^k / fact k) \<in> {0..2 * x^n / fact n}"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < n; 0 \<le> x; x < 2\<rbrakk> \<Longrightarrow> exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / (2 - x) / fact n}
0 < n
0 \<le> x
x \<le> 1
2 * x ^ n / (2 - x) / fact n \<le> 2 * x ^ n / fact n

goal (1 subgoal):
 1. exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / fact n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / fact n}

goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / fact n}

goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
have "(\<Sum>k\<le>n. x^k / fact k) = (\<Sum>k<n. x^k / fact k) + x ^ n / fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>n. x ^ k / fact k) = (\<Sum>k<n. x ^ k / fact k) + x ^ n / fact n
[PROOF STEP]
by (simp add: lessThan_Suc_atMost [symmetric])
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>n. x ^ k / fact k) = (\<Sum>k<n. x ^ k / fact k) + x ^ n / fact n

goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / fact n}
(\<Sum>k\<le>n. x ^ k / fact k) = (\<Sum>k<n. x ^ k / fact k) + x ^ n / fact n
[PROOF STEP]
show "\<bar>exp (x::real) - (\<Sum>k\<le>n. x^k / fact k)\<bar> \<le> x ^ n / fact n"
[PROOF STATE]
proof (prove)
using this:
exp x - (\<Sum>k<n. x ^ k / fact k) \<in> {0..2 * x ^ n / fact n}
(\<Sum>k\<le>n. x ^ k / fact k) = (\<Sum>k<n. x ^ k / fact k) + x ^ n / fact n

goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
unfolding atLeastAtMost_iff
[PROOF STATE]
proof (prove)
using this:
0 \<le> exp x - (\<Sum>k<n. x ^ k / fact k) \<and> exp x - (\<Sum>k<n. x ^ k / fact k) \<le> 2 * x ^ n / fact n
(\<Sum>k\<le>n. x ^ k / fact k) = (\<Sum>k<n. x ^ k / fact k) + x ^ n / fact n

goal (1 subgoal):
 1. \<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
\<bar>exp x - (\<Sum>k\<le>n. x ^ k / fact k)\<bar> \<le> x ^ n / fact n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma isometry_on_cong:
  assumes "isometry_on X f"
          "\<And>x. x \<in> X \<Longrightarrow> g x = f x"
  shows "isometry_on X g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isometry_on X g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
isometry_on X f
?x \<in> X \<Longrightarrow> g ?x = f ?x

goal (1 subgoal):
 1. isometry_on X g
[PROOF STEP]
unfolding isometry_on_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>X. \<forall>y\<in>X. dist (f x) (f y) = dist x y
?x \<in> X \<Longrightarrow> g ?x = f ?x

goal (1 subgoal):
 1. \<forall>x\<in>X. \<forall>y\<in>X. dist (g x) (g y) = dist x y
[PROOF STEP]
by auto


[STATEMENT]
lemma imp_graph_skew_sym:
  "(l\<^sub>1,l\<^sub>2) \<in> imp_graph cnf \<Longrightarrow> (negate l\<^sub>2, negate l\<^sub>1) \<in> imp_graph cnf"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l\<^sub>1, l\<^sub>2) \<in> imp_graph cnf \<Longrightarrow> (negate l\<^sub>2, negate l\<^sub>1) \<in> imp_graph cnf
[PROOF STEP]
unfolding imp_graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (l\<^sub>1, l\<^sub>2) \<in> \<Union> (edges_of_clause ` cnf) \<Longrightarrow> (negate l\<^sub>2, negate l\<^sub>1) \<in> \<Union> (edges_of_clause ` cnf)
[PROOF STEP]
apply clarsimp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<in> cnf; (l\<^sub>1, l\<^sub>2) \<in> edges_of_clause x\<rbrakk> \<Longrightarrow> \<exists>x\<in>cnf. (negate l\<^sub>2, negate l\<^sub>1) \<in> edges_of_clause x
[PROOF STEP]
subgoal for cl
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cl \<in> cnf; (l\<^sub>1, l\<^sub>2) \<in> edges_of_clause cl\<rbrakk> \<Longrightarrow> \<exists>x\<in>cnf. (negate l\<^sub>2, negate l\<^sub>1) \<in> edges_of_clause x
[PROOF STEP]
by (cases cl) (auto 4 3 intro: rev_bexI)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done