[STATEMENT]
lemma spmf_of_set: "spmf (spmf_of_set A) x = indicator A x / card A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. spmf (spmf_of_set A) x = indicat_real A x / real (card A)
[PROOF STEP]
by(auto simp add: spmf_of_set_def)


[STATEMENT]
lemma capped_pnu:
  "y \<le> u \<Longrightarrow> z \<le> v \<Longrightarrow> u * v \<le> v \<Longrightarrow> p\<nu>(\<lambda>x . (y * x \<squnion> z) \<sqinter> v) = y\<^sup>\<omega>\<^sub>v \<squnion> y\<^sup>\<star> * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>y \<le> u; z \<le> v; u * v \<le> v\<rbrakk> \<Longrightarrow> p\<nu> (\<lambda>x. (y * x \<squnion> z) \<sqinter> v) = y\<^sup>\<omega>\<^sub>v \<squnion> y\<^sup>\<star> * z
[PROOF STEP]
by (metis capped_greatest_postfixpoint greatest_postfixpoint_same)


[STATEMENT]
lemma "rev [a, b, c] = [c, b, a]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rev [a, b, c] = [c, b, a]
[PROOF STEP]
by normalization


[STATEMENT]
lemma sset_siterate: "sset (siterate f x) = {(f^^n) x | n. True}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sset (siterate f x) = {(f ^^ n) x |n. True}
[PROOF STEP]
by (auto simp: sset_range)


