[STATEMENT]
lemma map2_nth: "\<And>n ys.
  \<lbrakk> n < length xs; n < length ys \<rbrakk> \<Longrightarrow>
  (map2 f xs ys ! n) =
  f (xs ! n) (ys ! n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n ys. \<lbrakk>n < length xs; n < length ys\<rbrakk> \<Longrightarrow> List2.map2 f xs ys ! n = f (xs ! n) (ys ! n)
[PROOF STEP]
by (simp add: map2_map_list_conv map_list_nth)


[STATEMENT]
lemma harm_integral_x_raised_n:
  "set_integrable lborel {0::real..1} (\<lambda>x. (\<Sum>i\<in>{..<n}. x ^ i))" (is ?thesis1)
  "LBINT x = 0..1. (\<Sum>i\<in>{..<n}. x ^ i) = harm n" (is ?thesis2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<n}) &&& LBINT x=0..1. sum ((^) x) {..<n} = harm n
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<n})
 2. LBINT x=0..1. sum ((^) x) {..<n} = harm n
[PROOF STEP]
have h: "set_integrable lborel {0::real..1} (\<lambda>x. (\<Sum>i\<in>{..<n}. x ^ i))" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<n})
[PROOF STEP]
by (intro borel_integrable_atLeastAtMost') (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<?n})

goal (2 subgoals):
 1. set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<n})
 2. LBINT x=0..1. sum ((^) x) {..<n} = harm n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<?n})
[PROOF STEP]
show ?thesis1
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<?n})

goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<n})
[PROOF STEP]
by (intro borel_integrable_atLeastAtMost') (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
set_integrable lborel {0..1} (\<lambda>x. sum ((^) x) {..<n})

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} = harm n
[PROOF STEP]
show ?thesis2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} = harm n
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. LBINT x=0..1. sum ((^) x) {..<0} = harm 0
 2. \<And>n. LBINT x=0..1. sum ((^) x) {..<n} = harm n \<Longrightarrow> LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. sum ((^) x) {..<n} = harm n

goal (2 subgoals):
 1. LBINT x=0..1. sum ((^) x) {..<0} = harm 0
 2. \<And>n. LBINT x=0..1. sum ((^) x) {..<n} = harm n \<Longrightarrow> LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)
[PROOF STEP]
have "(LBINT x=0..1.(\<Sum>i\<in>{..<n}. x ^ i) + x ^ n) =
          (LBINT x=0..1. (\<Sum>i\<in>{..<n}. x ^ i)) + (LBINT x=0..1. x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)
[PROOF STEP]
have "set_integrable lborel (einterval 0 1) (\<lambda>x. (\<Sum>i\<in>{..<n}. x ^ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel (einterval 0 1) (\<lambda>x. sum ((^) x) {..<n})
[PROOF STEP]
by (rule set_integrable_subset) (use h in \<open>auto simp add: einterval_def\<close>)
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval 0 1) (\<lambda>x. sum ((^) x) {..<n})

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval 0 1) (\<lambda>x. sum ((^) x) {..<n})

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)
[PROOF STEP]
have "set_integrable lborel (einterval 0 1) (\<lambda>x. (x ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)
[PROOF STEP]
have "set_integrable lborel {0::real..1} (\<lambda>x. (x ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel {0..1} (\<lambda>x. x ^ n)
[PROOF STEP]
by (rule borel_integrable_atLeastAtMost')
            (auto intro!: borel_integrable_atLeastAtMost' continuous_intros)
[PROOF STATE]
proof (state)
this:
set_integrable lborel {0..1} (\<lambda>x. x ^ n)

goal (1 subgoal):
 1. set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
set_integrable lborel {0..1} (\<lambda>x. x ^ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel {0..1} (\<lambda>x. x ^ n)

goal (1 subgoal):
 1. set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)
[PROOF STEP]
by (rule set_integrable_subset) (auto simp add: einterval_def)
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set_integrable lborel (einterval 0 1) (\<lambda>x. sum ((^) x) {..<n})
set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
set_integrable lborel (einterval 0 1) (\<lambda>x. sum ((^) x) {..<n})
set_integrable lborel (einterval 0 1) (\<lambda>x. x ^ n)

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)
[PROOF STEP]
by (auto intro!: borel_integrable_atLeastAtMost' simp add:  interval_lebesgue_integrable_def)
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)

goal (2 subgoals):
 1. LBINT x=0..1. sum ((^) x) {..<0} = harm 0
 2. \<And>n. LBINT x=0..1. sum ((^) x) {..<n} = harm n \<Longrightarrow> LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + (LBINT x=0..1. x ^ n)

goal (2 subgoals):
 1. LBINT x=0..1. sum ((^) x) {..<0} = harm 0
 2. \<And>n. LBINT x=0..1. sum ((^) x) {..<n} = harm n \<Longrightarrow> LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)
[PROOF STEP]
have "(LBINT x=0..1. x ^ n) = 1 / (1 + real n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = 1 / (1 + real n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = 1 / (1 + real n)
[PROOF STEP]
have "(LBINT x=0..1. x ^ n) = LBINT x. x ^ n * indicator {0..1} x "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x
[PROOF STEP]
have "AE x in lborel. x ^ n * indicator {0..1} x = indicator (einterval 0 1) x * x ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE x in lborel. x ^ n * indicat_real {0..1} x = indicat_real (einterval 0 1) x * x ^ n
[PROOF STEP]
by(rule eventually_mono[OF eventually_conj[OF  AE_lborel_singleton[of 1]
                  AE_lborel_singleton[of 0]]])
            (auto simp add: indicator_def einterval_def)
[PROOF STATE]
proof (state)
this:
AE x in lborel. x ^ n * indicat_real {0..1} x = indicat_real (einterval 0 1) x * x ^ n

goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE x in lborel. x ^ n * indicat_real {0..1} x = indicat_real (einterval 0 1) x * x ^ n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
AE x in lborel. x ^ n * indicat_real {0..1} x = indicat_real (einterval 0 1) x * x ^ n

goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x
[PROOF STEP]
using integral_cong_AE
[PROOF STATE]
proof (prove)
using this:
AE x in lborel. x ^ n * indicat_real {0..1} x = indicat_real (einterval 0 1) x * x ^ n
\<lbrakk>?f \<in> borel_measurable ?M; ?g \<in> borel_measurable ?M; AE x in ?M. ?f x = ?g x\<rbrakk> \<Longrightarrow> integral\<^sup>L ?M ?f = integral\<^sup>L ?M ?g

goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x
[PROOF STEP]
unfolding interval_lebesgue_integral_def set_lebesgue_integral_def
[PROOF STATE]
proof (prove)
using this:
AE x in lborel. x ^ n * indicat_real {0..1} x = indicat_real (einterval 0 1) x * x ^ n
\<lbrakk>?f \<in> borel_measurable ?M; ?g \<in> borel_measurable ?M; AE x in ?M. ?f x = ?g x\<rbrakk> \<Longrightarrow> integral\<^sup>L ?M ?f = integral\<^sup>L ?M ?g

goal (1 subgoal):
 1. (if 0 \<le> 1 then LBINT x. indicat_real (einterval 0 1) x *\<^sub>R x ^ n else - (LBINT x. indicat_real (einterval 1 0) x *\<^sub>R x ^ n)) = LBINT x. x ^ n * indicat_real {0..1} x
[PROOF STEP]
by (auto intro!: integral_cong_AE)
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x

goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = 1 / (1 + real n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
LBINT x=0..1. x ^ n = LBINT x. x ^ n * indicat_real {0..1} x

goal (1 subgoal):
 1. LBINT x=0..1. x ^ n = 1 / (1 + real n)
[PROOF STEP]
by (auto simp add: integral_power)
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. x ^ n = 1 / (1 + real n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. x ^ n = 1 / (1 + real n)

goal (2 subgoals):
 1. LBINT x=0..1. sum ((^) x) {..<0} = harm 0
 2. \<And>n. LBINT x=0..1. sum ((^) x) {..<n} = harm n \<Longrightarrow> LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + 1 / (1 + real n)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + 1 / (1 + real n)

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
LBINT x=0..1. sum ((^) x) {..<n} + x ^ n = (LBINT x=0..1. sum ((^) x) {..<n}) + 1 / (1 + real n)
LBINT x=0..1. sum ((^) x) {..<n} = harm n

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)
[PROOF STEP]
by (auto simp add: harm_def inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. sum ((^) x) {..<Suc n} = harm (Suc n)

goal (1 subgoal):
 1. LBINT x=0..1. sum ((^) x) {..<0} = harm 0
[PROOF STEP]
qed (auto simp add: harm_def)
[PROOF STATE]
proof (state)
this:
LBINT x=0..1. sum ((^) x) {..<n} = harm n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nths_map: "map f (nths xs S) = nths (map f xs) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map f (nths xs S) = nths (map f xs) S
[PROOF STEP]
apply(induct xs arbitrary: S)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>S. map f (nths [] S) = nths (map f []) S
 2. \<And>a xs S. (\<And>S. map f (nths xs S) = nths (map f xs) S) \<Longrightarrow> map f (nths (a # xs) S) = nths (map f (a # xs)) S
[PROOF STEP]
by(simp_all  add: nths_Cons)


[STATEMENT]
lemma natLeq_on_ordLeq_less:
"((natLeq_on m) <o (natLeq_on n)) = (m < n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (natLeq_on m <o natLeq_on n) = (m < n)
[PROOF STEP]
using not_ordLeq_iff_ordLess[OF natLeq_on_Well_order natLeq_on_Well_order, of n m]
   natLeq_on_ordLeq_less_eq[of n m]
[PROOF STATE]
proof (prove)
using this:
((natLeq_on n, natLeq_on m) \<notin> ordLeq) = (natLeq_on m <o natLeq_on n)
(natLeq_on n \<le>o natLeq_on m) = (n \<le> m)

goal (1 subgoal):
 1. (natLeq_on m <o natLeq_on n) = (m < n)
[PROOF STEP]
by linarith


[STATEMENT]
lemma eccentricity_obtains_inf:
  assumes "V \<noteq> {v}"
  shows "eccentricity v = \<infinity> \<or> (\<exists> u \<in> (V - {v}) . shortest_path v u = eccentricity v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
proof (cases "finite ((\<lambda> u. shortest_path v u) ` (V - {v}))")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. finite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
 2. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
finite (shortest_path v ` (V - {v}))

goal (2 subgoals):
 1. finite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
 2. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite (shortest_path v ` (V - {v}))
[PROOF STEP]
have e: "eccentricity v = Max ((\<lambda> u. shortest_path v u) ` (V - {v}))"
[PROOF STATE]
proof (prove)
using this:
finite (shortest_path v ` (V - {v}))

goal (1 subgoal):
 1. eccentricity v = Max (shortest_path v ` (V - {v}))
[PROOF STEP]
unfolding eccentricity_def
[PROOF STATE]
proof (prove)
using this:
finite (shortest_path v ` (V - {v}))

goal (1 subgoal):
 1. Sup (shortest_path v ` (V - {v})) = Max (shortest_path v ` (V - {v}))
[PROOF STEP]
using Sup_enat_def
[PROOF STATE]
proof (prove)
using this:
finite (shortest_path v ` (V - {v}))
Sup ?A = (if ?A = {} then 0 else if finite ?A then Max ?A else \<infinity>)

goal (1 subgoal):
 1. Sup (shortest_path v ` (V - {v})) = Max (shortest_path v ` (V - {v}))
[PROOF STEP]
using assms not_empty
[PROOF STATE]
proof (prove)
using this:
finite (shortest_path v ` (V - {v}))
Sup ?A = (if ?A = {} then 0 else if finite ?A then Max ?A else \<infinity>)
V \<noteq> {v}
V \<noteq> {}

goal (1 subgoal):
 1. Sup (shortest_path v ` (V - {v})) = Max (shortest_path v ` (V - {v}))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eccentricity v = Max (shortest_path v ` (V - {v}))

goal (2 subgoals):
 1. finite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
 2. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
have "(V - {v}) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. V - {v} \<noteq> {}
[PROOF STEP]
using assms not_empty
[PROOF STATE]
proof (prove)
using this:
V \<noteq> {v}
V \<noteq> {}

goal (1 subgoal):
 1. V - {v} \<noteq> {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
V - {v} \<noteq> {}

goal (2 subgoals):
 1. finite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
 2. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
V - {v} \<noteq> {}
[PROOF STEP]
have "((\<lambda> u. shortest_path v u) ` (V - {v})) \<noteq> {}"
[PROOF STATE]
proof (prove)
using this:
V - {v} \<noteq> {}

goal (1 subgoal):
 1. shortest_path v ` (V - {v}) \<noteq> {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
shortest_path v ` (V - {v}) \<noteq> {}

goal (2 subgoals):
 1. finite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
 2. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
shortest_path v ` (V - {v}) \<noteq> {}
[PROOF STEP]
obtain n where "n \<in> ((\<lambda> u. shortest_path v u) ` (V - {v}))" and "n = eccentricity v"
[PROOF STATE]
proof (prove)
using this:
shortest_path v ` (V - {v}) \<noteq> {}

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>n \<in> shortest_path v ` (V - {v}); n = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Max_in e True
[PROOF STATE]
proof (prove)
using this:
shortest_path v ` (V - {v}) \<noteq> {}
\<lbrakk>finite ?A; ?A \<noteq> {}\<rbrakk> \<Longrightarrow> Max ?A \<in> ?A
eccentricity v = Max (shortest_path v ` (V - {v}))
finite (shortest_path v ` (V - {v}))

goal (1 subgoal):
 1. (\<And>n. \<lbrakk>n \<in> shortest_path v ` (V - {v}); n = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
n \<in> shortest_path v ` (V - {v})
n = eccentricity v

goal (2 subgoals):
 1. finite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
 2. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n \<in> shortest_path v ` (V - {v})
n = eccentricity v
[PROOF STEP]
obtain u where "u \<in> (V - {v})" and "shortest_path v u = eccentricity v"
[PROOF STATE]
proof (prove)
using this:
n \<in> shortest_path v ` (V - {v})
n = eccentricity v

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>u \<in> V - {v}; shortest_path v u = eccentricity v\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
u \<in> V - {v}
shortest_path v u = eccentricity v

goal (2 subgoals):
 1. finite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
 2. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
u \<in> V - {v}
shortest_path v u = eccentricity v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
u \<in> V - {v}
shortest_path v u = eccentricity v

goal (1 subgoal):
 1. eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)

goal (1 subgoal):
 1. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
infinite (shortest_path v ` (V - {v}))

goal (1 subgoal):
 1. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
infinite (shortest_path v ` (V - {v}))
[PROOF STEP]
have "eccentricity v = \<infinity>"
[PROOF STATE]
proof (prove)
using this:
infinite (shortest_path v ` (V - {v}))

goal (1 subgoal):
 1. eccentricity v = \<infinity>
[PROOF STEP]
unfolding eccentricity_def
[PROOF STATE]
proof (prove)
using this:
infinite (shortest_path v ` (V - {v}))

goal (1 subgoal):
 1. Sup (shortest_path v ` (V - {v})) = \<infinity>
[PROOF STEP]
using Sup_enat_def
[PROOF STATE]
proof (prove)
using this:
infinite (shortest_path v ` (V - {v}))
Sup ?A = (if ?A = {} then 0 else if finite ?A then Max ?A else \<infinity>)

goal (1 subgoal):
 1. Sup (shortest_path v ` (V - {v})) = \<infinity>
[PROOF STEP]
by (metis (mono_tags, lifting) cSup_singleton empty_iff finite_insert insert_iff)
[PROOF STATE]
proof (state)
this:
eccentricity v = \<infinity>

goal (1 subgoal):
 1. infinite (shortest_path v ` (V - {v})) \<Longrightarrow> eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eccentricity v = \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
eccentricity v = \<infinity>

goal (1 subgoal):
 1. eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
eccentricity v = \<infinity> \<or> (\<exists>u\<in>V - {v}. shortest_path v u = eccentricity v)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sqmatrix_mult_0_right [simp]:
  "(A::('a::{comm_monoid_add,mult_zero},'m) sqmatrix) * 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<cdot> 0 = 0
[PROOF STEP]
by (cases A, simp add: zero_sqmatrix_def)


[STATEMENT]
lemma val_Zp_dist_triangle_eqs:
  assumes "a \<in> carrier Zp"
  assumes "b \<in> carrier Zp"
  assumes "c \<in> carrier Zp"
  assumes "val_Zp_dist a b > n"
  assumes "val_Zp_dist a c > n"
  assumes "(k::nat) < n"
  shows "a k = b k"
        "a k = c k"
        "b k = c k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a k = b k &&& a k = c k &&& b k = c k
[PROOF STEP]
unfolding val_Zp_dist_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a k = b k &&& a k = c k &&& b k = c k
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. a k = b k
 2. a k = c k
 3. b k = c k
[PROOF STEP]
show 0: "a k = b k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a k = b k
[PROOF STEP]
using assms(1) assms(2) assms(4) assms(6) val_Zp_dist_res_eq
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Zp
b \<in> carrier Zp
eint (int n) < val_Zp_dist a b
k < n
\<lbrakk>?a \<in> carrier Zp; ?b \<in> carrier Zp; eint (int ?k) < val_Zp_dist ?a ?b\<rbrakk> \<Longrightarrow> ?a ?k = ?b ?k

goal (1 subgoal):
 1. a k = b k
[PROOF STEP]
by (metis less_imp_le_nat p_residue_padic_int)
[PROOF STATE]
proof (state)
this:
a k = b k

goal (2 subgoals):
 1. a k = c k
 2. b k = c k
[PROOF STEP]
show 1: "a k = c k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a k = c k
[PROOF STEP]
using assms(1) assms(3) assms(5) assms(6) val_Zp_dist_res_eq
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier Zp
c \<in> carrier Zp
eint (int n) < val_Zp_dist a c
k < n
\<lbrakk>?a \<in> carrier Zp; ?b \<in> carrier Zp; eint (int ?k) < val_Zp_dist ?a ?b\<rbrakk> \<Longrightarrow> ?a ?k = ?b ?k

goal (1 subgoal):
 1. a k = c k
[PROOF STEP]
by (meson eint_ord_simps(1) le_less_trans less_imp_triv not_less of_nat_le_iff)
[PROOF STATE]
proof (state)
this:
a k = c k

goal (1 subgoal):
 1. b k = c k
[PROOF STEP]
show "b k = c k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b k = c k
[PROOF STEP]
using 0 1
[PROOF STATE]
proof (prove)
using this:
a k = b k
a k = c k

goal (1 subgoal):
 1. b k = c k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b k = c k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tensor_gate [simp]:
  assumes "gate m G1" and "gate n G2"
  shows "gate (m + n) (G1 \<Otimes> G2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gate (m + n) (G1 \<Otimes> G2)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. dim_row (G1 \<Otimes> G2) = 2 ^ (m + n)
 2. square_mat (G1 \<Otimes> G2)
 3. unitary (G1 \<Otimes> G2)
[PROOF STEP]
show "dim_row (G1 \<Otimes> G2) = 2^(m+n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (G1 \<Otimes> G2) = 2 ^ (m + n)
[PROOF STEP]
using assms dim_row_tensor_mat gate.dim_row
[PROOF STATE]
proof (prove)
using this:
gate m G1
gate n G2
dim_row (?A \<Otimes> ?B) = dim_row ?A * dim_row ?B
gate ?n ?A \<Longrightarrow> dim_row ?A = 2 ^ ?n

goal (1 subgoal):
 1. dim_row (G1 \<Otimes> G2) = 2 ^ (m + n)
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
dim_row (G1 \<Otimes> G2) = 2 ^ (m + n)

goal (2 subgoals):
 1. square_mat (G1 \<Otimes> G2)
 2. unitary (G1 \<Otimes> G2)
[PROOF STEP]
show "square_mat (G1 \<Otimes> G2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_mat (G1 \<Otimes> G2)
[PROOF STEP]
using assms gate.square_mat
[PROOF STATE]
proof (prove)
using this:
gate m G1
gate n G2
gate ?n ?A \<Longrightarrow> square_mat ?A

goal (1 subgoal):
 1. square_mat (G1 \<Otimes> G2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
square_mat (G1 \<Otimes> G2)

goal (1 subgoal):
 1. unitary (G1 \<Otimes> G2)
[PROOF STEP]
thus "unitary (G1 \<Otimes> G2)"
[PROOF STATE]
proof (prove)
using this:
square_mat (G1 \<Otimes> G2)

goal (1 subgoal):
 1. unitary (G1 \<Otimes> G2)
[PROOF STEP]
using assms unitary_def
[PROOF STATE]
proof (prove)
using this:
square_mat (G1 \<Otimes> G2)
gate m G1
gate n G2
unitary ?M \<equiv> ?M\<^sup>\<dagger> * ?M = 1\<^sub>m (dim_col ?M) \<and> ?M * ?M\<^sup>\<dagger> = 1\<^sub>m (dim_row ?M)

goal (1 subgoal):
 1. unitary (G1 \<Otimes> G2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
unitary (G1 \<Otimes> G2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lift_option_eq_Some: "lift_option f A B = Some y \<longleftrightarrow> (\<exists>a b. A = Some a \<and> B = Some b \<and> y = f a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (lift_option f A B = Some y) = (\<exists>a b. A = Some a \<and> B = Some b \<and> y = f a b)
[PROOF STEP]
by (cases A; cases B; auto)


[STATEMENT]
lemma (in linorder) set_iterator_rev_linord_filter_correct :
  assumes it_OK: "set_iterator_rev_linord it S"
  shows "set_iterator_rev_linord (set_iterator_filter P it) {x. x \<in> S \<and> P x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_iterator_rev_linord (set_iterator_filter P it) {x \<in> S. P x}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
set_iterator_rev_linord it S

goal (1 subgoal):
 1. set_iterator_rev_linord (set_iterator_filter P it) {x \<in> S. P x}
[PROOF STEP]
unfolding set_iterator_rev_linord_def
[PROOF STATE]
proof (prove)
using this:
set_iterator_genord it S (\<lambda>x y. y \<le> x)

goal (1 subgoal):
 1. set_iterator_genord (set_iterator_filter P it) {x \<in> S. P x} (\<lambda>x y. y \<le> x)
[PROOF STEP]
by (rule set_iterator_genord_filter_correct)


[STATEMENT]
lemma rep_neg_leq:
  shows "\<mu> (rep_neg A) \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
proof (cases "A \<notin> sets M \<or> pos_meas_set A")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A \<notin> sets M \<or> pos_meas_set A \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
 2. \<not> (A \<notin> sets M \<or> pos_meas_set A) \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A \<notin> sets M \<or> pos_meas_set A

goal (2 subgoals):
 1. A \<notin> sets M \<or> pos_meas_set A \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
 2. \<not> (A \<notin> sets M \<or> pos_meas_set A) \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
hence "rep_neg A = {}"
[PROOF STATE]
proof (prove)
using this:
A \<notin> sets M \<or> pos_meas_set A

goal (1 subgoal):
 1. rep_neg A = {}
[PROOF STEP]
unfolding rep_neg_def
[PROOF STATE]
proof (prove)
using this:
A \<notin> sets M \<or> pos_meas_set A

goal (1 subgoal):
 1. (if A \<notin> sets M \<or> pos_meas_set A then {} else SOME B. B \<in> sets M \<and> B \<subseteq> A \<and> \<mu> B \<le> ereal (- 1 / real (inf_neg A))) = {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
rep_neg A = {}

goal (2 subgoals):
 1. A \<notin> sets M \<or> pos_meas_set A \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
 2. \<not> (A \<notin> sets M \<or> pos_meas_set A) \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rep_neg A = {}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rep_neg A = {}

goal (1 subgoal):
 1. \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
using sgn_meas signed_measure_empty
[PROOF STATE]
proof (prove)
using this:
rep_neg A = {}
signed_measure M \<mu>
signed_measure ?M ?\<mu> \<Longrightarrow> ?\<mu> {} = 0

goal (1 subgoal):
 1. \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
\<mu> (rep_neg A) \<le> 0

goal (1 subgoal):
 1. \<not> (A \<notin> sets M \<or> pos_meas_set A) \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (A \<notin> sets M \<or> pos_meas_set A) \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> (A \<notin> sets M \<or> pos_meas_set A)

goal (1 subgoal):
 1. \<not> (A \<notin> sets M \<or> pos_meas_set A) \<Longrightarrow> \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> (A \<notin> sets M \<or> pos_meas_set A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> (A \<notin> sets M \<or> pos_meas_set A)

goal (1 subgoal):
 1. \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
using rep_neg_less
[PROOF STATE]
proof (prove)
using this:
\<not> (A \<notin> sets M \<or> pos_meas_set A)
\<lbrakk>?A \<in> sets M; \<not> pos_meas_set ?A\<rbrakk> \<Longrightarrow> \<mu> (rep_neg ?A) \<le> ereal (- 1 / real (inf_neg ?A))

goal (1 subgoal):
 1. \<mu> (rep_neg A) \<le> 0
[PROOF STEP]
by (metis le_ereal_le minus_divide_left
        neg_le_0_iff_le of_nat_0 of_nat_le_iff zero_ereal_def zero_le
        zero_le_divide_1_iff)
[PROOF STATE]
proof (state)
this:
\<mu> (rep_neg A) \<le> 0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in mpt) Tinv_mpt:
  assumes "invertible_qmpt"
  shows "mpt M Tinv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mpt M Tinv
[PROOF STEP]
unfolding mpt_def mpt_axioms_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. qmpt M Tinv \<and> Tinv \<in> measure_preserving M M
[PROOF STEP]
using Tinv_qmpt[OF assms] Tinv_measure_preserving[OF assms]
[PROOF STATE]
proof (prove)
using this:
qmpt M Tinv
Tinv \<in> measure_preserving M M

goal (1 subgoal):
 1. qmpt M Tinv \<and> Tinv \<in> measure_preserving M M
[PROOF STEP]
by auto


[STATEMENT]
lemma tendsto_zero_mult_right_iff [simp]:
  fixes c::"'a::{topological_semigroup_mult,field}" assumes "c \<noteq> 0" shows "(\<lambda>n. a n * c)\<longlonglongrightarrow> 0 \<longleftrightarrow> a \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. a n * c) \<longlonglongrightarrow> (0::'a) = a \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
using assms tendsto_mult_right tendsto_mult_right_iff
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'a)
(?f \<longlongrightarrow> ?l) ?F \<Longrightarrow> ((\<lambda>x. ?f x * ?c) \<longlongrightarrow> ?l * ?c) ?F
?c \<noteq> (0::?'a) \<Longrightarrow> ((\<lambda>x. ?f x * ?c) \<longlongrightarrow> ?l * ?c) ?F = (?f \<longlongrightarrow> ?l) ?F

goal (1 subgoal):
 1. (\<lambda>n. a n * c) \<longlonglongrightarrow> (0::'a) = a \<longlonglongrightarrow> (0::'a)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma emeasure_countable_singleton:
  assumes sets: "\<And>x. x \<in> X \<Longrightarrow> {x} \<in> sets M" and X: "countable X"
  shows "emeasure M X = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
have "emeasure M (\<Union>i\<in>X. {i}) = (\<integral>\<^sup>+x. emeasure M {x} \<partial>count_space X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union>i\<in>X. {i}) = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> X \<Longrightarrow> {?x} \<in> sets M
countable X

goal (1 subgoal):
 1. emeasure M (\<Union>i\<in>X. {i}) = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
by (intro emeasure_UN_countable) (auto simp: disjoint_family_on_def)
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union>i\<in>X. {i}) = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X

goal (1 subgoal):
 1. emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union>i\<in>X. {i}) = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X

goal (1 subgoal):
 1. emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
have "(\<Union>i\<in>X. {i}) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>X. {i}) = X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Union>i\<in>X. {i}) = X

goal (1 subgoal):
 1. emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X

goal (1 subgoal):
 1. emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
emeasure M X = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inorder_balR:
  "inorder (balR l a r) = inorder l @ a # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Tree2.inorder (balR l a r) = Tree2.inorder l @ a # Tree2.inorder r
[PROOF STEP]
by (auto simp: node_def balR_def split:tree.splits)


[STATEMENT]
lemma project_at_indices_append:
"project_at_indices S (as@bs) = project_at_indices S as @ project_at_indices {j. j + length as \<in> S} bs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths (as @ bs) S = nths as S @ nths bs {j. j + length as \<in> S}
[PROOF STEP]
using nths_append[of as bs S]
[PROOF STATE]
proof (prove)
using this:
nths (as @ bs) S = nths as S @ nths bs {j. j + length as \<in> S}

goal (1 subgoal):
 1. nths (as @ bs) S = nths as S @ nths bs {j. j + length as \<in> S}
[PROOF STEP]
by auto


[STATEMENT]
lemma iMin_le_iff: "I \<noteq> {} \<Longrightarrow> (iMin I \<le> n) = (\<exists>a\<in>I. a \<le> n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<noteq> {} \<Longrightarrow> (iMin I \<le> n) = (\<exists>a\<in>I. a \<le> n)
[PROOF STEP]
by (metis Collect_iMin_le Collect_mem_eq iMinI_ex2 order_trans)


[STATEMENT]
lemma fpxs_shift_power [simp]: "fpxs_shift n x ^ m = fpxs_shift (of_nat m * n) (x ^ m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fpxs_shift n x ^ m = fpxs_shift (rat_of_nat m * n) (x ^ m)
[PROOF STEP]
by (induction m) (simp_all add: algebra_simps fpxs_shift_mult flip: fpxs_shift_add_left)


[STATEMENT]
lemma continuous_imp_quotient_map:
  fixes f :: "'a::t2_space \<Rightarrow> 'b::t2_space"
  assumes "continuous_on S f" "f ` S = T" "compact S" "U \<subseteq> T"
    shows "openin (top_of_set S) (S \<inter> f -` U) \<longleftrightarrow>
           openin (top_of_set T) U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (top_of_set S) (S \<inter> f -` U) = openin (top_of_set T) U
[PROOF STEP]
by (metis (no_types, lifting) assms closed_map_imp_quotient_map continuous_imp_closed_map)


[STATEMENT]
lemma invfun_r:"\<lbrakk> f\<in>A \<rightarrow> B; inj_on f A; surj_to f A B; b \<in> B \<rbrakk>
                      \<Longrightarrow> f ((invfun A B f) b) = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; surj_to f A B; b \<in> B\<rbrakk> \<Longrightarrow> f ((f\<inverse>\<^bsub>B,A\<^esub>) b) = b
[PROOF STEP]
apply (simp add:invfun_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; surj_to f A B; b \<in> B\<rbrakk> \<Longrightarrow> f (SOME x. x \<in> A \<and> f x = b) = b
[PROOF STEP]
apply (rule someI2_ex)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; surj_to f A B; b \<in> B\<rbrakk> \<Longrightarrow> \<exists>a. a \<in> A \<and> f a = b
 2. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; surj_to f A B; b \<in> B; x \<in> A \<and> f x = b\<rbrakk> \<Longrightarrow> f x = b
[PROOF STEP]
apply (simp add:surj_to_def image_def)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; {y. \<exists>x\<in>A. y = f x} = B; b \<in> B\<rbrakk> \<Longrightarrow> \<exists>a. a \<in> A \<and> f a = b
 2. \<And>x. \<lbrakk>f \<in> A \<rightarrow> B; inj_on f A; surj_to f A B; b \<in> B; x \<in> A \<and> f x = b\<rbrakk> \<Longrightarrow> f x = b
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma PosOrd_LeftI:
  assumes "v1 :\<sqsubset>val v2" "flat v1 = flat v2"
  shows  "Left v1 :\<sqsubset>val Left v2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. val.Left v1 :\<sqsubset>val val.Left v2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v1 :\<sqsubset>val v2
flat v1 = flat v2

goal (1 subgoal):
 1. val.Left v1 :\<sqsubset>val val.Left v2
[PROOF STEP]
unfolding PosOrd_ex_def PosOrd_def2
[PROOF STATE]
proof (prove)
using this:
\<exists>p. pflat_len v2 p < pflat_len v1 p \<and> (\<forall>q\<in>Pos v1. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q) \<and> (\<forall>q\<in>Pos v2. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q)
flat v1 = flat v2

goal (1 subgoal):
 1. \<exists>p. pflat_len (val.Left v2) p < pflat_len (val.Left v1) p \<and> (\<forall>q\<in>Pos (val.Left v1). q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Left v1) q = pflat_len (val.Left v2) q) \<and> (\<forall>q\<in>Pos (val.Left v2). q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Left v1) q = pflat_len (val.Left v2) q)
[PROOF STEP]
apply(auto simp add: pflat_len_simps)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>flat v1 = flat v2; pflat_len v2 p < pflat_len v1 p; \<forall>q\<in>Pos v1. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q; \<forall>q\<in>Pos v2. q \<sqsubset>lex p \<longrightarrow> pflat_len v1 q = pflat_len v2 q\<rbrakk> \<Longrightarrow> \<exists>p. pflat_len (val.Left v2) p < pflat_len (val.Left v1) p \<and> (\<forall>q. (\<exists>ps. q = 0 # ps \<and> ps \<in> Pos v1) \<longrightarrow> q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Left v1) q = pflat_len (val.Left v2) q) \<and> (\<forall>q. (\<exists>ps. q = 0 # ps \<and> ps \<in> Pos v2) \<longrightarrow> q \<sqsubset>lex p \<longrightarrow> pflat_len (val.Left v1) q = pflat_len (val.Left v2) q)
[PROOF STEP]
by (metis less_numeral_extra(3) lex_simps(3) pflat_len_simps(3))


[STATEMENT]
lemma tendsto_minus_cancel_left:
  "(f \<longlongrightarrow> - (y::_::topological_group_add)) F \<longleftrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> y) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> - y) F = ((\<lambda>x. - f x) \<longlongrightarrow> y) F
[PROOF STEP]
using tendsto_minus_cancel[of f "- y" F]  tendsto_minus[of f "- y" F]
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. - f x) \<longlongrightarrow> - (- y)) F \<Longrightarrow> (f \<longlongrightarrow> - y) F
(f \<longlongrightarrow> - y) F \<Longrightarrow> ((\<lambda>x. - f x) \<longlongrightarrow> - (- y)) F

goal (1 subgoal):
 1. (f \<longlongrightarrow> - y) F = ((\<lambda>x. - f x) \<longlongrightarrow> y) F
[PROOF STEP]
by auto


[STATEMENT]
lemma inj_matrix_vector_mult:
  fixes A::"'a::field^'n^'m"
  assumes "invertible A"
  shows "inj ((*v) A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj ((*v) A)
[PROOF STEP]
by (metis assms inj_on_inverseI invertible_def matrix_vector_mul_assoc matrix_vector_mul_lid)


[STATEMENT]
lemma P_set_carrier:
"P_set n \<subseteq> carrier Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P_set n \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
unfolding P_set_def nonzero_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a \<in> {a \<in> carrier Q\<^sub>p. a \<noteq> \<zero>}. \<exists>y\<in>carrier Q\<^sub>p. y [^] n = a} \<subseteq> carrier Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
lemma span_insert_idI:
  assumes "r \<in> span B"
  shows "span (insert r B) = span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (insert r B) = span B
[PROOF STEP]
proof (intro subset_antisym subsetI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> span (insert r B) \<Longrightarrow> x \<in> span B
 2. \<And>x. x \<in> span B \<Longrightarrow> x \<in> span (insert r B)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> span (insert r B) \<Longrightarrow> x \<in> span B
 2. \<And>x. x \<in> span B \<Longrightarrow> x \<in> span (insert r B)
[PROOF STEP]
assume "p \<in> span (insert r B)"
[PROOF STATE]
proof (state)
this:
p \<in> span (insert r B)

goal (2 subgoals):
 1. \<And>x. x \<in> span (insert r B) \<Longrightarrow> x \<in> span B
 2. \<And>x. x \<in> span B \<Longrightarrow> x \<in> span (insert r B)
[PROOF STEP]
from this assms
[PROOF STATE]
proof (chain)
picking this:
p \<in> span (insert r B)
r \<in> span B
[PROOF STEP]
show "p \<in> span B"
[PROOF STATE]
proof (prove)
using this:
p \<in> span (insert r B)
r \<in> span B

goal (1 subgoal):
 1. p \<in> span B
[PROOF STEP]
by (rule span_insertD)
[PROOF STATE]
proof (state)
this:
p \<in> span B

goal (1 subgoal):
 1. \<And>x. x \<in> span B \<Longrightarrow> x \<in> span (insert r B)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> span B \<Longrightarrow> x \<in> span (insert r B)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> span B \<Longrightarrow> x \<in> span (insert r B)
[PROOF STEP]
assume "p \<in> span B"
[PROOF STATE]
proof (state)
this:
p \<in> span B

goal (1 subgoal):
 1. \<And>x. x \<in> span B \<Longrightarrow> x \<in> span (insert r B)
[PROOF STEP]
thus "p \<in> span (insert r B)"
[PROOF STATE]
proof (prove)
using this:
p \<in> span B

goal (1 subgoal):
 1. p \<in> span (insert r B)
[PROOF STEP]
by (rule span_insertI)
[PROOF STATE]
proof (state)
this:
p \<in> span (insert r B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compose_id_inv_into: "f ` A = B \<Longrightarrow> compose B f (\<lambda>y\<in>B. inv_into A f y) = (\<lambda>x\<in>B. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` A = B \<Longrightarrow> compose B f (restrict (inv_into A f) B) = (\<lambda>x\<in>B. x)
[PROOF STEP]
apply (simp add: compose_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f ` A = B \<Longrightarrow> (\<lambda>x\<in>B. f (if x \<in> B then inv_into A f x else undefined)) = (\<lambda>x\<in>B. x)
[PROOF STEP]
apply (rule restrict_ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>f ` A = B; x \<in> B\<rbrakk> \<Longrightarrow> f (if x \<in> B then inv_into A f x else undefined) = x
[PROOF STEP]
apply (simp add: f_inv_into_f)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sgn_mult_abs:"\<bar>x\<bar> * \<bar>sgn (a::'a::linordered_idom)\<bar> = \<bar>x * sgn a\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x\<bar> * \<bar>sgn a\<bar> = \<bar>x * sgn a\<bar>
[PROOF STEP]
by (fastforce simp add: sgn_if abs_if)


[STATEMENT]
lemma special_points_on_y_axis'' [simp]:
  shows "0\<^sub>h \<in> circline_set y_axis" and "ii\<^sub>h \<in> circline_set y_axis" and "\<infinity>\<^sub>h \<in> circline_set y_axis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>h \<in> circline_set y_axis &&& ii\<^sub>h \<in> circline_set y_axis &&& \<infinity>\<^sub>h \<in> circline_set y_axis
[PROOF STEP]
unfolding circline_set_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0\<^sub>h \<in> Collect (on_circline y_axis) &&& ii\<^sub>h \<in> Collect (on_circline y_axis) &&& \<infinity>\<^sub>h \<in> Collect (on_circline y_axis)
[PROOF STEP]
by auto


[STATEMENT]
lemma range_add [simp]:
  fixes a::"'a::group_add" shows "range ((+) a) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. surj ((+) a)
[PROOF STEP]
by (metis add_minus_cancel surjI)


[STATEMENT]
lemma SN_imp_SN_trancl: "SN R \<Longrightarrow> SN (R\<^sup>+)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SN R \<Longrightarrow> SN (R\<^sup>+)
[PROOF STEP]
unfolding SN_iff_wf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (R\<inverse>) \<Longrightarrow> wf ((R\<^sup>+)\<inverse>)
[PROOF STEP]
by (rule wf_converse_trancl)


[STATEMENT]
lemma scalar_prod_comm:
  assumes "dim_vec v = dim_vec w"
  shows "v \<bullet> w = w \<bullet> (v::'a::comm_semiring_0 vec)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v \<bullet> w = w \<bullet> v
[PROOF STEP]
by (simp add: scalar_prod_def assms, rule sum.cong, rule refl, simp only: ac_simps)


[STATEMENT]
lemma reachFrom_trans: "reachFrom s0 s1 \<Longrightarrow> reachFrom s1 s2 \<Longrightarrow> reachFrom s0 s2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>reachFrom s0 s1; reachFrom s1 s2\<rbrakk> \<Longrightarrow> reachFrom s0 s2
[PROOF STEP]
by (induction s1 arbitrary: s2 rule: reachFrom.induct) (auto intro: reachFrom_Step_Left)


[STATEMENT]
lemma fresh_image:
  fixes f :: "'a \<Rightarrow> 'b::fs"  shows "finite A \<Longrightarrow> i \<sharp> f ` A \<longleftrightarrow> (\<forall>x\<in>A. i \<sharp> f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A \<Longrightarrow> i \<sharp> f ` A = (\<forall>x\<in>A. i \<sharp> f x)
[PROOF STEP]
by (induct rule: finite_induct) (auto simp: fresh_finite_insert)


[STATEMENT]
lemma transPI: "(\<And>x y z. \<lbrakk> r x y; r y z \<rbrakk> \<Longrightarrow> r x z) \<Longrightarrow> transp r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y z. \<lbrakk>r x y; r y z\<rbrakk> \<Longrightarrow> r x z) \<Longrightarrow> transp r
[PROOF STEP]
by (fact transpI)


[STATEMENT]
lemma L3: "take k (map f xs) = map f (take k xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. take k (map f xs) = map f (take k xs)
[PROOF STEP]
using List.take_map
[PROOF STATE]
proof (prove)
using this:
take ?n (map ?f ?xs) = map ?f (take ?n ?xs)

goal (1 subgoal):
 1. take k (map f xs) = map f (take k xs)
[PROOF STEP]
by auto


[STATEMENT]
lemma is_moebius_inv [simp]:
  assumes "is_moebius m"
  shows "is_moebius (inv m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_moebius (inv m)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_moebius m

goal (1 subgoal):
 1. is_moebius (inv m)
[PROOF STEP]
using moebius_inv
[PROOF STATE]
proof (prove)
using this:
is_moebius m
moebius_pt (moebius_inv ?M) = inv (moebius_pt ?M)

goal (1 subgoal):
 1. is_moebius (inv m)
[PROOF STEP]
unfolding is_moebius_def
[PROOF STATE]
proof (prove)
using this:
\<exists>M. m = moebius_pt M
moebius_pt (moebius_inv ?M) = inv (moebius_pt ?M)

goal (1 subgoal):
 1. \<exists>M. inv m = moebius_pt M
[PROOF STEP]
by metis


[STATEMENT]
lemma expected_value_is_utility_function:
  assumes fnt: "finite outcomes" and "outcomes \<noteq> {}"
  assumes "x \<in> lotteries_on outcomes" and "y \<in> lotteries_on outcomes"
  assumes "ordinal_utility (lotteries_on outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)"
  shows "measure_pmf.expectation x u \<ge> measure_pmf.expectation y u \<longleftrightarrow> x \<succeq>[\<R>] y" (is "?L \<longleftrightarrow> ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (measure_pmf.expectation y u \<le> measure_pmf.expectation x u) = x \<succeq>[\<R>] y
[PROOF STEP]
using assms(3) assms(4) assms(5) ordinal_utility.util_def_conf
    ordinal_utility.ordinal_utility_left iffI
[PROOF STATE]
proof (prove)
using this:
x \<in> \<P> outcomes
y \<in> \<P> outcomes
ordinal_utility (\<P> outcomes) \<R> (\<lambda>x. measure_pmf.expectation x u)
\<lbrakk>ordinal_utility ?carrier ?relation ?u; ?x \<in> ?carrier; ?y \<in> ?carrier\<rbrakk> \<Longrightarrow> (?u ?y \<le> ?u ?x) = ?x \<succeq>[?relation] ?y
\<lbrakk>ordinal_utility ?carrier ?relation ?u; ?x \<succeq>[?relation] ?y\<rbrakk> \<Longrightarrow> ?u ?y \<le> ?u ?x
\<lbrakk>?P \<Longrightarrow> ?Q; ?Q \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P = ?Q

goal (1 subgoal):
 1. (measure_pmf.expectation y u \<le> measure_pmf.expectation x u) = x \<succeq>[\<R>] y
[PROOF STEP]
by (metis (no_types, lifting))


[STATEMENT]
lemma Sum_any_mapping_of: "Sum_any (\<lambda>x. mapping_of (f x)) = mapping_of (Sum_any f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x. mapping_of (f x)) = mapping_of (Sum_any f)
[PROOF STEP]
by (simp add: Sum_any.expand_set mapping_of_sum)


[STATEMENT]
lemma sin_add: "sin (x + y) = sin x * cos y + cos x * sin y"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (x + y) = sin x * cos y + cos x * sin y
[PROOF STEP]
using cos_add [of "of_real pi/2 - x" "-y"]
[PROOF STATE]
proof (prove)
using this:
cos (of_real pi / (2::'a) - x + - y) = cos (of_real pi / (2::'a) - x) * cos (- y) - sin (of_real pi / (2::'a) - x) * sin (- y)

goal (1 subgoal):
 1. sin (x + y) = sin x * cos y + cos x * sin y
[PROOF STEP]
by (simp add: cos_sin_eq) (simp add: sin_cos_eq)


[STATEMENT]
lemma split_symmetric_asymmetric:
  assumes "regular x"
    shows "split x y z \<longleftrightarrow> y \<sqinter> y\<^sup>T = x \<and> (y \<sqinter> -y\<^sup>T) \<squnion> (y \<sqinter> -y\<^sup>T)\<^sup>T = z \<sqinter> -x \<and> x \<le> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. split x y z = (y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. split x y z \<Longrightarrow> y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z
 2. y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z \<Longrightarrow> split x y z
[PROOF STEP]
assume "split x y z"
[PROOF STATE]
proof (state)
this:
split x y z

goal (2 subgoals):
 1. split x y z \<Longrightarrow> y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z
 2. y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z \<Longrightarrow> split x y z
[PROOF STEP]
thus "y \<sqinter> y\<^sup>T = x \<and> (y \<sqinter> -y\<^sup>T) \<squnion> (y \<sqinter> -y\<^sup>T)\<^sup>T = z \<sqinter> -x \<and> x \<le> z"
[PROOF STATE]
proof (prove)
using this:
split x y z

goal (1 subgoal):
 1. y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z
[PROOF STEP]
by (metis conv_complement conv_dist_inf conv_involutive inf.cobounded1 inf.sup_monoid.add_commute inf_import_p inf_sup_distrib2 le_supI1)
[PROOF STATE]
proof (state)
this:
y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z

goal (1 subgoal):
 1. y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z \<Longrightarrow> split x y z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z \<Longrightarrow> split x y z
[PROOF STEP]
assume "y \<sqinter> y\<^sup>T = x \<and> (y \<sqinter> -y\<^sup>T) \<squnion> (y \<sqinter> -y\<^sup>T)\<^sup>T = z \<sqinter> -x \<and> x \<le> z"
[PROOF STATE]
proof (state)
this:
y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z

goal (1 subgoal):
 1. y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z \<Longrightarrow> split x y z
[PROOF STEP]
thus "split x y z"
[PROOF STATE]
proof (prove)
using this:
y \<sqinter> y\<^sup>T = x \<and> y \<sqinter> - y\<^sup>T \<squnion> (y \<sqinter> - y\<^sup>T)\<^sup>T = z \<sqinter> - x \<and> x \<le> z

goal (1 subgoal):
 1. split x y z
[PROOF STEP]
by (smt (z3) assms conv_dist_sup conv_involutive inf.absorb2 inf.boundedE inf.cobounded1 inf.idem inf.sup_monoid.add_commute inf_import_p maddux_3_11_pp sup.left_commute sup_commute sup_inf_absorb)
[PROOF STATE]
proof (state)
this:
split x y z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma USUP_upto_expand_first:
  "(\<Squnion> i \<in> {0..<Suc(n)} \<bullet> P(i)) = (P(0) \<and> (\<Squnion> i \<in> {1..<Suc(n)} \<bullet> P(i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion> i \<in> {0..<Suc n} \<bullet> P i) = (P 0 \<and> (\<Squnion> i \<in> {1..<Suc n} \<bullet> P i))
[PROOF STEP]
apply (rel_auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b x. \<lbrakk>\<lbrakk>P 0\<rbrakk>\<^sub>e b; \<forall>x\<ge>Suc 0. \<lbrakk>P x\<rbrakk>\<^sub>e b \<or> \<not> x < Suc n; \<not> \<lbrakk>P x\<rbrakk>\<^sub>e b; x < Suc n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
using not_less
[PROOF STATE]
proof (prove)
using this:
(\<not> ?x < ?y) = (?y \<le> ?x)

goal (1 subgoal):
 1. \<And>b x. \<lbrakk>\<lbrakk>P 0\<rbrakk>\<^sub>e b; \<forall>x\<ge>Suc 0. \<lbrakk>P x\<rbrakk>\<^sub>e b \<or> \<not> x < Suc n; \<not> \<lbrakk>P x\<rbrakk>\<^sub>e b; x < Suc n\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by auto


[STATEMENT]
lemma diameter_ge_0:
  assumes "bounded S"  shows "0 \<le> diameter S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> diameter S
[PROOF STEP]
by (metis all_not_in_conv assms diameter_bounded_bound diameter_empty dist_self order_refl)


[STATEMENT]
lemma coprime_of_int_polyI:
  assumes "Rings.coprime p q"
  shows   "Rings.coprime (of_int_poly p) (of_int_poly q :: 'a :: {field_char_0,field_gcd} poly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. algebraic_semidom_class.coprime (of_int_poly p) (of_int_poly q)
[PROOF STEP]
using assms gcd_of_int_poly[of p q, where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
algebraic_semidom_class.coprime p q
gcd (of_int_poly p) (of_int_poly q) = Polynomial.smult (inverse (of_int (Polynomial.lead_coeff (gcd p q)))) (of_int_poly (gcd p q))

goal (1 subgoal):
 1. algebraic_semidom_class.coprime (of_int_poly p) (of_int_poly q)
[PROOF STEP]
unfolding coprime_iff_gcd_eq_1
[PROOF STATE]
proof (prove)
using this:
gcd p q = 1
gcd (of_int_poly p) (of_int_poly q) = Polynomial.smult (inverse (of_int (Polynomial.lead_coeff (gcd p q)))) (of_int_poly (gcd p q))

goal (1 subgoal):
 1. gcd (of_int_poly p) (of_int_poly q) = 1
[PROOF STEP]
by simp


[STATEMENT]
theorem left_mat_compose:
 assumes "is_tangle_diagram ws"
     and "codomain_wall ws = 0"
 shows "kauff_mat ws = (kauff_mat (ws  \<circ> (basic [])))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
have "mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)
[PROOF STEP]
using effective_matrix_kauff_mat assms  nat_0 power_0
[PROOF STATE]
proof (prove)
using this:
is_tangle_diagram ?ws \<Longrightarrow> rat_poly.row_length (kauff_mat ?ws) = 2 ^ nat (domain_wall ?ws)
is_tangle_diagram ?ws \<Longrightarrow> length (kauff_mat ?ws) = 2 ^ nat (codomain_wall ?ws)
is_tangle_diagram ?ws \<Longrightarrow> mat (rat_poly.row_length (kauff_mat ?ws)) (length (kauff_mat ?ws)) (kauff_mat ?ws)
is_tangle_diagram ws
codomain_wall ws = 0
nat 0 = 0
?a ^ 0 = (1::?'a)

goal (1 subgoal):
 1. mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
have "(kauff_mat (basic [])) = mat1 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kauff_mat (basic []) = mat1 1
[PROOF STEP]
using kauff_mat.simps(1) blockmat.simps(1) mat1_equiv
[PROOF STATE]
proof (prove)
using this:
kauff_mat (basic ?w) = blockmat ?w
blockmat [] = [[1]]
mat1 1 = [[1]]

goal (1 subgoal):
 1. kauff_mat (basic []) = mat1 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
kauff_mat (basic []) = mat1 1

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
kauff_mat (basic []) = mat1 1

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
kauff_mat (basic []) = mat1 1
[PROOF STEP]
have 1:"(kauff_mat (ws  \<circ> (basic [])))
                              = rat_poly.matrix_mult
                                          (kauff_mat ws)
                                          (kauff_mat (basic []))"
[PROOF STATE]
proof (prove)
using this:
kauff_mat (basic []) = mat1 1

goal (1 subgoal):
 1. kauff_mat (ws \<circ> basic []) = rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))
[PROOF STEP]
using tangle_compose_matrix assms is_tangle_diagram.simps
[PROOF STATE]
proof (prove)
using this:
kauff_mat (basic []) = mat1 1
is_tangle_diagram ?ws1.0 \<and> is_tangle_diagram ?ws2.0 \<and> domain_wall ?ws2.0 = codomain_wall ?ws1.0 \<Longrightarrow> kauff_mat (?ws1.0 \<circ> ?ws2.0) = rat_poly.matrix_mult (kauff_mat ?ws1.0) (kauff_mat ?ws2.0)
is_tangle_diagram ws
codomain_wall ws = 0
is_tangle_diagram (basic ?x) = True
is_tangle_diagram (?x * ?xs) = (if is_tangle_diagram ?xs then codomain_block ?x = domain_wall ?xs else False)

goal (1 subgoal):
 1. kauff_mat (ws \<circ> basic []) = rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
kauff_mat (ws \<circ> basic []) = rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)
kauff_mat (basic []) = mat1 1
kauff_mat (ws \<circ> basic []) = rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))
[PROOF STEP]
have "rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))
                             = (kauff_mat ws)"
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)
kauff_mat (basic []) = mat1 1
kauff_mat (ws \<circ> basic []) = rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))

goal (1 subgoal):
 1. rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic [])) = kauff_mat ws
[PROOF STEP]
using mat_mult_equiv mat1_mult_right
[PROOF STATE]
proof (prove)
using this:
mat (rat_poly.row_length (kauff_mat ws)) 1 (kauff_mat ws)
kauff_mat (basic []) = mat1 1
kauff_mat (ws \<circ> basic []) = rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))
rat_poly.matrix_mult ?m1.0 ?m2.0 = rat_poly.matrix_mult ?m1.0 ?m2.0
mat ?nr ?nc ?m \<Longrightarrow> mat_mult ?nr ?m (mat1 ?nc) = ?m

goal (1 subgoal):
 1. rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic [])) = kauff_mat ws
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic [])) = kauff_mat ws

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic [])) = kauff_mat ws
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic [])) = kauff_mat ws

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic [])) = kauff_mat ws
kauff_mat (ws \<circ> basic []) = rat_poly.matrix_mult (kauff_mat ws) (kauff_mat (basic []))

goal (1 subgoal):
 1. kauff_mat ws = kauff_mat (ws \<circ> basic [])
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
kauff_mat ws = kauff_mat (ws \<circ> basic [])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in CRR_market_viable) asian_option_lgeom:
  shows "asian_option T w = (\<Sum> i\<in> {1.. T}. lgeom_proc u d init (stake i w))/ T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. asian_option T w = (\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) / real T
[PROOF STEP]
using geom_lgeom stk_price geometric_process
[PROOF STATE]
proof (prove)
using this:
geom_rand_walk ?u ?d ?v ?n ?w = lgeom_proc ?u ?d ?v (stake ?n ?w)
prices Mkt stk = geom_proc
geom_proc = geom_rand_walk u d init

goal (1 subgoal):
 1. asian_option T w = (\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) / real T
[PROOF STEP]
unfolding asian_option_def
[PROOF STATE]
proof (prove)
using this:
geom_rand_walk ?u ?d ?v ?n ?w = lgeom_proc ?u ?d ?v (stake ?n ?w)
prices Mkt stk = geom_proc
geom_proc = geom_rand_walk u d init

goal (1 subgoal):
 1. (\<Sum>i = 1..T. prices Mkt stk i w) / real T = (\<Sum>i = 1..T. lgeom_proc u d init (stake i w)) / real T
[PROOF STEP]
by simp


[STATEMENT]
lemma tagged_division_Un_interval_real:
  fixes a :: real
  assumes "p1 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<le> (c::real)})"
    and "p2 tagged_division_of ({a .. b} \<inter> {x. x\<bullet>k \<ge> c})"
    and k: "k \<in> Basis"
  shows "(p1 \<union> p2) tagged_division_of {a .. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p1 \<union> p2 tagged_division_of {a..b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p1 tagged_division_of {a..b} \<inter> {x. x \<bullet> k \<le> c}
p2 tagged_division_of {a..b} \<inter> {x. c \<le> x \<bullet> k}
k \<in> Basis

goal (1 subgoal):
 1. p1 \<union> p2 tagged_division_of {a..b}
[PROOF STEP]
unfolding box_real[symmetric]
[PROOF STATE]
proof (prove)
using this:
p1 tagged_division_of cbox a b \<inter> {x. x \<bullet> k \<le> c}
p2 tagged_division_of cbox a b \<inter> {x. c \<le> x \<bullet> k}
k \<in> Basis

goal (1 subgoal):
 1. p1 \<union> p2 tagged_division_of cbox a b
[PROOF STEP]
by (rule tagged_division_Un_interval)


[STATEMENT]
lemma Gamma_real_pos_exp: "x > (0 :: real) \<Longrightarrow> Gamma x = exp (ln_Gamma x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < x \<Longrightarrow> Gamma x = exp (ln_Gamma x)
[PROOF STEP]
by (auto simp: Gamma_real_altdef2 Gamma_complex_altdef of_real_in_nonpos_Ints_iff
                 ln_Gamma_complex_of_real exp_of_real)


[STATEMENT]
lemma gcd_diff2: "gcd (n - m) n = gcd m n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (n - m) n = gcd m n
[PROOF STEP]
by (subst gcd_neg1[symmetric]) (simp only: minus_diff_eq gcd_diff1)


[STATEMENT]
lemma nba_g_rtrancl_path: "(g_E (nba_g A))\<^sup>* = {(p, target r p) |r p. NBA.path A r p}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (g_E (nba_g A))\<^sup>* = {(p, target r p) |r p. NBA.path A r p}
[PROOF STEP]
unfolding nba_g_E_rtrancl
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(p, q). q \<in> reachable A p} = {(p, target r p) |r p. NBA.path A r p}
[PROOF STEP]
by blast


[STATEMENT]
lemma cong_exp_trans[trans]:
  "[a ^ b = c] (mod n) \<Longrightarrow> [a = d] (mod n) \<Longrightarrow> [d ^ b = c] (mod n)"
  "[c = a ^ b] (mod n) \<Longrightarrow> [a = d] (mod n) \<Longrightarrow> [c = d ^ b] (mod n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lbrakk>[a ^ b = c] (mod n); [a = d] (mod n)\<rbrakk> \<Longrightarrow> [d ^ b = c] (mod n)) &&& (\<lbrakk>[c = a ^ b] (mod n); [a = d] (mod n)\<rbrakk> \<Longrightarrow> [c = d ^ b] (mod n))
[PROOF STEP]
using cong_pow cong_sym cong_trans
[PROOF STATE]
proof (prove)
using this:
[?b = ?c] (mod ?a) \<Longrightarrow> [?b ^ ?n = ?c ^ ?n] (mod ?a)
[?b = ?c] (mod ?a) \<Longrightarrow> [?c = ?b] (mod ?a)
\<lbrakk>[?b = ?c] (mod ?a); [?c = ?d] (mod ?a)\<rbrakk> \<Longrightarrow> [?b = ?d] (mod ?a)

goal (1 subgoal):
 1. (\<lbrakk>[a ^ b = c] (mod n); [a = d] (mod n)\<rbrakk> \<Longrightarrow> [d ^ b = c] (mod n)) &&& (\<lbrakk>[c = a ^ b] (mod n); [a = d] (mod n)\<rbrakk> \<Longrightarrow> [c = d ^ b] (mod n))
[PROOF STEP]
by blast+


[STATEMENT]
lemma rtos_hom5:"\<lbrakk>(0::nat) < r; (0::nat) < s; i \<le> (r *s - Suc 0);
i div s = r - Suc 0 \<rbrakk> \<Longrightarrow> Suc (rtos r s i) div r = Suc (i mod s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i div s = r - Suc 0\<rbrakk> \<Longrightarrow> Suc (rtos r s i) div r = Suc (i mod s)
[PROOF STEP]
apply (frule mult_less_mono2[of "0" "s" "r"],
        simp only:mult.commute,
        simp only:mult_0_right)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i div s = r - Suc 0; 0 < r * s\<rbrakk> \<Longrightarrow> Suc (rtos r s i) div r = Suc (i mod s)
[PROOF STEP]
apply (frule rfn_tool11 [of "r * s" "i"], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i div s = r - Suc 0; 0 < r * s; i < r * s\<rbrakk> \<Longrightarrow> Suc (rtos r s i) div r = Suc (i mod s)
[PROOF STEP]
apply (simp add: rtos_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Hermite:
  assumes a: "ass_function ass"
  and r: "res_function res"
  and b: "is_bezout_ext bezout"
  shows "\<exists>P. invertible P \<and> (Hermite_of A ass res bezout) = P ** A \<and>
  Hermite (range ass) (\<lambda>c. range (res c)) (Hermite_of A ass res bezout)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. invertible P \<and> Hermite_of A ass res bezout = P ** A \<and> Hermite (range ass) (\<lambda>c. range (res c)) (Hermite_of A ass res bezout)
[PROOF STEP]
using invertible_Hermite_of[OF a b] Hermite_Hermite_of[OF a r b]
[PROOF STATE]
proof (prove)
using this:
\<exists>P. invertible P \<and> Hermite_of ?A ass ?res bezout = P ** ?A
Hermite (range ass) (\<lambda>c. range (res c)) (Hermite_of ?A ass res bezout)

goal (1 subgoal):
 1. \<exists>P. invertible P \<and> Hermite_of A ass res bezout = P ** A \<and> Hermite (range ass) (\<lambda>c. range (res c)) (Hermite_of A ass res bezout)
[PROOF STEP]
by fast


[STATEMENT]
lemma fls_deriv_neg [simp]: "fls_deriv (-f) = - fls_deriv f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fls_deriv (- f) = - fls_deriv f
[PROOF STEP]
using fls_deriv_sub[of 0 f]
[PROOF STATE]
proof (prove)
using this:
fls_deriv (0 - f) = fls_deriv 0 - fls_deriv f

goal (1 subgoal):
 1. fls_deriv (- f) = - fls_deriv f
[PROOF STEP]
by simp


[STATEMENT]
lemma simple_function_finite_support:
  assumes f: "simple_function M f" and fin: "(\<integral>\<^sup>+x. f x \<partial>M) < \<infinity>" and nn: "\<And>x. 0 \<le> f x"
  shows "emeasure M {x\<in>space M. f x \<noteq> 0} \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
from f
[PROOF STATE]
proof (chain)
picking this:
simple_function M f
[PROOF STEP]
have meas[measurable]: "f \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
using this:
simple_function M f

goal (1 subgoal):
 1. f \<in> borel_measurable M
[PROOF STEP]
by (rule borel_measurable_simple_function)
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable M

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
assume non_empty: "\<exists>x\<in>space M. f x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
\<exists>x\<in>space M. f x \<noteq> 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
define m where "m = Min (f`space M - {0})"
[PROOF STATE]
proof (state)
this:
m = Min (f ` space M - {0})

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
have "m \<in> f`space M - {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<in> f ` space M - {0}
[PROOF STEP]
unfolding m_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Min (f ` space M - {0}) \<in> f ` space M - {0}
[PROOF STEP]
using f non_empty
[PROOF STATE]
proof (prove)
using this:
simple_function M f
\<exists>x\<in>space M. f x \<noteq> 0

goal (1 subgoal):
 1. Min (f ` space M - {0}) \<in> f ` space M - {0}
[PROOF STEP]
by (intro Min_in) (auto simp: simple_function_def)
[PROOF STATE]
proof (state)
this:
m \<in> f ` space M - {0}

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m \<in> f ` space M - {0}
[PROOF STEP]
have m: "0 < m"
[PROOF STATE]
proof (prove)
using this:
m \<in> f ` space M - {0}

goal (1 subgoal):
 1. 0 < m
[PROOF STEP]
using nn
[PROOF STATE]
proof (prove)
using this:
m \<in> f ` space M - {0}
0 \<le> f ?x

goal (1 subgoal):
 1. 0 < m
[PROOF STEP]
by (auto simp: less_le)
[PROOF STATE]
proof (state)
this:
0 < m

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
from m
[PROOF STATE]
proof (chain)
picking this:
0 < m
[PROOF STEP]
have "m * emeasure M {x\<in>space M. 0 \<noteq> f x} =
    (\<integral>\<^sup>+x. m * indicator {x\<in>space M. 0 \<noteq> f x} x \<partial>M)"
[PROOF STATE]
proof (prove)
using this:
0 < m

goal (1 subgoal):
 1. m * emeasure M {x \<in> space M. 0 \<noteq> f x} = \<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
0 < m
simple_function M f

goal (1 subgoal):
 1. m * emeasure M {x \<in> space M. 0 \<noteq> f x} = \<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M
[PROOF STEP]
by (intro nn_integral_cmult_indicator[symmetric]) auto
[PROOF STATE]
proof (state)
this:
m * emeasure M {x \<in> space M. 0 \<noteq> f x} = \<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
m * emeasure M {x \<in> space M. 0 \<noteq> f x} = \<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
have "\<dots> \<le> (\<integral>\<^sup>+x. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M \<le> integral\<^sup>N M f
[PROOF STEP]
using AE_space
[PROOF STATE]
proof (prove)
using this:
AE x in ?M. x \<in> space ?M

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M \<le> integral\<^sup>N M f
[PROOF STEP]
proof (intro nn_integral_mono_AE, eventually_elim)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>M. AE x in M. x \<in> space M; x \<in> space M\<rbrakk> \<Longrightarrow> m * indicator {x \<in> space M. 0 \<noteq> f x} x \<le> f x
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>M. AE x in M. x \<in> space M; x \<in> space M\<rbrakk> \<Longrightarrow> m * indicator {x \<in> space M. 0 \<noteq> f x} x \<le> f x
[PROOF STEP]
assume "x \<in> space M"
[PROOF STATE]
proof (state)
this:
x \<in> space M

goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<And>M. AE x in M. x \<in> space M; x \<in> space M\<rbrakk> \<Longrightarrow> m * indicator {x \<in> space M. 0 \<noteq> f x} x \<le> f x
[PROOF STEP]
with nn
[PROOF STATE]
proof (chain)
picking this:
0 \<le> f ?x
x \<in> space M
[PROOF STEP]
show "m * indicator {x \<in> space M. 0 \<noteq> f x} x \<le> f x"
[PROOF STATE]
proof (prove)
using this:
0 \<le> f ?x
x \<in> space M

goal (1 subgoal):
 1. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<le> f x
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
0 \<le> f ?x
x \<in> space M
simple_function M f

goal (1 subgoal):
 1. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<le> f x
[PROOF STEP]
by (auto split: split_indicator simp: simple_function_def m_def)
[PROOF STATE]
proof (state)
this:
m * indicator {x \<in> space M. 0 \<noteq> f x} x \<le> f x

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M \<le> integral\<^sup>N M f

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. m * indicator {x \<in> space M. 0 \<noteq> f x} x \<partial>M \<le> integral\<^sup>N M f

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
note \<open>\<dots> < \<infinity>\<close>
[PROOF STATE]
proof (state)
this:
integral\<^sup>N M f < \<infinity>

goal (2 subgoals):
 1. ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
 2. \<not> ?P \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
m * emeasure M {x \<in> space M. 0 \<noteq> f x} < \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m * emeasure M {x \<in> space M. 0 \<noteq> f x} < \<infinity>

goal (1 subgoal):
 1. emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
using m
[PROOF STATE]
proof (prove)
using this:
m * emeasure M {x \<in> space M. 0 \<noteq> f x} < \<infinity>
0 < m

goal (1 subgoal):
 1. emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
by (auto simp: ennreal_mult_less_top)
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>space M. f x \<noteq> 0) \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> (\<exists>x\<in>space M. f x \<noteq> 0) \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
assume "\<not> (\<exists>x\<in>space M. f x \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
\<not> (\<exists>x\<in>space M. f x \<noteq> 0)

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>space M. f x \<noteq> 0) \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
with nn
[PROOF STATE]
proof (chain)
picking this:
0 \<le> f ?x
\<not> (\<exists>x\<in>space M. f x \<noteq> 0)
[PROOF STEP]
have *: "{x\<in>space M. f x \<noteq> 0} = {}"
[PROOF STATE]
proof (prove)
using this:
0 \<le> f ?x
\<not> (\<exists>x\<in>space M. f x \<noteq> 0)

goal (1 subgoal):
 1. {x \<in> space M. f x \<noteq> 0} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x \<in> space M. f x \<noteq> 0} = {}

goal (1 subgoal):
 1. \<not> (\<exists>x\<in>space M. f x \<noteq> 0) \<Longrightarrow> emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M {} \<noteq> \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
emeasure M {x \<in> space M. f x \<noteq> 0} \<noteq> \<infinity>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lit_semantics_reducible_to_subset_if:
  assumes "C' \<subseteq> C"
    and "\<forall>L \<in> C'. \<not>lit_semantics \<A> L"
  shows "clause_semantics \<A> C = clause_semantics \<A> (C - C')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. clause_semantics \<A> C = clause_semantics \<A> (C - C')
[PROOF STEP]
unfolding clause_semantics_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>L\<in>C. lit_semantics \<A> L) = (\<exists>L\<in>C - C'. lit_semantics \<A> L)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
C' \<subseteq> C
\<forall>L\<in>C'. \<not> lit_semantics \<A> L

goal (1 subgoal):
 1. (\<exists>L\<in>C. lit_semantics \<A> L) = (\<exists>L\<in>C - C'. lit_semantics \<A> L)
[PROOF STEP]
by fast


[STATEMENT]
lemma gen_tlength_code [code]:
  "gen_tlength n (TNil b) = enat n"
  "gen_tlength n (TCons x xs) = gen_tlength (n + 1) xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gen_tlength n (TNil b) = enat n &&& gen_tlength n (TCons x xs) = gen_tlength (n + 1) xs
[PROOF STEP]
by(simp_all add: gen_tlength_def iadd_Suc eSuc_enat[symmetric] iadd_Suc_right)


[STATEMENT]
lemma  det_lowerdiagonal:
  fixes A :: "'a::comm_ring_1^('n::{finite,wellorder})^('n::{finite,wellorder})"
  assumes ld: "\<And>i j. i < j \<Longrightarrow> A$i$j = 0"
  shows "det A = prod (\<lambda>i. A$i$i) (UNIV:: 'n set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
let ?U = "UNIV:: 'n set"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
let ?PU = "{p. p permutes ?U}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
let ?pp = "\<lambda>p. of_int (sign p) * prod (\<lambda>i. A$i$p i) (UNIV :: 'n set)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
have fU: "finite ?U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
finite UNIV

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
have id0: "{id} \<subseteq> ?PU"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {id} \<subseteq> {p. p permutes UNIV}
[PROOF STEP]
by (auto simp: permutes_id)
[PROOF STATE]
proof (state)
this:
{id} \<subseteq> {p. p permutes UNIV}

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
have p0: "\<forall>p \<in> ?PU - {id}. ?pp p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>{p. p permutes UNIV} - {id}. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
assume "p \<in> ?PU - {id}"
[PROOF STATE]
proof (state)
this:
p \<in> {p. p permutes UNIV} - {id}

goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
p \<in> {p. p permutes UNIV} - {id}
[PROOF STEP]
obtain i where i: "p i > i"
[PROOF STATE]
proof (prove)
using this:
p \<in> {p. p permutes UNIV} - {id}

goal (1 subgoal):
 1. (\<And>i. i < p i \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by clarify (meson leI permutes_natset_le)
[PROOF STATE]
proof (state)
this:
i < p i

goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
from ld[OF i]
[PROOF STATE]
proof (chain)
picking this:
A $ i $ p i = (0::'a)
[PROOF STEP]
have "\<exists>i \<in> ?U. A$i$p i = 0"
[PROOF STATE]
proof (prove)
using this:
A $ i $ p i = (0::'a)

goal (1 subgoal):
 1. \<exists>i\<in>UNIV. A $ i $ p i = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>i\<in>UNIV. A $ i $ p i = (0::'a)

goal (1 subgoal):
 1. \<And>p. p \<in> {p. p permutes UNIV} - {id} \<Longrightarrow> of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
with prod_zero[OF fU]
[PROOF STATE]
proof (chain)
picking this:
\<exists>a\<in>UNIV. ?f a = (0::?'a) \<Longrightarrow> prod ?f UNIV = (0::?'a)
\<exists>i\<in>UNIV. A $ i $ p i = (0::'a)
[PROOF STEP]
show "?pp p = 0"
[PROOF STATE]
proof (prove)
using this:
\<exists>a\<in>UNIV. ?f a = (0::?'a) \<Longrightarrow> prod ?f UNIV = (0::?'a)
\<exists>i\<in>UNIV. A $ i $ p i = (0::'a)

goal (1 subgoal):
 1. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>p\<in>{p. p permutes UNIV} - {id}. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i) = (0::'a)

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
from sum.mono_neutral_cong_left[OF finite_permutations[OF fU] id0 p0]
[PROOF STATE]
proof (chain)
picking this:
(\<And>x. x \<in> {id} \<Longrightarrow> ?g x = of_int (sign x) * (\<Prod>i\<in>UNIV. A $ i $ x i)) \<Longrightarrow> sum ?g {id} = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {id} \<Longrightarrow> ?g x = of_int (sign x) * (\<Prod>i\<in>UNIV. A $ i $ x i)) \<Longrightarrow> sum ?g {id} = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i))

goal (1 subgoal):
 1. det A = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
unfolding det_def
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> {id} \<Longrightarrow> ?g x = of_int (sign x) * (\<Prod>i\<in>UNIV. A $ i $ x i)) \<Longrightarrow> sum ?g {id} = (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i))

goal (1 subgoal):
 1. (\<Sum>p | p permutes UNIV. of_int (sign p) * (\<Prod>i\<in>UNIV. A $ i $ p i)) = (\<Prod>i\<in>UNIV. A $ i $ i)
[PROOF STEP]
by (simp add: sign_id)
[PROOF STATE]
proof (state)
this:
det A = (\<Prod>i\<in>UNIV. A $ i $ i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma of_nat_mpoly_eq: "of_nat n = Const (of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat n = Const (of_nat n)
[PROOF STEP]
proof (induction n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. of_nat 0 = Const (of_nat 0)
 2. \<And>n. of_nat n = Const (of_nat n) \<Longrightarrow> of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. of_nat 0 = Const (of_nat 0)
 2. \<And>n. of_nat n = Const (of_nat n) \<Longrightarrow> of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
have "0 = (Const 0 :: 'a mpoly)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 = Const (0::'a)
[PROOF STEP]
by (intro mpoly_eqI) (auto simp: mpoly_coeff_Const)
[PROOF STATE]
proof (state)
this:
0 = Const (0::'a)

goal (2 subgoals):
 1. of_nat 0 = Const (of_nat 0)
 2. \<And>n. of_nat n = Const (of_nat n) \<Longrightarrow> of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 = Const (0::'a)

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

goal (1 subgoal):
 1. \<And>n. of_nat n = Const (of_nat n) \<Longrightarrow> of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. of_nat n = Const (of_nat n) \<Longrightarrow> of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
of_nat n = Const (of_nat n)

goal (1 subgoal):
 1. \<And>n. of_nat n = Const (of_nat n) \<Longrightarrow> of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
have "1 + Const (of_nat n) = Const (1 + of_nat n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + Const (of_nat n) = Const ((1::'b) + of_nat n)
[PROOF STEP]
by (intro mpoly_eqI) (auto simp: mpoly_coeff_Const mpoly_coeff_1)
[PROOF STATE]
proof (state)
this:
1 + Const (of_nat n) = Const ((1::?'b1) + of_nat n)

goal (1 subgoal):
 1. \<And>n. of_nat n = Const (of_nat n) \<Longrightarrow> of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
1 + Const (of_nat n) = Const ((1::?'b1) + of_nat n)

goal (1 subgoal):
 1. of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
1 + Const (of_nat n) = Const ((1::?'b1) + of_nat n)
of_nat n = Const (of_nat n)

goal (1 subgoal):
 1. of_nat (Suc n) = Const (of_nat (Suc n))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
of_nat (Suc n) = Const (of_nat (Suc n))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutes_funpow:
  assumes "p permutes S" shows "(p ^^ n) permutes S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p ^^ n permutes S
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
p permutes S

goal (1 subgoal):
 1. p ^^ n permutes S
[PROOF STEP]
by (induct n) (simp add: permutes_def, metis funpow_Suc_right permutes_compose)


[STATEMENT]
lemma vrangeD[dest]:
  assumes "\<langle>r, s\<rangle> \<in>\<^sub>\<circ> vrange A"
  shows "r \<in>\<^sub>\<circ> A" and "s = \<R>\<^sub>\<circ> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r \<in>\<^sub>\<circ> A &&& s = \<R>\<^sub>\<circ> r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<langle>r, s\<rangle> \<in>\<^sub>\<circ> vrange A

goal (1 subgoal):
 1. r \<in>\<^sub>\<circ> A &&& s = \<R>\<^sub>\<circ> r
[PROOF STEP]
unfolding vrange_def
[PROOF STATE]
proof (prove)
using this:
\<langle>r, s\<rangle> \<in>\<^sub>\<circ> (\<lambda>r\<in>\<^sub>\<circ>A. set {b. \<exists>a. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r})

goal (1 subgoal):
 1. r \<in>\<^sub>\<circ> A &&& s = (\<lambda>r\<in>\<^sub>\<circ>set {r}. set {b. \<exists>a. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> r})\<lparr>r\<rparr>
[PROOF STEP]
by auto


[STATEMENT]
lemma add_minus_eq:
  assumes x: "x \<in> V" and y: "y \<in> V" and xy: "x - y = 0"
  shows "x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y
[PROOF STEP]
from x y xy
[PROOF STATE]
proof (chain)
picking this:
x \<in> V
y \<in> V
x - y = (0::'a)
[PROOF STEP]
have eq: "x + - y = 0"
[PROOF STATE]
proof (prove)
using this:
x \<in> V
y \<in> V
x - y = (0::'a)

goal (1 subgoal):
 1. x + - y = (0::'a)
[PROOF STEP]
by (simp add: diff_eq1)
[PROOF STATE]
proof (state)
this:
x + - y = (0::'a)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
with _ _
[PROOF STATE]
proof (chain)
picking this:
PROP ?psi \<Longrightarrow> PROP ?psi
PROP ?psi \<Longrightarrow> PROP ?psi
x + - y = (0::'a)
[PROOF STEP]
have "x = - (- y)"
[PROOF STATE]
proof (prove)
using this:
PROP ?psi \<Longrightarrow> PROP ?psi
PROP ?psi \<Longrightarrow> PROP ?psi
x + - y = (0::'a)

goal (1 subgoal):
 1. x = - (- y)
[PROOF STEP]
by (rule add_minus_eq_minus) (simp_all add: x y)
[PROOF STATE]
proof (state)
this:
x = - (- y)

goal (1 subgoal):
 1. x = y
[PROOF STEP]
with x y
[PROOF STATE]
proof (chain)
picking this:
x \<in> V
y \<in> V
x = - (- y)
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> V
y \<in> V
x = - (- y)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma plus_adds_ppI_2:
  assumes "t adds\<^sub>p v" and "s adds\<^sub>p (v \<ominus> t)"
  shows "(t + s) adds\<^sub>p v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t + s adds\<^sub>p v
[PROOF STEP]
unfolding add.commute[of t s]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s + t adds\<^sub>p v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
t adds\<^sub>p v
s adds\<^sub>p v \<ominus> t

goal (1 subgoal):
 1. s + t adds\<^sub>p v
[PROOF STEP]
by (rule plus_adds_ppI_1)


[STATEMENT]
lemma starP_star_n: "( *p* P) (star_n X) = eventually (\<lambda>n. P (X n)) \<U>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (*p* P) (star_n X) = (\<forall>\<^sub>F n in \<U>. P (X n))
[PROOF STEP]
by (simp only: starP_def star_of_def Ifun_star_n unstar_star_n)