[STATEMENT]
lemma naturality_simplicial_subdivision:
   "\<lbrakk>simplicial_chain p (standard_simplex q) c; simplicial_simplex q S g\<rbrakk>
    \<Longrightarrow> simplicial_subdivision p (chain_map p g c) = chain_map p g (simplicial_subdivision p c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>simplicial_chain p (standard_simplex q) c; simplicial_simplex q S g\<rbrakk> \<Longrightarrow> simplicial_subdivision p (chain_map p g c) = chain_map p g (simplicial_subdivision p c)
[PROOF STEP]
apply (simp flip: singular_subdivision_simplicial_simplex)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>simplicial_chain p (standard_simplex q) c; simplicial_simplex q S g\<rbrakk> \<Longrightarrow> simplicial_subdivision p (chain_map p g c) = chain_map p g (singular_subdivision p c)
[PROOF STEP]
by (metis naturality_singular_subdivision simplicial_chain_chain_map simplicial_imp_singular_chain singular_subdivision_simplicial_simplex)


[STATEMENT]
lemma tfl_disj_assoc: "(a \<or> b) \<or> c \<equiv> a \<or> (b \<or> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<or> b) \<or> c \<equiv> a \<or> b \<or> c
[PROOF STEP]
by simp


[STATEMENT]
lemma two_three:
   assumes "-(x \<squnion> y) = -y \<or> -(-(x \<squnion> -y) \<squnion> -y) = x"
     shows "y \<squnion> 2 \<times> (x \<squnion> -(x \<squnion> -y)) = y \<squnion> 3 \<times> (x \<squnion> -(x \<squnion> -y))"
           (is "y \<squnion> ?z2 = y \<squnion> ?z3")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
- (x \<squnion> y) = - y \<or> - (- (x \<squnion> - y) \<squnion> - y) = x

goal (1 subgoal):
 1. y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. - (x \<squnion> y) = - y \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
 2. - (- (x \<squnion> - y) \<squnion> - y) = x \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
assume "-(x \<squnion> y) = -y"
[PROOF STATE]
proof (state)
this:
- (x \<squnion> y) = - y

goal (2 subgoals):
 1. - (x \<squnion> y) = - y \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
 2. - (- (x \<squnion> - y) \<squnion> - y) = x \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
with copyp2[where k="Suc(0)"]
           copyp2[where k="Suc(Suc(0))"]
           two three
[PROOF STATE]
proof (chain)
picking this:
- (?x \<squnion> ?y) = - ?y \<Longrightarrow> - (?y \<squnion> Suc 0 \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
- (?x \<squnion> ?y) = - ?y \<Longrightarrow> - (?y \<squnion> Suc (Suc 0) \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
2 \<times> ?x = ?x \<squnion> ?x
3 \<times> ?x = ?x \<squnion> ?x \<squnion> ?x
- (x \<squnion> y) = - y
[PROOF STEP]
have "-(y \<squnion> ?z2) = -y" and "-(y \<squnion> ?z3) = -y"
[PROOF STATE]
proof (prove)
using this:
- (?x \<squnion> ?y) = - ?y \<Longrightarrow> - (?y \<squnion> Suc 0 \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
- (?x \<squnion> ?y) = - ?y \<Longrightarrow> - (?y \<squnion> Suc (Suc 0) \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
2 \<times> ?x = ?x \<squnion> ?x
3 \<times> ?x = ?x \<squnion> ?x \<squnion> ?x
- (x \<squnion> y) = - y

goal (1 subgoal):
 1. - (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y &&& - (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
- (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
- (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y

goal (2 subgoals):
 1. - (x \<squnion> y) = - y \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
 2. - (- (x \<squnion> - y) \<squnion> - y) = x \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
with two_threep sup_comm
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>- (2 \<times> ?x \<squnion> ?y) = - ?y; - (3 \<times> ?x \<squnion> ?y) = - ?y\<rbrakk> \<Longrightarrow> 2 \<times> ?x \<squnion> ?y = 3 \<times> ?x \<squnion> ?y
?x \<squnion> ?y = ?y \<squnion> ?x
- (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
- (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- (2 \<times> ?x \<squnion> ?y) = - ?y; - (3 \<times> ?x \<squnion> ?y) = - ?y\<rbrakk> \<Longrightarrow> 2 \<times> ?x \<squnion> ?y = 3 \<times> ?x \<squnion> ?y
?x \<squnion> ?y = ?y \<squnion> ?x
- (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
- (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y

goal (1 subgoal):
 1. y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))

goal (1 subgoal):
 1. - (- (x \<squnion> - y) \<squnion> - y) = x \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. - (- (x \<squnion> - y) \<squnion> - y) = x \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
assume "-(-(x \<squnion> -y) \<squnion> -y) = x"
[PROOF STATE]
proof (state)
this:
- (- (x \<squnion> - y) \<squnion> - y) = x

goal (1 subgoal):
 1. - (- (x \<squnion> - y) \<squnion> - y) = x \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
with copyp1[where k="Suc(0)"]
           copyp1[where k="Suc(Suc(0))"]
           two three
[PROOF STATE]
proof (chain)
picking this:
- (- (?x \<squnion> - ?y) \<squnion> - ?y) = ?x \<Longrightarrow> - (?y \<squnion> Suc 0 \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
- (- (?x \<squnion> - ?y) \<squnion> - ?y) = ?x \<Longrightarrow> - (?y \<squnion> Suc (Suc 0) \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
2 \<times> ?x = ?x \<squnion> ?x
3 \<times> ?x = ?x \<squnion> ?x \<squnion> ?x
- (- (x \<squnion> - y) \<squnion> - y) = x
[PROOF STEP]
have "-(y \<squnion> ?z2) = -y" and "-(y \<squnion> ?z3) = -y"
[PROOF STATE]
proof (prove)
using this:
- (- (?x \<squnion> - ?y) \<squnion> - ?y) = ?x \<Longrightarrow> - (?y \<squnion> Suc 0 \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
- (- (?x \<squnion> - ?y) \<squnion> - ?y) = ?x \<Longrightarrow> - (?y \<squnion> Suc (Suc 0) \<otimes> (?x \<squnion> - (?x \<squnion> - ?y))) = - ?y
2 \<times> ?x = ?x \<squnion> ?x
3 \<times> ?x = ?x \<squnion> ?x \<squnion> ?x
- (- (x \<squnion> - y) \<squnion> - y) = x

goal (1 subgoal):
 1. - (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y &&& - (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
[PROOF STEP]
by simp+
[PROOF STATE]
proof (state)
this:
- (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
- (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y

goal (1 subgoal):
 1. - (- (x \<squnion> - y) \<squnion> - y) = x \<Longrightarrow> y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
with two_threep sup_comm
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>- (2 \<times> ?x \<squnion> ?y) = - ?y; - (3 \<times> ?x \<squnion> ?y) = - ?y\<rbrakk> \<Longrightarrow> 2 \<times> ?x \<squnion> ?y = 3 \<times> ?x \<squnion> ?y
?x \<squnion> ?y = ?y \<squnion> ?x
- (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
- (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>- (2 \<times> ?x \<squnion> ?y) = - ?y; - (3 \<times> ?x \<squnion> ?y) = - ?y\<rbrakk> \<Longrightarrow> 2 \<times> ?x \<squnion> ?y = 3 \<times> ?x \<squnion> ?y
?x \<squnion> ?y = ?y \<squnion> ?x
- (y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y))) = - y
- (y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))) = - y

goal (1 subgoal):
 1. y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
y \<squnion> 2 \<times> (x \<squnion> - (x \<squnion> - y)) = y \<squnion> 3 \<times> (x \<squnion> - (x \<squnion> - y))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Lambert_W_asymp_equiv_at_top:
  "(\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. -ln (ln x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - ln (ln x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - ln (ln x))
[PROOF STEP]
have "(\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. (-1) * ln (ln x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - 1 * ln (ln x))
[PROOF STEP]
proof (rule asymp_equiv_sandwich')
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>c'. c' \<in> {?l<..<- 1} \<Longrightarrow> \<forall>\<^sub>F x in at_top. c' * ln (ln x) \<le> Lambert_W x - ln x
 2. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 3. ?l < - 1
 4. - 1 < ?u
 5. - 1 \<noteq> 0
[PROOF STEP]
fix c' :: real
[PROOF STATE]
proof (state)
goal (5 subgoals):
 1. \<And>c'. c' \<in> {?l<..<- 1} \<Longrightarrow> \<forall>\<^sub>F x in at_top. c' * ln (ln x) \<le> Lambert_W x - ln x
 2. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 3. ?l < - 1
 4. - 1 < ?u
 5. - 1 \<noteq> 0
[PROOF STEP]
assume c': "c' \<in> {-2<..<-1}"
[PROOF STATE]
proof (state)
this:
c' \<in> {- 2<..<- 1}

goal (5 subgoals):
 1. \<And>c'. c' \<in> {?l<..<- 1} \<Longrightarrow> \<forall>\<^sub>F x in at_top. c' * ln (ln x) \<le> Lambert_W x - ln x
 2. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 3. ?l < - 1
 4. - 1 < ?u
 5. - 1 \<noteq> 0
[PROOF STEP]
have "eventually (\<lambda>x. (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x) at_top"
         "eventually (\<lambda>x. ln x + c' * ln (ln x) \<ge> -1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x &&& \<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)
[PROOF STEP]
using c'
[PROOF STATE]
proof (prove)
using this:
c' \<in> {- 2<..<- 1}

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x &&& \<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)
[PROOF STEP]
by real_asymp+
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x
\<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)

goal (5 subgoals):
 1. \<And>c'. c' \<in> {?l<..<- 1} \<Longrightarrow> \<forall>\<^sub>F x in at_top. c' * ln (ln x) \<le> Lambert_W x - ln x
 2. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 3. ?l < - 1
 4. - 1 < ?u
 5. - 1 \<noteq> 0
[PROOF STEP]
thus "eventually (\<lambda>x. Lambert_W x - ln x \<ge> c' * ln (ln x)) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x
\<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. c' * ln (ln x) \<le> Lambert_W x - ln x
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>(ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x; - 1 \<le> ln x + c' * ln (ln x)\<rbrakk> \<Longrightarrow> c' * ln (ln x) \<le> Lambert_W x - ln x
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
(ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x
- 1 \<le> ln x + c' * ln (ln x)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>(ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x; - 1 \<le> ln x + c' * ln (ln x)\<rbrakk> \<Longrightarrow> c' * ln (ln x) \<le> Lambert_W x - ln x
[PROOF STEP]
hence "Lambert_W x \<ge> ln x + c' * ln (ln x)"
[PROOF STATE]
proof (prove)
using this:
(ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x
- 1 \<le> ln x + c' * ln (ln x)

goal (1 subgoal):
 1. ln x + c' * ln (ln x) \<le> Lambert_W x
[PROOF STEP]
by (intro Lambert_W_geI)
[PROOF STATE]
proof (state)
this:
ln x + c' * ln (ln x) \<le> Lambert_W x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>(ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<le> x; - 1 \<le> ln x + c' * ln (ln x)\<rbrakk> \<Longrightarrow> c' * ln (ln x) \<le> Lambert_W x - ln x
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
ln x + c' * ln (ln x) \<le> Lambert_W x

goal (1 subgoal):
 1. c' * ln (ln x) \<le> Lambert_W x - ln x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c' * ln (ln x) \<le> Lambert_W x - ln x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. c' * ln (ln x) \<le> Lambert_W x - ln x

goal (4 subgoals):
 1. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 2. - 2 < - 1
 3. - 1 < ?u
 4. - 1 \<noteq> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 2. - 2 < - 1
 3. - 1 < ?u
 4. - 1 \<noteq> 0
[PROOF STEP]
fix c' :: real
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 2. - 2 < - 1
 3. - 1 < ?u
 4. - 1 \<noteq> 0
[PROOF STEP]
assume c': "c' \<in> {-1<..<0}"
[PROOF STATE]
proof (state)
this:
c' \<in> {- 1<..<0}

goal (4 subgoals):
 1. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 2. - 2 < - 1
 3. - 1 < ?u
 4. - 1 \<noteq> 0
[PROOF STEP]
have "eventually (\<lambda>x. (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) \<ge> x) at_top"
         "eventually (\<lambda>x. ln x + c' * ln (ln x) \<ge> -1) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) &&& \<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)
[PROOF STEP]
using c'
[PROOF STATE]
proof (prove)
using this:
c' \<in> {- 1<..<0}

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)) &&& \<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)
[PROOF STEP]
by real_asymp+
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x))
\<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)

goal (4 subgoals):
 1. \<And>c'. c' \<in> {- 1<..<?u} \<Longrightarrow> \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
 2. - 2 < - 1
 3. - 1 < ?u
 4. - 1 \<noteq> 0
[PROOF STEP]
thus "eventually (\<lambda>x. Lambert_W x - ln x \<le> c' * ln (ln x)) at_top"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x))
\<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
[PROOF STEP]
using eventually_ge_at_top[of "-exp (-1)"]
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at_top. x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x))
\<forall>\<^sub>F x in at_top. - 1 \<le> ln x + c' * ln (ln x)
eventually ((\<le>) (- exp (- (1::?'a1)))) at_top

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)); - 1 \<le> ln x + c' * ln (ln x); - exp (- 1) \<le> x\<rbrakk> \<Longrightarrow> Lambert_W x - ln x \<le> c' * ln (ln x)
[PROOF STEP]
case (elim x)
[PROOF STATE]
proof (state)
this:
x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x))
- 1 \<le> ln x + c' * ln (ln x)
- exp (- 1) \<le> x

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)); - 1 \<le> ln x + c' * ln (ln x); - exp (- 1) \<le> x\<rbrakk> \<Longrightarrow> Lambert_W x - ln x \<le> c' * ln (ln x)
[PROOF STEP]
hence "Lambert_W x \<le> ln x + c' * ln (ln x)"
[PROOF STATE]
proof (prove)
using this:
x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x))
- 1 \<le> ln x + c' * ln (ln x)
- exp (- 1) \<le> x

goal (1 subgoal):
 1. Lambert_W x \<le> ln x + c' * ln (ln x)
[PROOF STEP]
by (intro Lambert_W_leI)
[PROOF STATE]
proof (state)
this:
Lambert_W x \<le> ln x + c' * ln (ln x)

goal (1 subgoal):
 1. \<And>x. \<lbrakk>x \<le> (ln x + c' * ln (ln x)) * exp (ln x + c' * ln (ln x)); - 1 \<le> ln x + c' * ln (ln x); - exp (- 1) \<le> x\<rbrakk> \<Longrightarrow> Lambert_W x - ln x \<le> c' * ln (ln x)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
Lambert_W x \<le> ln x + c' * ln (ln x)

goal (1 subgoal):
 1. Lambert_W x - ln x \<le> c' * ln (ln x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Lambert_W x - ln x \<le> c' * ln (ln x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_top. Lambert_W x - ln x \<le> c' * ln (ln x)

goal (3 subgoals):
 1. - 2 < - 1
 2. - 1 < 0
 3. - 1 \<noteq> 0
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - 1 * ln (ln x))

goal (1 subgoal):
 1. (\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - ln (ln x))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - 1 * ln (ln x))

goal (1 subgoal):
 1. (\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - ln (ln x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>x. Lambert_W x - ln x) \<sim>[at_top] (\<lambda>x. - ln (ln x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma monom_Suc:
  assumes "a \<in> carrier R"
  shows "monom P a (Suc n) = monom P \<one> 1 \<otimes>\<^bsub>P\<^esub> monom P a n"
        "monom P a (Suc n) = monom P a n \<otimes>\<^bsub>P\<^esub> monom P \<one> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom P a (Suc n) = monom P \<one> 1 \<otimes>\<^bsub>P\<^esub> monom P a n &&& monom P a (Suc n) = monom P a n \<otimes>\<^bsub>P\<^esub> monom P \<one> 1
[PROOF STEP]
apply (metis R.l_one R.one_closed Suc_eq_plus1_left assms monom_mult)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom P a (Suc n) = monom P a n \<otimes>\<^bsub>P\<^esub> monom P \<one> 1
[PROOF STEP]
by (metis R.one_closed R.r_one Suc_eq_plus1 assms monom_mult)


[STATEMENT]
lemma count_image_mset_lt_imp_lt_raw:
  assumes
    "finite A" and
    "A = set_mset M \<union> set_mset N" and
    "count (image_mset f M) b < count (image_mset f N) b"
  shows "\<exists>x. f x = b \<and> count M x < count N x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A = set_mset M \<union> set_mset N
count (image_mset f M) b < count (image_mset f N) b

goal (1 subgoal):
 1. \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
proof (induct A arbitrary: M N b rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
case (insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<lbrakk>F = set_mset ?M \<union> set_mset ?N; count (image_mset f ?M) ?b < count (image_mset f ?N) ?b\<rbrakk> \<Longrightarrow> \<exists>x. f x = ?b \<and> count ?M x < count ?N x
insert x F = set_mset M \<union> set_mset N
count (image_mset f M) b < count (image_mset f N) b

goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
note fin = this(1) and x_ni_f = this(2) and ih = this(3) and x_f_eq_m_n = this(4) and
    cnt_b = this(5)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<lbrakk>F = set_mset ?M \<union> set_mset ?N; count (image_mset f ?M) ?b < count (image_mset f ?N) ?b\<rbrakk> \<Longrightarrow> \<exists>x. f x = ?b \<and> count ?M x < count ?N x
insert x F = set_mset M \<union> set_mset N
count (image_mset f M) b < count (image_mset f N) b

goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
let ?Ma = "{#y \<in># M. y \<noteq> x#}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
let ?Mb = "{#y \<in># M. y = x#}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
let ?Na = "{#y \<in># N. y \<noteq> x#}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
let ?Nb = "{#y \<in># N. y = x#}"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
have m_part: "M = ?Mb + ?Ma" and n_part: "N = ?Nb + ?Na"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = {#y \<in># M. y = x#} + {#y \<in># M. y \<noteq> x#} &&& N = {#y \<in># N. y = x#} + {#y \<in># N. y \<noteq> x#}
[PROOF STEP]
using multiset_partition
[PROOF STATE]
proof (prove)
using this:
?M = filter_mset ?P ?M + {#x \<in># ?M. \<not> ?P x#}

goal (1 subgoal):
 1. M = {#y \<in># M. y = x#} + {#y \<in># M. y \<noteq> x#} &&& N = {#y \<in># N. y = x#} + {#y \<in># N. y \<noteq> x#}
[PROOF STEP]
by blast+
[PROOF STATE]
proof (state)
this:
M = {#y \<in># M. y = x#} + {#y \<in># M. y \<noteq> x#}
N = {#y \<in># N. y = x#} + {#y \<in># N. y \<noteq> x#}

goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
have f_eq_ma_na: "F = set_mset ?Ma \<union> set_mset ?Na"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. F = set_mset {#y \<in># M. y \<noteq> x#} \<union> set_mset {#y \<in># N. y \<noteq> x#}
[PROOF STEP]
using x_f_eq_m_n x_ni_f
[PROOF STATE]
proof (prove)
using this:
insert x F = set_mset M \<union> set_mset N
x \<notin> F

goal (1 subgoal):
 1. F = set_mset {#y \<in># M. y \<noteq> x#} \<union> set_mset {#y \<in># N. y \<noteq> x#}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
F = set_mset {#y \<in># M. y \<noteq> x#} \<union> set_mset {#y \<in># N. y \<noteq> x#}

goal (2 subgoals):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<And>x F M N b. \<lbrakk>finite F; x \<notin> F; \<And>M N b. \<lbrakk>F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x; insert x F = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
proof (cases "count (image_mset f ?Ma) b < count (image_mset f ?Na) b")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
case cnt_ba: True
[PROOF STATE]
proof (state)
this:
count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b

goal (2 subgoals):
 1. count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
obtain xa where "f xa = b" and "count ?Ma xa < count ?Na xa"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>xa. \<lbrakk>f xa = b; count {#y \<in># M. y \<noteq> x#} xa < count {#y \<in># N. y \<noteq> x#} xa\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using ih[OF f_eq_ma_na cnt_ba]
[PROOF STATE]
proof (prove)
using this:
\<exists>xa. f xa = b \<and> count {#y \<in># M. y \<noteq> x#} xa < count {#y \<in># N. y \<noteq> x#} xa

goal (1 subgoal):
 1. (\<And>xa. \<lbrakk>f xa = b; count {#y \<in># M. y \<noteq> x#} xa < count {#y \<in># N. y \<noteq> x#} xa\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f xa = b
count {#y \<in># M. y \<noteq> x#} xa < count {#y \<in># N. y \<noteq> x#} xa

goal (2 subgoals):
 1. count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
 2. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
f xa = b
count {#y \<in># M. y \<noteq> x#} xa < count {#y \<in># N. y \<noteq> x#} xa

goal (1 subgoal):
 1. \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
by (metis count_filter_mset not_less0)
[PROOF STATE]
proof (state)
this:
\<exists>x. f x = b \<and> count M x < count N x

goal (1 subgoal):
 1. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
case cnt_ba: False
[PROOF STATE]
proof (state)
this:
\<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b

goal (1 subgoal):
 1. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
have fx_eq_b: "f x = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = b
[PROOF STEP]
using cnt_b cnt_ba
[PROOF STATE]
proof (prove)
using this:
count (image_mset f M) b < count (image_mset f N) b
\<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b

goal (1 subgoal):
 1. f x = b
[PROOF STEP]
by (subst (asm) m_part, subst (asm) n_part, auto, presburger)
[PROOF STATE]
proof (state)
this:
f x = b

goal (1 subgoal):
 1. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f x = b

goal (1 subgoal):
 1. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
have "count M x < count N x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count M x < count N x
[PROOF STEP]
using cnt_b cnt_ba
[PROOF STATE]
proof (prove)
using this:
count (image_mset f M) b < count (image_mset f N) b
\<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b

goal (1 subgoal):
 1. count M x < count N x
[PROOF STEP]
by (subst (asm) m_part, subst (asm) n_part, auto simp: fx_eq_b)
[PROOF STATE]
proof (state)
this:
count M x < count N x

goal (1 subgoal):
 1. \<not> count (image_mset f {#y \<in># M. y \<noteq> x#}) b < count (image_mset f {#y \<in># N. y \<noteq> x#}) b \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f x = b
count M x < count N x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
f x = b
count M x < count N x

goal (1 subgoal):
 1. \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>x. f x = b \<and> count M x < count N x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>x. f x = b \<and> count M x < count N x

goal (1 subgoal):
 1. \<And>M N b. \<lbrakk>{} = set_mset M \<union> set_mset N; count (image_mset f M) b < count (image_mset f N) b\<rbrakk> \<Longrightarrow> \<exists>x. f x = b \<and> count M x < count N x
[PROOF STEP]
qed auto


[STATEMENT]
lemma dgrad_sig_set_closed_sig_red_rtrancl:
  assumes "dickson_grading d" and "F \<subseteq> dgrad_sig_set d" and "p \<in> dgrad_sig_set d"
    and "(sig_red sing_red top_tail F)\<^sup>*\<^sup>* p q"
  shows "q \<in> dgrad_sig_set d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. q \<in> dgrad_sig_set' (length fs) d
[PROOF STEP]
using assms(4, 1, 2, 3)
[PROOF STATE]
proof (prove)
using this:
(sig_red sing_red top_tail F)\<^sup>*\<^sup>* p q
dickson_grading d
F \<subseteq> dgrad_sig_set' (length fs) d
p \<in> dgrad_sig_set' (length fs) d

goal (1 subgoal):
 1. q \<in> dgrad_sig_set' (length fs) d
[PROOF STEP]
by (induct, auto intro: dgrad_sig_set_closed_sig_red)


[STATEMENT]
lemma gen_model_worlds:
  "worlds (gen_model M w) = worlds M \<inter> (\<Union>a. relations M a)\<^sup>* `` {w}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. worlds (gen_model M w) = worlds M \<inter> (\<Union> (range (relations M)))\<^sup>* `` {w}
[PROOF STEP]
unfolding gen_model_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. worlds (let ws' = worlds M \<inter> (\<Union> (range (relations M)))\<^sup>* `` {w} in \<lparr>worlds = ws', relations = \<lambda>a. Restr (relations M a) ws', valuation = valuation M\<rparr>) = worlds M \<inter> (\<Union> (range (relations M)))\<^sup>* `` {w}
[PROOF STEP]
by simp


[STATEMENT]
lemma vifunion_simps_ext:
  "\<And>a B I. vinsert a (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. B i) =
    (if I=0 then set {a} else (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. vinsert a (B i)))"
  "\<And>A B I. (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i) \<union>\<^sub>\<circ> B = (if I=0 then B else (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i \<union>\<^sub>\<circ> B))"
  "\<And>A B I. A \<union>\<^sub>\<circ> (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. B i) = (if I=0 then A else (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A \<union>\<^sub>\<circ> B i))"
  "\<And>A B I. ((\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i) \<inter>\<^sub>\<circ> B) = (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i \<inter>\<^sub>\<circ> B)"
  "\<And>A B I. ((\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i) -\<^sub>\<circ> B) = (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>I. A i -\<^sub>\<circ> B)"
  "\<And>A B. (\<Union>\<^sub>\<circ>y\<in>\<^sub>\<circ>A. \<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>y. B i) = (\<Union>\<^sub>\<circ>i\<in>\<^sub>\<circ>\<Union>\<^sub>\<circ>A. B i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<And>a B I. vinsert a (\<Union>\<^sub>\<circ> (VLambda I B `\<^sub>\<circ> I)) = (if I = 0 \<Rightarrow> set {a} | otherwise \<Rightarrow> \<Union>\<^sub>\<circ> ((\<lambda>aa\<in>\<^sub>\<circ>I. vinsert a (B aa)) `\<^sub>\<circ> I))) &&& (\<And>A B I. \<Union>\<^sub>\<circ> (VLambda I A `\<^sub>\<circ> I) \<union>\<^sub>\<circ> B = (if I = 0 \<Rightarrow> B | otherwise \<Rightarrow> \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. A a \<union>\<^sub>\<circ> B) `\<^sub>\<circ> I))) &&& (\<And>A B I. A \<union>\<^sub>\<circ> \<Union>\<^sub>\<circ> (VLambda I B `\<^sub>\<circ> I) = (if I = 0 \<Rightarrow> A | otherwise \<Rightarrow> \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. A \<union>\<^sub>\<circ> B a) `\<^sub>\<circ> I)))) &&& (\<And>A B I. \<Union>\<^sub>\<circ> (VLambda I A `\<^sub>\<circ> I) \<inter>\<^sub>\<circ> B = \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. A a \<inter>\<^sub>\<circ> B) `\<^sub>\<circ> I)) &&& (\<And>A B I. \<Union>\<^sub>\<circ> (VLambda I A `\<^sub>\<circ> I) -\<^sub>\<circ> B = \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>I. A a -\<^sub>\<circ> B) `\<^sub>\<circ> I)) &&& (\<And>A B. \<Union>\<^sub>\<circ> ((\<lambda>a\<in>\<^sub>\<circ>A. \<Union>\<^sub>\<circ> (VLambda a B `\<^sub>\<circ> a)) `\<^sub>\<circ> A) = \<Union>\<^sub>\<circ> (VLambda (\<Union>\<^sub>\<circ> A) B `\<^sub>\<circ> \<Union>\<^sub>\<circ> A))
[PROOF STEP]
by (auto simp: vrange_VLambda)


[STATEMENT]
theorem ta_empty_ta[simp, intro!]: "tree_automaton ta_empty"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tree_automaton ta_empty
[PROOF STEP]
apply (unfold_locales)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (ta_rules ta_empty)
 2. finite (ta_initial ta_empty)
[PROOF STEP]
apply (unfold ta_empty_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. finite (ta_rules \<lparr>ta_initial = {}, ta_rules = {}\<rparr>)
 2. finite (ta_initial \<lparr>ta_initial = {}, ta_rules = {}\<rparr>)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma signof_inv: "finite S \<Longrightarrow> p permutes S \<Longrightarrow> signof (inv p) = signof p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite S; p permutes S\<rbrakk> \<Longrightarrow> of_int (sign (inv p)) = of_int (sign p)
[PROOF STEP]
by (simp add: permutes_imp_permutation sign_inverse)


[STATEMENT]
lemma val_ring_closed:
"\<O>\<^sub>p \<subseteq> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<O>\<^sub>p \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
by (simp add: subringE(1) val_ring_subring)


[STATEMENT]
theorem avl_delete_aux:
  assumes "avl t"
  shows "avl(delete x t)" and "height t = (height (delete x t)) \<or> height t = height (delete x t) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. avl (delete x t) &&& height t = height (delete x t) \<or> height t = height (delete x t) + 1
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
avl t

goal (1 subgoal):
 1. avl (delete x t) &&& height t = height (delete x t) \<or> height t = height (delete x t) + 1
[PROOF STEP]
proof (induct t)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. avl ET \<Longrightarrow> avl (delete x ET)
 2. avl ET \<Longrightarrow> height ET = height (delete x ET) \<or> height ET = height (delete x ET) + 1
 3. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> avl (delete x (MKT x1 t1 t2 x4))
 4. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) \<or> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) + 1
[PROOF STEP]
case (MKT n l r h)
[PROOF STATE]
proof (state)
this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1

goal (4 subgoals):
 1. avl ET \<Longrightarrow> avl (delete x ET)
 2. avl ET \<Longrightarrow> height ET = height (delete x ET) \<or> height ET = height (delete x ET) + 1
 3. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> avl (delete x (MKT x1 t1 t2 x4))
 4. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) \<or> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) + 1
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
avl (MKT n l r h)

goal (4 subgoals):
 1. avl ET \<Longrightarrow> avl (delete x ET)
 2. avl ET \<Longrightarrow> height ET = height (delete x ET) \<or> height ET = height (delete x ET) + 1
 3. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> avl (delete x (MKT x1 t1 t2 x4))
 4. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) \<or> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) + 1
[PROOF STEP]
with MKT
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)

goal (1 subgoal):
 1. avl (delete x (MKT n l r h))
[PROOF STEP]
proof(cases "x = n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x = n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = n

goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x = n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
with MKT 1
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x = n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x = n

goal (1 subgoal):
 1. avl (delete x (MKT n l r h))
[PROOF STEP]
by (auto simp:avl_delete_root)
[PROOF STATE]
proof (state)
this:
avl (delete x (MKT n l r h))

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> n

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
with MKT 1
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x \<noteq> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x \<noteq> n

goal (1 subgoal):
 1. avl (delete x (MKT n l r h))
[PROOF STEP]
proof(cases "x<n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; x < n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < n

goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; x < n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
with MKT 1
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x < n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x < n

goal (1 subgoal):
 1. avl (delete x (MKT n l r h))
[PROOF STEP]
by (auto simp add:avl_mkt_bal_r simp del:mkt_bal_r.simps)
[PROOF STATE]
proof (state)
this:
avl (delete x (MKT n l r h))

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < n

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> avl (delete x (MKT n l r h))
[PROOF STEP]
with MKT 1 \<open>x\<noteq>n\<close>
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x \<noteq> n
\<not> x < n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x \<noteq> n
\<not> x < n

goal (1 subgoal):
 1. avl (delete x (MKT n l r h))
[PROOF STEP]
by (auto simp add:avl_mkt_bal_l simp del:mkt_bal_l.simps)
[PROOF STATE]
proof (state)
this:
avl (delete x (MKT n l r h))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
avl (delete x (MKT n l r h))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
avl (delete x (MKT n l r h))

goal (3 subgoals):
 1. avl ET \<Longrightarrow> avl (delete x ET)
 2. avl ET \<Longrightarrow> height ET = height (delete x ET) \<or> height ET = height (delete x ET) + 1
 3. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) \<or> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) + 1
[PROOF STEP]
case 2
[PROOF STATE]
proof (state)
this:
avl (MKT n l r h)

goal (3 subgoals):
 1. avl ET \<Longrightarrow> avl (delete x ET)
 2. avl ET \<Longrightarrow> height ET = height (delete x ET) \<or> height ET = height (delete x ET) + 1
 3. \<And>x1 t1 t2 x4. \<lbrakk>avl t1 \<Longrightarrow> avl (delete x t1); avl t1 \<Longrightarrow> height t1 = height (delete x t1) \<or> height t1 = height (delete x t1) + 1; avl t2 \<Longrightarrow> avl (delete x t2); avl t2 \<Longrightarrow> height t2 = height (delete x t2) \<or> height t2 = height (delete x t2) + 1; avl (MKT x1 t1 t2 x4)\<rbrakk> \<Longrightarrow> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) \<or> height (MKT x1 t1 t2 x4) = height (delete x (MKT x1 t1 t2 x4)) + 1
[PROOF STEP]
with MKT
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
proof(cases "x = n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x = n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x = n

goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x = n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
avl (MKT n l r h)
x = n
[PROOF STEP]
have "height (MKT n l r h) = height(delete_root (MKT n l r h))
      \<or> height (MKT n l r h) = height(delete_root (MKT n l r h)) + 1"
[PROOF STATE]
proof (prove)
using this:
avl (MKT n l r h)
x = n

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete_root (MKT n l r h)) \<or> height (MKT n l r h) = height (delete_root (MKT n l r h)) + 1
[PROOF STEP]
by (subst height_delete_root,simp_all)
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete_root (MKT n l r h)) \<or> height (MKT n l r h) = height (delete_root (MKT n l r h)) + 1

goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x = n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with True
[PROOF STATE]
proof (chain)
picking this:
x = n
height (MKT n l r h) = height (delete_root (MKT n l r h)) \<or> height (MKT n l r h) = height (delete_root (MKT n l r h)) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x = n
height (MKT n l r h) = height (delete_root (MKT n l r h)) \<or> height (MKT n l r h) = height (delete_root (MKT n l r h)) + 1

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<noteq> n

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with MKT 1
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x \<noteq> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x \<noteq> n

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
proof(cases "x<n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; x < n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x < n

goal (2 subgoals):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; x < n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
proof(cases "height r = height (delete x l) + 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height r = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height r \<noteq> height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
height r \<noteq> height (delete x l) + 2

goal (2 subgoals):
 1. height r = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height r \<noteq> height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with MKT 1 \<open>x < n\<close>
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x < n
height r \<noteq> height (delete x l) + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
x < n
height r \<noteq> height (delete x l) + 2

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal (1 subgoal):
 1. height r = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height r = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
height r = height (delete x l) + 2

goal (1 subgoal):
 1. height r = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
height r = height (delete x l) + 2
[PROOF STEP]
consider (a) "height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2"
          | (b) "height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3"
[PROOF STATE]
proof (prove)
using this:
height r = height (delete x l) + 2

goal (1 subgoal):
 1. \<lbrakk>height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2 \<Longrightarrow> thesis; height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using MKT 2
[PROOF STATE]
proof (prove)
using this:
height r = height (delete x l) + 2
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)

goal (1 subgoal):
 1. \<lbrakk>height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2 \<Longrightarrow> thesis; height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (atomize_elim, intro height_mkt_bal_r) auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2 \<Longrightarrow> ?thesis; height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. height r = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2 \<Longrightarrow> ?thesis; height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2 \<Longrightarrow> ?thesis; height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case a
[PROOF STATE]
proof (state)
this:
height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2

goal (2 subgoals):
 1. height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with \<open>x < n\<close> MKT 2
[PROOF STATE]
proof (chain)
picking this:
x < n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x < n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_r n (delete x l) r) = height (delete x l) + 2

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal (1 subgoal):
 1. height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case b
[PROOF STATE]
proof (state)
this:
height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3

goal (1 subgoal):
 1. height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with \<open>x < n\<close> MKT 2
[PROOF STATE]
proof (chain)
picking this:
x < n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x < n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_r n (delete x l) r) = height (delete x l) + 3

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> x < n

goal (1 subgoal):
 1. \<lbrakk>avl l \<Longrightarrow> avl (delete x l); avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1; avl r \<Longrightarrow> avl (delete x r); avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1; avl (MKT n l r h); x \<noteq> n; \<not> x < n\<rbrakk> \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
proof(cases "height l = height (delete x r) + 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height l = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height l \<noteq> height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
height l \<noteq> height (delete x r) + 2

goal (2 subgoals):
 1. height l = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height l \<noteq> height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with MKT 1 \<open>\<not>x < n\<close> \<open>x \<noteq> n\<close>
[PROOF STATE]
proof (chain)
picking this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
\<not> x < n
x \<noteq> n
height l \<noteq> height (delete x r) + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
\<not> x < n
x \<noteq> n
height l \<noteq> height (delete x r) + 2

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal (1 subgoal):
 1. height l = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height l = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
height l = height (delete x r) + 2

goal (1 subgoal):
 1. height l = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
height l = height (delete x r) + 2
[PROOF STEP]
consider (a) "height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2"
          | (b) "height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3"
[PROOF STATE]
proof (prove)
using this:
height l = height (delete x r) + 2

goal (1 subgoal):
 1. \<lbrakk>height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2 \<Longrightarrow> thesis; height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
using MKT 2
[PROOF STATE]
proof (prove)
using this:
height l = height (delete x r) + 2
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)

goal (1 subgoal):
 1. \<lbrakk>height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2 \<Longrightarrow> thesis; height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (atomize_elim, intro height_mkt_bal_l) auto
[PROOF STATE]
proof (state)
this:
\<lbrakk>height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2 \<Longrightarrow> ?thesis; height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. height l = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2 \<Longrightarrow> ?thesis; height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2 \<Longrightarrow> ?thesis; height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case a
[PROOF STATE]
proof (state)
this:
height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2

goal (2 subgoals):
 1. height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
 2. height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with \<open>\<not>x < n\<close> \<open>x \<noteq> n\<close> MKT 2
[PROOF STATE]
proof (chain)
picking this:
\<not> x < n
x \<noteq> n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> x < n
x \<noteq> n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_l n l (delete x r)) = height (delete x r) + 2

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal (1 subgoal):
 1. height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
case b
[PROOF STATE]
proof (state)
this:
height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3

goal (1 subgoal):
 1. height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3 \<Longrightarrow> height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
with \<open>\<not>x < n\<close> \<open>x \<noteq> n\<close> MKT 2
[PROOF STATE]
proof (chain)
picking this:
\<not> x < n
x \<noteq> n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> x < n
x \<noteq> n
avl l \<Longrightarrow> avl (delete x l)
avl l \<Longrightarrow> height l = height (delete x l) \<or> height l = height (delete x l) + 1
avl r \<Longrightarrow> avl (delete x r)
avl r \<Longrightarrow> height r = height (delete x r) \<or> height r = height (delete x r) + 1
avl (MKT n l r h)
height (mkt_bal_l n l (delete x r)) = height (delete x r) + 3

goal (1 subgoal):
 1. height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
height (MKT n l r h) = height (delete x (MKT n l r h)) \<or> height (MKT n l r h) = height (delete x (MKT n l r h)) + 1

goal (2 subgoals):
 1. avl ET \<Longrightarrow> avl (delete x ET)
 2. avl ET \<Longrightarrow> height ET = height (delete x ET) \<or> height ET = height (delete x ET) + 1
[PROOF STEP]
qed simp_all


[STATEMENT]
lemma unitary_is_corthogonal:
  fixes U :: "'a::conjugatable_field mat"
  assumes dim: "U \<in> carrier_mat n n"
    and U: "unitary U"
  shows "corthogonal_mat U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. corthogonal_mat U
[PROOF STEP]
unfolding corthogonal_mat_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_mat (adjoint U * U) \<and> (\<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a))
[PROOF STEP]
proof (rule conjI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. diagonal_mat (adjoint U * U)
 2. \<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a)
[PROOF STEP]
have dima: "adjoint U \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint U \<in> carrier_mat n n
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
U \<in> carrier_mat n n

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

goal (2 subgoals):
 1. diagonal_mat (adjoint U * U)
 2. \<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a)
[PROOF STEP]
have aUU: "mat_adjoint U * U = (1\<^sub>m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. adjoint U * U = 1\<^sub>m n
[PROOF STEP]
apply (insert U[unfolded unitary_def] dim dima, drule conjunct2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>U \<in> carrier_mat n n; adjoint U \<in> carrier_mat n n; inverts_mat U (adjoint U)\<rbrakk> \<Longrightarrow> adjoint U * U = 1\<^sub>m n
[PROOF STEP]
apply (drule inverts_mat_symm[of "U", OF dim dima], unfold inverts_mat_def, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
adjoint U * U = 1\<^sub>m n

goal (2 subgoals):
 1. diagonal_mat (adjoint U * U)
 2. \<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
adjoint U * U = 1\<^sub>m n
[PROOF STEP]
show "diagonal_mat (mat_adjoint U * U)"
[PROOF STATE]
proof (prove)
using this:
adjoint U * U = 1\<^sub>m n

goal (1 subgoal):
 1. diagonal_mat (adjoint U * U)
[PROOF STEP]
by (simp add: diagonal_mat_def)
[PROOF STATE]
proof (state)
this:
diagonal_mat (adjoint U * U)

goal (1 subgoal):
 1. \<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a)
[PROOF STEP]
show "\<forall>i<dim_col U. (mat_adjoint U * U) $$ (i, i) \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a)
[PROOF STEP]
using dim
[PROOF STATE]
proof (prove)
using this:
U \<in> carrier_mat n n

goal (1 subgoal):
 1. \<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a)
[PROOF STEP]
by (simp add: aUU)
[PROOF STATE]
proof (state)
this:
\<forall>i<dim_col U. (adjoint U * U) $$ (i, i) \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma has_contour_integral_trivial_iff [simp]: "(f has_contour_integral i) (linepath a a) \<longleftrightarrow> i=0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_contour_integral i) (linepath a a) = (i = 0)
[PROOF STEP]
using has_contour_integral_unique
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(?f has_contour_integral ?i) ?g; (?f has_contour_integral ?j) ?g\<rbrakk> \<Longrightarrow> ?i = ?j

goal (1 subgoal):
 1. (f has_contour_integral i) (linepath a a) = (i = 0)
[PROOF STEP]
by blast


[STATEMENT]
lemma complex_cnj_fact [simp]: "cnj (fact n) = fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj (fact n) = fact n
[PROOF STEP]
by (subst of_nat_fact [symmetric], subst complex_cnj_of_nat) simp


[STATEMENT]
lemma subst_pair_compose[simp]: "d \<cdot>\<^sub>p (\<delta> \<circ>\<^sub>s \<I>) = d \<cdot>\<^sub>p \<delta> \<cdot>\<^sub>p \<I>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<cdot>\<^sub>p \<delta> \<circ>\<^sub>s \<I> = d \<cdot>\<^sub>p \<delta> \<cdot>\<^sub>p \<I>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. d \<cdot>\<^sub>p \<delta> \<circ>\<^sub>s \<I> = d \<cdot>\<^sub>p \<delta> \<cdot>\<^sub>p \<I>
[PROOF STEP]
obtain t s where "d = (t,s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>t s. d = (t, s) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by moura
[PROOF STATE]
proof (state)
this:
d = (t, s)

goal (1 subgoal):
 1. d \<cdot>\<^sub>p \<delta> \<circ>\<^sub>s \<I> = d \<cdot>\<^sub>p \<delta> \<cdot>\<^sub>p \<I>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
d = (t, s)

goal (1 subgoal):
 1. d \<cdot>\<^sub>p \<delta> \<circ>\<^sub>s \<I> = d \<cdot>\<^sub>p \<delta> \<cdot>\<^sub>p \<I>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
d \<cdot>\<^sub>p \<delta> \<circ>\<^sub>s \<I> = d \<cdot>\<^sub>p \<delta> \<cdot>\<^sub>p \<I>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bezout_add_nat:
  "\<exists>(d::nat) x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)
[PROOF STEP]
proof (induct a b rule: Euclid_induct)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) = (\<exists>d x y. d dvd b \<and> d dvd a \<and> (b * x = a * y + d \<or> a * x = b * y + d))
 2. \<And>a. \<exists>d x y. d dvd a \<and> d dvd 0 \<and> (a * x = 0 * y + d \<or> 0 * x = a * y + d)
 3. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
case (swap a b)
[PROOF STATE]
proof (state)
this:

goal (3 subgoals):
 1. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) = (\<exists>d x y. d dvd b \<and> d dvd a \<and> (b * x = a * y + d \<or> a * x = b * y + d))
 2. \<And>a. \<exists>d x y. d dvd a \<and> d dvd 0 \<and> (a * x = 0 * y + d \<or> 0 * x = a * y + d)
 3. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) = (\<exists>d x y. d dvd b \<and> d dvd a \<and> (b * x = a * y + d \<or> a * x = b * y + d))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) = (\<exists>d x y. d dvd b \<and> d dvd a \<and> (b * x = a * y + d \<or> a * x = b * y + d))

goal (2 subgoals):
 1. \<And>a. \<exists>d x y. d dvd a \<and> d dvd 0 \<and> (a * x = 0 * y + d \<or> 0 * x = a * y + d)
 2. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a. \<exists>d x y. d dvd a \<and> d dvd 0 \<and> (a * x = 0 * y + d \<or> 0 * x = a * y + d)
 2. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
case (zero a)
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>a. \<exists>d x y. d dvd a \<and> d dvd 0 \<and> (a * x = 0 * y + d \<or> 0 * x = a * y + d)
 2. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>d x y. d dvd a \<and> d dvd 0 \<and> (a * x = 0 * y + d \<or> 0 * x = a * y + d)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>d x y. d dvd a \<and> d dvd 0 \<and> (a * x = 0 * y + d \<or> 0 * x = a * y + d)

goal (1 subgoal):
 1. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
case (add a b)
[PROOF STATE]
proof (state)
this:

goal (1 subgoal):
 1. \<And>a b. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))
[PROOF STEP]
by (meson bezout_lemma_nat)
[PROOF STATE]
proof (state)
this:
(\<exists>d x y. d dvd a \<and> d dvd b \<and> (a * x = b * y + d \<or> b * x = a * y + d)) \<longrightarrow> (\<exists>d x y. d dvd a \<and> d dvd a + b \<and> (a * x = (a + b) * y + d \<or> (a + b) * x = a * y + d))

goal:
No subgoals!
[PROOF STEP]
qed