[STATEMENT]
lemma QR_lemma_09:
    "f_2 x mod q \<in> Res_l q \<longleftrightarrow> x mod q \<in> Res_h q"
    "f_2 x mod q \<in> Res_h q \<longleftrightarrow> x mod q \<in> Res_l q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f_2 x mod int q \<in> {0<..(int q - 1) div 2}) = (x mod int q \<in> {(int q - 1) div 2<..int q - 1}) &&& (f_2 x mod int q \<in> {(int q - 1) div 2<..int q - 1}) = (x mod int q \<in> {0<..(int q - 1) div 2})
[PROOF STEP]
using QRqp QR.QR_lemma_08 f_2_def QR.f_2_def pq_commute
[PROOF STATE]
proof (prove)
using this:
QR q p
QR ?p ?q \<Longrightarrow> (QR.f_2 ?p ?q ?x mod int ?p \<in> {0<..(int ?p - 1) div 2}) = (?x mod int ?p \<in> {(int ?p - 1) div 2<..int ?p - 1})
QR ?p ?q \<Longrightarrow> (QR.f_2 ?p ?q ?x mod int ?p \<in> {(int ?p - 1) div 2<..int ?p - 1}) = (?x mod int ?p \<in> {0<..(int ?p - 1) div 2})
f_2 ?x = int p * int q - ?x
QR ?p ?q \<Longrightarrow> QR.f_2 ?p ?q ?x = int ?p * int ?q - ?x
int p * int q = int q * int p

goal (1 subgoal):
 1. (f_2 x mod int q \<in> {0<..(int q - 1) div 2}) = (x mod int q \<in> {(int q - 1) div 2<..int q - 1}) &&& (f_2 x mod int q \<in> {(int q - 1) div 2<..int q - 1}) = (x mod int q \<in> {0<..(int q - 1) div 2})
[PROOF STEP]
by auto


[STATEMENT]
lemma fps_conv_radius_Lambert_W: "fps_conv_radius fps_Lambert_W = exp (-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
have "conv_radius (fps_nth fps_Lambert_W) = conv_radius (\<lambda>n. exp 1 ^ n * n powr (-3/2) :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius (($) fps_Lambert_W) = conv_radius (\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
proof (rule conv_radius_cong_bigtheta)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
have "fps_nth fps_Lambert_W \<in> \<Theta>(\<lambda>n. (-real n) ^ (n - 1) / fact n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. (- real n) ^ (n - 1) / fact n)
[PROOF STEP]
by (intro bigthetaI_cong eventually_mono[OF eventually_gt_at_top[of 0]])
         (auto simp: fps_nth_Lambert_W)
[PROOF STATE]
proof (state)
this:
($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. (- real n) ^ (n - 1) / fact n)

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. (- real n) ^ (n - 1) / fact n)

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
have "(\<lambda>n. (-real n) ^ (n - 1) / fact n) \<in> \<Theta>(\<lambda>n. real n ^ (n - 1) / fact n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (- real n) ^ (n - 1) / fact n) \<in> \<Theta>(\<lambda>n. real n ^ (n - 1) / fact n)
[PROOF STEP]
by (subst landau_theta.norm_iff [symmetric], subst norm_divide) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- real n) ^ (n - 1) / fact n) \<in> \<Theta>(\<lambda>n. real n ^ (n - 1) / fact n)

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (- real n) ^ (n - 1) / fact n) \<in> \<Theta>(\<lambda>n. real n ^ (n - 1) / fact n)

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
have "(\<lambda>n. (real n) ^ (n - 1) / fact n) \<in>
                 \<Theta>(\<lambda>n. (real n) ^ (n - 1) / (sqrt (2 * pi * real n) * (real n / exp 1) ^ n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real n ^ (n - 1) / fact n) \<in> \<Theta>(\<lambda>n. real n ^ (n - 1) / (sqrt (2 * pi * real n) * (real n / exp 1) ^ n))
[PROOF STEP]
by (intro asymp_equiv_imp_bigtheta asymp_equiv_intros fact_asymp_equiv)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real n ^ (n - 1) / fact n) \<in> \<Theta>(\<lambda>n. real n ^ (n - 1) / (sqrt (2 * pi * real n) * (real n / exp 1) ^ n))

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real n ^ (n - 1) / fact n) \<in> \<Theta>(\<lambda>n. real n ^ (n - 1) / (sqrt (2 * pi * real n) * (real n / exp 1) ^ n))

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
have "(\<lambda>n. (real n) ^ (n - 1) / (sqrt (2 * pi * real n) * (real n / exp 1) ^ n)) \<in>
                 \<Theta>(\<lambda>n. exp 1 ^ n * n powr (-3/2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. real n ^ (n - 1) / (sqrt (2 * pi * real n) * (real n / exp 1) ^ n)) \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
by (real_asymp simp: ln_inverse)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. real n ^ (n - 1) / (sqrt (2 * pi * real n) * (real n / exp 1) ^ n)) \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
show "fps_nth fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * n powr (-3/2) :: real)"
[PROOF STATE]
proof (prove)
using this:
($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))

goal (1 subgoal):
 1. ($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
($) fps_Lambert_W \<in> \<Theta>(\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
conv_radius (($) fps_Lambert_W) = conv_radius (\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))

goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conv_radius (($) fps_Lambert_W) = conv_radius (\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2))

goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
have "\<dots> = inverse (limsup (\<lambda>n. ereal (root n (exp 1 ^ n * real n powr - (3 / 2)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conv_radius (\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2)) = inverse (limsup (\<lambda>n. ereal (root n (exp 1 ^ n * real n powr - (3 / 2)))))
[PROOF STEP]
by (simp add: conv_radius_def)
[PROOF STATE]
proof (state)
this:
conv_radius (\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2)) = inverse (limsup (\<lambda>n. ereal (root n (exp 1 ^ n * real n powr - (3 / 2)))))

goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
conv_radius (\<lambda>n. exp 1 ^ n * real n powr (- 3 / 2)) = inverse (limsup (\<lambda>n. ereal (root n (exp 1 ^ n * real n powr - (3 / 2)))))

goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
have "limsup (\<lambda>n. ereal (root n (exp 1 ^ n * real n powr - (3 / 2)))) = exp 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (root n (exp 1 ^ n * real n powr - (3 / 2)))) = ereal (exp 1)
[PROOF STEP]
proof (intro lim_imp_Limsup tendsto_intros)
    \<comment> \<open>real\_asymp does not support \<^const>\<open>root\<close> for a variable basis natively, so
        we need to convert it to \<^const>\<open>powr\<close> first.\<close>
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
(* TODO add better "root" support to real_asymp *)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
have "(\<lambda>n. (exp 1 ^ n * real n powr -(3/2)) powr (1 / real n)) \<longlonglongrightarrow> exp 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (exp 1 ^ n * real n powr - (3 / 2)) powr (1 / real n)) \<longlonglongrightarrow> exp 1
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (exp 1 ^ n * real n powr - (3 / 2)) powr (1 / real n)) \<longlonglongrightarrow> exp 1

goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (exp 1 ^ n * real n powr - (3 / 2)) powr (1 / real n)) \<longlonglongrightarrow> exp 1

goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
have "?this \<longleftrightarrow> (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (exp 1 ^ n * real n powr - (3 / 2)) powr (1 / real n)) \<longlonglongrightarrow> exp 1 = (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
by (intro filterlim_cong eventually_mono[OF eventually_gt_at_top[of 0]])
         (auto simp: root_powr_inverse)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (exp 1 ^ n * real n powr - (3 / 2)) powr (1 / real n)) \<longlonglongrightarrow> exp 1 = (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1

goal (2 subgoals):
 1. sequentially \<noteq> bot
 2. (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
show \<dots>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1

goal (1 subgoal):
 1. (\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>x. root x (exp 1 ^ x * real x powr - (3 / 2))) \<longlonglongrightarrow> exp 1

goal (1 subgoal):
 1. sequentially \<noteq> bot
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. ereal (root n (exp 1 ^ n * real n powr - (3 / 2)))) = ereal (exp 1)

goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
conv_radius (($) fps_Lambert_W) = inverse (ereal (exp 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
conv_radius (($) fps_Lambert_W) = inverse (ereal (exp 1))

goal (1 subgoal):
 1. fps_conv_radius fps_Lambert_W = ereal (exp (- 1))
[PROOF STEP]
by (simp add: fps_conv_radius_def exp_minus)
[PROOF STATE]
proof (state)
this:
fps_conv_radius fps_Lambert_W = ereal (exp (- 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in CRR_market) bernoulli_expl_cond_expect_adapt:
  assumes "N = bernoulli_stream q"
and "0 < q"
and "q < 1"
  shows "expl_cond_expect N (proj_stoch_proc geom_proc n) f\<in> borel_measurable (G n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
have "sets N = sets M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets N = events
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
N = bernoulli_stream q
0 < q
q < 1

goal (1 subgoal):
 1. sets N = events
[PROOF STEP]
by (simp add: bernoulli bernoulli_stream_def sets_stream_space_cong)
[PROOF STATE]
proof (state)
this:
sets N = events

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
have icf: "infinite_cts_filtration p M nat_filtration"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite_cts_filtration p M nat_filtration
[PROOF STEP]
by (unfold_locales, simp)
[PROOF STATE]
proof (state)
this:
infinite_cts_filtration p M nat_filtration

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
have "G n = stoch_proc_filt M geom_proc borel n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. G n = stoch_proc_filt M geom_proc borel n
[PROOF STEP]
using stock_filtration
[PROOF STATE]
proof (prove)
using this:
G = stoch_proc_filt M geom_proc borel

goal (1 subgoal):
 1. G n = stoch_proc_filt M geom_proc borel n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
G n = stoch_proc_filt M geom_proc borel n

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
G n = stoch_proc_filt M geom_proc borel n

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
have "... = fct_gen_subalgebra M (stream_space borel) (proj_stoch_proc geom_proc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stoch_proc_filt M geom_proc borel n = fct_gen_subalgebra M (stream_space borel) (proj_stoch_proc geom_proc n)
[PROOF STEP]
proof (rule infinite_cts_filtration.stoch_proc_filt_gen)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. infinite_cts_filtration ?p M ?F
 2. borel_adapt_stoch_proc ?F geom_proc
[PROOF STEP]
show "infinite_cts_filtration p M nat_filtration"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite_cts_filtration p M nat_filtration
[PROOF STEP]
using icf
[PROOF STATE]
proof (prove)
using this:
infinite_cts_filtration p M nat_filtration

goal (1 subgoal):
 1. infinite_cts_filtration p M nat_filtration
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
infinite_cts_filtration p M nat_filtration

goal (1 subgoal):
 1. borel_adapt_stoch_proc nat_filtration geom_proc
[PROOF STEP]
show "borel_adapt_stoch_proc nat_filtration geom_proc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel_adapt_stoch_proc nat_filtration geom_proc
[PROOF STEP]
using geom_rand_walk_borel_adapted
[PROOF STATE]
proof (prove)
using this:
borel_adapt_stoch_proc nat_filtration geom_proc

goal (1 subgoal):
 1. borel_adapt_stoch_proc nat_filtration geom_proc
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
borel_adapt_stoch_proc nat_filtration geom_proc

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
stoch_proc_filt M geom_proc borel n = fct_gen_subalgebra M (stream_space borel) (proj_stoch_proc geom_proc n)

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
stoch_proc_filt M geom_proc borel n = fct_gen_subalgebra M (stream_space borel) (proj_stoch_proc geom_proc n)

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
have "... = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fct_gen_subalgebra M (stream_space borel) (proj_stoch_proc geom_proc n) = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)
[PROOF STEP]
by (rule fct_gen_subalgebra_eq_sets, (simp add: \<open>sets N = sets M\<close>))
[PROOF STATE]
proof (state)
this:
fct_gen_subalgebra M (stream_space borel) (proj_stoch_proc geom_proc n) = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)
[PROOF STEP]
have "G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)"
[PROOF STATE]
proof (prove)
using this:
G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)

goal (1 subgoal):
 1. G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
have "expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in>
    borel_measurable (fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n))
[PROOF STEP]
by (simp add: expl_cond_eq_sets assms)
[PROOF STATE]
proof (state)
this:
expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n))

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)
expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
G n = fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n)
expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (fct_gen_subalgebra N (stream_space borel) (proj_stoch_proc geom_proc n))

goal (1 subgoal):
 1. expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
expl_cond_expect N (proj_stoch_proc geom_proc n) f \<in> borel_measurable (G n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ccard_mono:
  assumes "n'\<ge>n"
  shows "n''\<ge>n' \<Longrightarrow> ccard n (n''::nat) p \<ge> ccard n n' p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n' \<le> n'' \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}
[PROOF STEP]
proof (induction n'' rule: dec_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n' \<and> p i}
 2. \<And>na. \<lbrakk>n' \<le> na; na < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> na \<and> p i}\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc na \<and> p i}
[PROOF STEP]
case base
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n' \<and> p i}
 2. \<And>na. \<lbrakk>n' \<le> na; na < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> na \<and> p i}\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc na \<and> p i}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n' \<and> p i}
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n' \<and> p i}

goal (1 subgoal):
 1. \<And>na. \<lbrakk>n' \<le> na; na < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> na \<and> p i}\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc na \<and> p i}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>na. \<lbrakk>n' \<le> na; na < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> na \<and> p i}\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc na \<and> p i}
[PROOF STEP]
case (step n'')
[PROOF STATE]
proof (state)
this:
n' \<le> n''
n'' < n''
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}

goal (1 subgoal):
 1. \<And>na. \<lbrakk>n' \<le> na; na < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> na \<and> p i}\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc na \<and> p i}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n' \<le> n''
n'' < n''
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
n' \<le> n''
n'' < n''
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
 2. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
assume "p (Suc n'')"
[PROOF STATE]
proof (state)
this:
p (Suc n'')

goal (2 subgoals):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
 2. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
p (Suc n'')

goal (2 subgoals):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
 2. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
from step.hyps assms
[PROOF STATE]
proof (chain)
picking this:
n' \<le> n''
n'' < n''
n \<le> n'
[PROOF STEP]
have "n\<le>n''"
[PROOF STATE]
proof (prove)
using this:
n' \<le> n''
n'' < n''
n \<le> n'

goal (1 subgoal):
 1. n \<le> n''
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n \<le> n''

goal (2 subgoals):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
 2. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
p (Suc n'')
n \<le> n''
[PROOF STEP]
have "ccard n (Suc n'') p = Suc (ccard n n'' p)"
[PROOF STATE]
proof (prove)
using this:
p (Suc n'')
n \<le> n''

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n'' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n'' \<and> p i})
[PROOF STEP]
using ccard_inc[of p n'' n]
[PROOF STATE]
proof (prove)
using this:
p (Suc n'')
n \<le> n''
\<lbrakk>p (Suc n''); n \<le> n''\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> Suc n'' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n'' \<and> p i})

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

goal (2 subgoals):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
 2. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {i. n < i \<and> i \<le> Suc n'' \<and> p i} = Suc (card {i. n < i \<and> i \<le> n'' \<and> p i})

goal (2 subgoals):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
 2. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
have "\<dots> \<ge> ccard n n' p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> Suc (card {i. n < i \<and> i \<le> n'' \<and> p i})
[PROOF STEP]
using step.IH
[PROOF STATE]
proof (prove)
using this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}

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

goal (2 subgoals):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
 2. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> ?P3\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}

goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
assume "\<not> p (Suc n'')"
[PROOF STATE]
proof (state)
this:
\<not> p (Suc n'')

goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<not> p (Suc n'')

goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
from step.hyps assms
[PROOF STATE]
proof (chain)
picking this:
n' \<le> n''
n'' < n''
n \<le> n'
[PROOF STEP]
have "n\<le>n''"
[PROOF STATE]
proof (prove)
using this:
n' \<le> n''
n'' < n''
n \<le> n'

goal (1 subgoal):
 1. n \<le> n''
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
n \<le> n''

goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<not> p (Suc n'')
n \<le> n''
[PROOF STEP]
have "ccard n (Suc n'') p = ccard n n'' p"
[PROOF STATE]
proof (prove)
using this:
\<not> p (Suc n'')
n \<le> n''

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> Suc n'' \<and> p i} = card {i. n < i \<and> i \<le> n'' \<and> p i}
[PROOF STEP]
using ccard_same[of p n'' n]
[PROOF STATE]
proof (prove)
using this:
\<not> p (Suc n'')
n \<le> n''
\<not> p (Suc n'') \<Longrightarrow> card {i. n < i \<and> i \<le> n'' \<and> p i} = card {i. n < i \<and> i \<le> Suc n'' \<and> p i}

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

goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {i. n < i \<and> i \<le> Suc n'' \<and> p i} = card {i. n < i \<and> i \<le> n'' \<and> p i}

goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
have "\<dots> \<ge> ccard n n' p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}
[PROOF STEP]
using step.IH
[PROOF STATE]
proof (prove)
using this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}

goal (1 subgoal):
 1. card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}

goal (1 subgoal):
 1. \<lbrakk>n' \<le> n''; n'' < n''; card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> n'' \<and> p i}; \<not> p (Suc n'')\<rbrakk> \<Longrightarrow> card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
card {i. n < i \<and> i \<le> n' \<and> p i} \<le> card {i. n < i \<and> i \<le> Suc n'' \<and> p i}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homology_exactness_axiom_2:
   "exact_seq ([homology_group (p-1) X, homology_group (p-1) (subtopology X S), relative_homology_group p X S],
              [hom_induced (p-1) (subtopology X S) {} X {} id, hom_boundary p X S])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
consider (neg) "p \<le> 0" | (int) n where "p = int (Suc n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>p \<le> 0 \<Longrightarrow> thesis; \<And>n. p = int (Suc n) \<Longrightarrow> thesis\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
by (metis linear not0_implies_Suc of_nat_0 zero_le_imp_eq_int)
[PROOF STATE]
proof (state)
this:
\<lbrakk>p \<le> 0 \<Longrightarrow> ?thesis; \<And>n. p = int (Suc n) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>p \<le> 0 \<Longrightarrow> ?thesis; \<And>n. p = int (Suc n) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis
[PROOF STEP]
have "kernel (relative_homology_group (p - 1) (subtopology X S) {})
                     (relative_homology_group (p - 1) X {})
                     (hom_induced (p - 1) (subtopology X S) {} X {} id)
            = hom_boundary p X S ` carrier (relative_homology_group p X S)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<le> 0 \<Longrightarrow> ?thesis; \<And>n. p = int (Suc n) \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p \<le> 0 \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
 2. \<And>n. p = int (Suc n) \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
case neg
[PROOF STATE]
proof (state)
this:
p \<le> 0

goal (2 subgoals):
 1. p \<le> 0 \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
 2. \<And>n. p = int (Suc n) \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
obtain x where "x \<in> carrier (relative_homology_group p X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> carrier (relative_homology_group p X S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using group_relative_homology_group group.is_monoid
[PROOF STATE]
proof (prove)
using this:
Group.group (relative_homology_group ?p ?X ?S)
Group.group ?G \<Longrightarrow> Group.monoid ?G

goal (1 subgoal):
 1. (\<And>x. x \<in> carrier (relative_homology_group p X S) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
x \<in> carrier (relative_homology_group p X S)

goal (2 subgoals):
 1. p \<le> 0 \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
 2. \<And>n. p = int (Suc n) \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
with neg
[PROOF STATE]
proof (chain)
picking this:
p \<le> 0
x \<in> carrier (relative_homology_group p X S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<le> 0
x \<in> carrier (relative_homology_group p X S)

goal (1 subgoal):
 1. kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
unfolding kernel_def singleton_group_def relative_homology_group_def
[PROOF STATE]
proof (prove)
using this:
p \<le> 0
x \<in> carrier (if p < 0 then \<lparr>carrier = {undefined}, mult = \<lambda>x y. undefined, one = undefined\<rparr> else relcycle_group (nat p) X S Mod singular_relboundary_set (nat p) X S)

goal (1 subgoal):
 1. {x \<in> carrier (if p - 1 < 0 then \<lparr>carrier = {undefined}, mult = \<lambda>x y. undefined, one = undefined\<rparr> else relcycle_group (nat (p - 1)) (subtopology X S) {} Mod singular_relboundary_set (nat (p - 1)) (subtopology X S) {}). hom_induced (p - 1) (subtopology X S) {} X {} id x = \<one>\<^bsub>if p - 1 < 0 then \<lparr>carrier = {undefined}, mult = \<lambda>x y. undefined, one = undefined\<rparr> else relcycle_group (nat (p - 1)) X {} Mod singular_relboundary_set (nat (p - 1)) X {}\<^esub>} = hom_boundary p X S ` carrier (if p < 0 then \<lparr>carrier = {undefined}, mult = \<lambda>x y. undefined, one = undefined\<rparr> else relcycle_group (nat p) X S Mod singular_relboundary_set (nat p) X S)
[PROOF STEP]
by (force simp: hom_induced_trivial hom_boundary_trivial)
[PROOF STATE]
proof (state)
this:
kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)

goal (1 subgoal):
 1. \<And>n. p = int (Suc n) \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. p = int (Suc n) \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
case int
[PROOF STATE]
proof (state)
this:
p = int (Suc n)

goal (1 subgoal):
 1. \<And>n. p = int (Suc n) \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
have "hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S)
        = carrier (relative_homology_group n (subtopology X S) {}) \<inter>
          {c. hom_induced n (subtopology X S) {} X {} id c =
           \<one>\<^bsub>relative_homology_group n X {}\<^esub>}"
        (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
have 1: "(\<And>x. x \<in> A \<Longrightarrow> x \<in> B \<longleftrightarrow> x \<in> C) \<Longrightarrow> f ` (A \<inter> B) = f ` (A \<inter> C)" for f A B C
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> (x \<in> B) = (x \<in> C)) \<Longrightarrow> f ` (A \<inter> B) = f ` (A \<inter> C)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<And>x. x \<in> ?A1 \<Longrightarrow> (x \<in> ?B1) = (x \<in> ?C1)) \<Longrightarrow> ?f1 ` (?A1 \<inter> ?B1) = ?f1 ` (?A1 \<inter> ?C1)

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
have 2: "(\<And>x. x \<in> A \<Longrightarrow> x \<in> B \<longleftrightarrow> x \<in> f -` C) \<Longrightarrow> f ` (A \<inter> B) = f ` A \<inter> C" for f A B C
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> (x \<in> B) = (x \<in> f -` C)) \<Longrightarrow> f ` (A \<inter> B) = f ` A \<inter> C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<And>x. x \<in> ?A2 \<Longrightarrow> (x \<in> ?B2) = (x \<in> ?f2 -` ?C2)) \<Longrightarrow> ?f2 ` (?A2 \<inter> ?B2) = ?f2 ` ?A2 \<inter> ?C2

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
have "?lhs = homologous_rel_set n (subtopology X S) {}
                   ` (chain_boundary (Suc n) ` singular_relcycle_set (Suc n) X S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = homologous_rel_set n (subtopology X S) {} ` chain_boundary (Suc n) ` singular_relcycle_set (Suc n) X S
[PROOF STEP]
unfolding carrier_relative_homology_group image_comp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (hom_boundary (int (Suc n)) X S \<circ> homologous_rel_set (Suc n) X S) ` singular_relcycle_set (Suc n) X S = (homologous_rel_set n (subtopology X S) {} \<circ> chain_boundary (Suc n)) ` singular_relcycle_set (Suc n) X S
[PROOF STEP]
by (rule image_cong [OF refl]) (simp add: o_def hom_boundary_chain_boundary del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = homologous_rel_set n (subtopology X S) {} ` chain_boundary (Suc n) ` singular_relcycle_set (Suc n) X S

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = homologous_rel_set n (subtopology X S) {} ` chain_boundary (Suc n) ` singular_relcycle_set (Suc n) X S

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
have "\<dots> = homologous_rel_set n (subtopology X S) {} `
                       (singular_relcycle_set n (subtopology X S) {} \<inter> singular_relboundary_set n X {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homologous_rel_set n (subtopology X S) {} ` chain_boundary (Suc n) ` singular_relcycle_set (Suc n) X S = homologous_rel_set n (subtopology X S) {} ` (singular_relcycle_set n (subtopology X S) {} \<inter> singular_relboundary_set n X {})
[PROOF STEP]
by (force simp: singular_relcycle singular_boundary chain_boundary_boundary_alt)
[PROOF STATE]
proof (state)
this:
homologous_rel_set n (subtopology X S) {} ` chain_boundary (Suc n) ` singular_relcycle_set (Suc n) X S = homologous_rel_set n (subtopology X S) {} ` (singular_relcycle_set n (subtopology X S) {} \<inter> singular_relboundary_set n X {})

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
homologous_rel_set n (subtopology X S) {} ` chain_boundary (Suc n) ` singular_relcycle_set (Suc n) X S = homologous_rel_set n (subtopology X S) {} ` (singular_relcycle_set n (subtopology X S) {} \<inter> singular_relboundary_set n X {})

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homologous_rel_set n (subtopology X S) {} ` (singular_relcycle_set n (subtopology X S) {} \<inter> singular_relboundary_set n X {}) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
unfolding carrier_relative_homology_group vimage_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homologous_rel_set n (subtopology X S) {} ` (singular_relcycle_set n (subtopology X S) {} \<inter> singular_relboundary_set n X {}) = homologous_rel_set n (subtopology X S) {} ` singular_relcycle_set n (subtopology X S) {} \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
apply (rule 2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x \<in> singular_relcycle_set n (subtopology X S) {} \<Longrightarrow> (x \<in> singular_relboundary_set n X {}) = (x \<in> homologous_rel_set n (subtopology X S) {} -` {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>})
[PROOF STEP]
apply (auto simp: hom_induced_chain_map chain_map_ident homologous_rel_set_eq_relboundary singular_relcycle)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
homologous_rel_set n (subtopology X S) {} ` (singular_relcycle_set n (subtopology X S) {} \<inter> singular_relboundary_set n X {}) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}

goal (1 subgoal):
 1. hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}

goal (1 subgoal):
 1. \<And>n. p = int (Suc n) \<Longrightarrow> kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
hom_boundary (int (Suc n)) X S ` carrier (relative_homology_group (int (Suc n)) X S) = carrier (homology_group (int n) (subtopology X S)) \<inter> {c. hom_induced (int n) (subtopology X S) {} X {} id c = \<one>\<^bsub>homology_group (int n) X\<^esub>}

goal (1 subgoal):
 1. kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
by (auto simp: kernel_def int)
[PROOF STATE]
proof (state)
this:
kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)

goal (1 subgoal):
 1. exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)

goal (1 subgoal):
 1. exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
using hom_boundary_hom hom_induced_hom
[PROOF STATE]
proof (prove)
using this:
kernel (homology_group (p - 1) (subtopology X S)) (homology_group (p - 1) X) (hom_induced (p - 1) (subtopology X S) {} X {} id) = hom_boundary p X S ` carrier (relative_homology_group p X S)
hom_boundary ?p ?X ?S \<in> hom (relative_homology_group ?p ?X ?S) (homology_group (?p - 1) (subtopology ?X ?S))
hom_induced ?p ?X ?S ?Y ?T ?f \<in> hom (relative_homology_group ?p ?X ?S) (relative_homology_group ?p ?Y ?T)

goal (1 subgoal):
 1. exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])
[PROOF STEP]
by (force simp: group_hom_def group_hom_axioms_def)
[PROOF STATE]
proof (state)
this:
exact_seq ([homology_group (p - 1) X, homology_group (p - 1) (subtopology X S), relative_homology_group p X S], [hom_induced (p - 1) (subtopology X S) {} X {} id, hom_boundary p X S])

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lconcat_llist_of:
  "lconcat (llist_of (map llist_of xs)) = llist_of (concat xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lconcat (llist_of (map llist_of xs)) = llist_of (concat xs)
[PROOF STEP]
by(induct xs)(simp_all add: lappend_llist_of_llist_of)


[STATEMENT]
lemma in_set_spmf_iff_spmf: "x \<in> set_spmf p \<longleftrightarrow> spmf p x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> set_spmf p) = (spmf p x \<noteq> 0)
[PROOF STEP]
by(auto simp add: set_spmf_def set_pmf_iff intro: rev_image_eqI)


[STATEMENT]
lemma cf_bcomp_Hom_ArrMap_app[cat_cs_simps]:
  assumes "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "[f, g]\<^sub>\<circ> \<in>\<^sub>\<circ> (op_cat \<AA> \<times>\<^sub>C \<BB>)\<lparr>Arr\<rparr>"
  shows
    "Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,\<GG>-)\<lparr>ArrMap\<rparr>\<lparr>f, g\<rparr>\<^sub>\<bullet> =
      Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-)\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>, \<GG>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr>\<rparr>\<^sub>\<bullet>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,\<GG>-)\<^esub> g = \<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-)\<^esub> \<GG>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[f, g]\<^sub>\<circ> \<in>\<^sub>\<circ> (op_cat \<AA> \<times>\<^sub>C \<BB>)\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. f \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(\<FF>-,\<GG>-)\<^esub> g = \<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-)\<^esub> \<GG>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr>
[PROOF STEP]
unfolding cf_bcomp_Hom_def
[PROOF STATE]
proof (prove)
using this:
\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[f, g]\<^sub>\<circ> \<in>\<^sub>\<circ> (op_cat \<AA> \<times>\<^sub>C \<BB>)\<lparr>Arr\<rparr>

goal (1 subgoal):
 1. f \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>cf_cn_cov_bcomp Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-) \<FF> \<GG>\<^esub> g = \<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> \<otimes>\<^sub>H\<^sub>M\<^sub>.\<^sub>A\<^bsub>Hom\<^sub>O\<^sub>.\<^sub>C\<^bsub>\<alpha>\<^esub>\<CC>(-,-)\<^esub> \<GG>\<lparr>ArrMap\<rparr>\<lparr>g\<rparr>
[PROOF STEP]
by (rule cf_cn_cov_bcomp_ArrMap_app)


[STATEMENT]
lemma LFP_lemma3:
  assumes "Mono f" "f \<in> carrier L \<rightarrow> carrier L"
  shows "LFP f \<sqsubseteq> f (LFP f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LFP f \<sqsubseteq> f (LFP f)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Mono f
f \<in> carrier L \<rightarrow> carrier L

goal (1 subgoal):
 1. LFP f \<sqsubseteq> f (LFP f)
[PROOF STEP]
by (simp add: Pi_def) (metis LFP_closed LFP_lemma2 LFP_lowerbound assms(2) use_iso2)


[STATEMENT]
lemma ZfunI: "(\<And>r. 0 < r \<Longrightarrow> eventually (\<lambda>x. norm (f x) < r) F) \<Longrightarrow> Zfun f F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r. 0 < r \<Longrightarrow> \<forall>\<^sub>F x in F. norm (f x) < r) \<Longrightarrow> Zfun f F
[PROOF STEP]
by (simp add: Zfun_def)


[STATEMENT]
lemma times_divide_eq_left [simp]:
  "a \<in> carrier R \<Longrightarrow> b \<in> carrier R \<Longrightarrow> c \<in> carrier R \<Longrightarrow> c \<noteq> \<zero> \<Longrightarrow>
    (b \<oslash> c) \<otimes> a = b \<otimes> a \<oslash> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier R; b \<in> carrier R; c \<in> carrier R; c \<noteq> \<zero>\<rbrakk> \<Longrightarrow> b \<oslash> c \<otimes> a = b \<otimes> a \<oslash> c
[PROOF STEP]
by (simp add: m_div_def m_ac)


[STATEMENT]
lemma sorted_wrt_map_mono:
  assumes "sorted_wrt Q xs"
    and "\<And>x y. Q x y \<Longrightarrow> P (f x) (f y)"
  shows "sorted_wrt P (map f xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt P (map f xs)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
sorted_wrt Q xs
Q ?x ?y \<Longrightarrow> P (f ?x) (f ?y)

goal (1 subgoal):
 1. sorted_wrt P (map f xs)
[PROOF STEP]
by (induct xs) (auto)


[STATEMENT]
lemma Fvars_scnj[simp]:
  "F \<subseteq> fmla \<Longrightarrow> finite F \<Longrightarrow>Fvars (scnj F) = \<Union> (Fvars ` F)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<subseteq> fmla; finite F\<rbrakk> \<Longrightarrow> Fvars (scnj F) = \<Union> (Fvars ` F)
[PROOF STEP]
unfolding scnj_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>F \<subseteq> fmla; finite F\<rbrakk> \<Longrightarrow> Fvars (lcnj (asList F)) = \<Union> (Fvars ` F)
[PROOF STEP]
by auto


[STATEMENT]
lemma prime_factorization_prime_power:
  "prime p \<Longrightarrow> prime_factorization (p ^ n) = replicate_mset n p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> prime_factorization (p ^ n) = replicate_mset n p
[PROOF STEP]
by (induction n)
     (simp_all add: prime_factorization_mult prime_factorization_prime Multiset.union_commute)


[STATEMENT]
lemma join_return:
  assumes "sets M = sets N" and "subprob_space M"
  shows "join (return (subprob_algebra N) M) = M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. join (return (subprob_algebra N) M) = M
[PROOF STEP]
by (rule measure_eqI)
     (simp_all add: emeasure_join space_subprob_algebra
                    measurable_emeasure_subprob_algebra nn_integral_return assms)


[STATEMENT]
lemma NSsummable_NSLIMSEQ_zero: "NSsummable f \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. NSsummable f \<Longrightarrow> f \<longlonglongrightarrow>\<^sub>N\<^sub>S 0
[PROOF STEP]
by (metis HNatInfinite_add NSLIMSEQ_def NSsummable_NSCauchy approx_hrabs_zero_cancel star_of_zero sumhr_Suc)


[STATEMENT]
lemma coeffs_Const: "coeffs (Const c) = (if c = 0 then {} else {c})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeffs (Const c) = (if c = (0::'a) then {} else {c})
[PROOF STEP]
unfolding Const_def Const\<^sub>0_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. MPoly_Type.coeffs (map_fun id MPoly (Poly_Mapping.single 0) c) = (if c = (0::'a) then {} else {c})
[PROOF STEP]
by transfer' auto


[STATEMENT]
lemma eval_ternary_simps_2:
      "eval_ternary_And (bool_to_ternary P) T = TernaryTrue \<longleftrightarrow> P \<and> T = TernaryTrue"
      "eval_ternary_And T (bool_to_ternary P) = TernaryTrue \<longleftrightarrow> P \<and> T = TernaryTrue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eval_ternary_And (bool_to_ternary P) T = TernaryTrue) = (P \<and> T = TernaryTrue) &&& (eval_ternary_And T (bool_to_ternary P) = TernaryTrue) = (P \<and> T = TernaryTrue)
[PROOF STEP]
apply(case_tac [!] P)
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. P \<Longrightarrow> (eval_ternary_And (bool_to_ternary P) T = TernaryTrue) = (P \<and> T = TernaryTrue)
 2. \<not> P \<Longrightarrow> (eval_ternary_And (bool_to_ternary P) T = TernaryTrue) = (P \<and> T = TernaryTrue)
 3. P \<Longrightarrow> (eval_ternary_And T (bool_to_ternary P) = TernaryTrue) = (P \<and> T = TernaryTrue)
 4. \<not> P \<Longrightarrow> (eval_ternary_And T (bool_to_ternary P) = TernaryTrue) = (P \<and> T = TernaryTrue)
[PROOF STEP]
apply(simp_all add: eval_ternary_simps_simple)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma char_poly_transpose_mat[simp]: assumes A: "A \<in> carrier_mat n n"
  shows "char_poly (transpose_mat A) = char_poly A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A\<^sup>T = char_poly A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. char_poly A\<^sup>T = char_poly A
[PROOF STEP]
let ?A = "[:0, 1:] \<cdot>\<^sub>m 1\<^sub>m (dim_row A) + map_mat (\<lambda>a. [:- a:]) A"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. char_poly A\<^sup>T = char_poly A
[PROOF STEP]
have A': "?A \<in> carrier_mat n n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [:0::'a, 1::'a:] \<cdot>\<^sub>m 1\<^sub>m (dim_row A) + map_mat (\<lambda>a. [:- a:]) A \<in> carrier_mat n n
[PROOF STEP]
using A
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n n

goal (1 subgoal):
 1. [:0::'a, 1::'a:] \<cdot>\<^sub>m 1\<^sub>m (dim_row A) + map_mat (\<lambda>a. [:- a:]) A \<in> carrier_mat n n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
[:0::'a, 1::'a:] \<cdot>\<^sub>m 1\<^sub>m (dim_row A) + map_mat (\<lambda>a. [:- a:]) A \<in> carrier_mat n n

goal (1 subgoal):
 1. char_poly A\<^sup>T = char_poly A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. char_poly A\<^sup>T = char_poly A
[PROOF STEP]
unfolding char_poly_defs
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det ([:0::'a, 1::'a:] \<cdot>\<^sub>m 1\<^sub>m (dim_row A\<^sup>T) + map_mat (\<lambda>a. [:- a:]) A\<^sup>T) = det ([:0::'a, 1::'a:] \<cdot>\<^sub>m 1\<^sub>m (dim_row A) + map_mat (\<lambda>a. [:- a:]) A)
[PROOF STEP]
by (subst det_transpose[symmetric, OF A'], rule arg_cong[of _ _ det],
    insert A, auto)
[PROOF STATE]
proof (state)
this:
char_poly A\<^sup>T = char_poly A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma vec_mult_inner: "(A *v v) \<bullet> w = v \<bullet> (transpose A *v w)" for A :: "real ^'n^'n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A *v v) \<bullet> w = v \<bullet> (Finite_Cartesian_Product.transpose A *v w)
[PROOF STEP]
unfolding matrix_vector_mult_def transpose_def inner_vec_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. (\<chi>i. \<Sum>j\<in>UNIV. A $ i $ j * v $ j) $ i \<bullet> w $ i) = (\<Sum>i\<in>UNIV. v $ i \<bullet> (\<chi>i. \<Sum>j\<in>UNIV. (\<chi>i j. A $ j $ i) $ i $ j * w $ j) $ i)
[PROOF STEP]
apply(simp add: sum_distrib_right sum_distrib_left)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>UNIV. \<Sum>n\<in>UNIV. A $ i $ n * v $ n * w $ i) = (\<Sum>i\<in>UNIV. \<Sum>n\<in>UNIV. v $ i * (A $ n $ i * w $ n))
[PROOF STEP]
apply(subst sum.swap)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>UNIV. \<Sum>i\<in>UNIV. A $ i $ j * v $ j * w $ i) = (\<Sum>i\<in>UNIV. \<Sum>n\<in>UNIV. v $ i * (A $ n $ i * w $ n))
[PROOF STEP]
apply(subgoal_tac "\<forall>i j. A $ i $ j * v $ j * w $ i = v $ j * (A $ i $ j * w $ i)")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>i j. A $ i $ j * v $ j * w $ i = v $ j * (A $ i $ j * w $ i) \<Longrightarrow> (\<Sum>j\<in>UNIV. \<Sum>i\<in>UNIV. A $ i $ j * v $ j * w $ i) = (\<Sum>i\<in>UNIV. \<Sum>n\<in>UNIV. v $ i * (A $ n $ i * w $ n))
 2. \<forall>i j. A $ i $ j * v $ j * w $ i = v $ j * (A $ i $ j * w $ i)
[PROOF STEP]
by presburger simp


[STATEMENT]
lemma E_cong:
  fixes f::"'a \<Rightarrow> real"
  shows "finite (set_pmf X) \<Longrightarrow> (\<forall>x\<in> set_pmf X. (f x) = (u x)) \<Longrightarrow> E (map_pmf f X) = E (map_pmf u X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x = u x\<rbrakk> \<Longrightarrow> E (map_pmf f X) = E (map_pmf u X)
[PROOF STEP]
unfolding E_def integral_map_pmf
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x = u x\<rbrakk> \<Longrightarrow> measure_pmf.expectation X f = measure_pmf.expectation X u
[PROOF STEP]
apply(rule integral_cong_AE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x = u x\<rbrakk> \<Longrightarrow> measure_pmf.random_variable X borel f
 2. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x = u x\<rbrakk> \<Longrightarrow> measure_pmf.random_variable X borel u
 3. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x = u x\<rbrakk> \<Longrightarrow> AE x in measure_pmf X. f x = u x
[PROOF STEP]
apply(simp add: integrable_measure_pmf_finite)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite (set_pmf X); \<forall>x\<in>set_pmf X. f x = u x\<rbrakk> \<Longrightarrow> AE x in measure_pmf X. f x = u x
[PROOF STEP]
by (simp add: AE_measure_pmf_iff)


[STATEMENT]
lemma sum_supp:
  fixes f::"'a::finite \<Rightarrow> real"
  shows "sum f (supp f) = sum f UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (supp f) = sum f UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum f (supp f) = sum f UNIV
[PROOF STEP]
have "sum f (UNIV - supp f) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (UNIV - supp f) = 0
[PROOF STEP]
by(simp add:supp_def)
[PROOF STATE]
proof (state)
this:
sum f (UNIV - supp f) = 0

goal (1 subgoal):
 1. sum f (supp f) = sum f UNIV
[PROOF STEP]
hence "sum f (supp f) = sum f (UNIV - supp f) + sum f (supp f)"
[PROOF STATE]
proof (prove)
using this:
sum f (UNIV - supp f) = 0

goal (1 subgoal):
 1. sum f (supp f) = sum f (UNIV - supp f) + sum f (supp f)
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
sum f (supp f) = sum f (UNIV - supp f) + sum f (supp f)

goal (1 subgoal):
 1. sum f (supp f) = sum f UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum f (supp f) = sum f (UNIV - supp f) + sum f (supp f)

goal (1 subgoal):
 1. sum f (supp f) = sum f UNIV
[PROOF STEP]
have "... = sum f UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f (UNIV - supp f) + sum f (supp f) = sum f UNIV
[PROOF STEP]
by(simp add:sum.subset_diff[symmetric])
[PROOF STATE]
proof (state)
this:
sum f (UNIV - supp f) + sum f (supp f) = sum f UNIV

goal (1 subgoal):
 1. sum f (supp f) = sum f UNIV
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum f (supp f) = sum f UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum f (supp f) = sum f UNIV

goal (1 subgoal):
 1. sum f (supp f) = sum f UNIV
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum f (supp f) = sum f UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_set_lebesgue_integral_at_left:
  fixes a b :: real and f :: "real \<Rightarrow> 'a :: {banach,second_countable_topology}"
  assumes "a < b" and sets: "\<And>b'. b' \<in> {a..<b} \<Longrightarrow> {a..b'} \<in> sets M"
      and "set_integrable M {a..<b} f"
  shows   "((\<lambda>b'. set_lebesgue_integral M {a..b'} f) \<longlongrightarrow>
             set_lebesgue_integral M {a..<b} f) (at_left b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>b'. set_lebesgue_integral M {a..b'} f) \<longlongrightarrow> set_lebesgue_integral M {a..<b} f) (at_left b)
[PROOF STEP]
proof (rule tendsto_at_left_sequentially[OF assms(1)], goal_cases)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < b; \<And>n. a < S n; incseq S; S \<longlonglongrightarrow> b\<rbrakk> \<Longrightarrow> (\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M {a..<b} f
[PROOF STEP]
case (1 S)
[PROOF STATE]
proof (state)
this:
S ?n < b
a < S ?n
incseq S
S \<longlonglongrightarrow> b

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < b; \<And>n. a < S n; incseq S; S \<longlonglongrightarrow> b\<rbrakk> \<Longrightarrow> (\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M {a..<b} f
[PROOF STEP]
have eq: "(\<Union>n. {a..S n}) = {a..<b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>n. {a..S n}) = {a..<b}
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x n. \<lbrakk>n \<in> UNIV; x \<in> {a..S n}\<rbrakk> \<Longrightarrow> x \<in> {a..<b}
 2. \<And>x. x \<in> {a..<b} \<Longrightarrow> x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
fix x n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x n. \<lbrakk>n \<in> UNIV; x \<in> {a..S n}\<rbrakk> \<Longrightarrow> x \<in> {a..<b}
 2. \<And>x. x \<in> {a..<b} \<Longrightarrow> x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
assume "x \<in> {a..S n}"
[PROOF STATE]
proof (state)
this:
x \<in> {a..S n}

goal (2 subgoals):
 1. \<And>x n. \<lbrakk>n \<in> UNIV; x \<in> {a..S n}\<rbrakk> \<Longrightarrow> x \<in> {a..<b}
 2. \<And>x. x \<in> {a..<b} \<Longrightarrow> x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
with 1(1,2)[of n]
[PROOF STATE]
proof (chain)
picking this:
S n < b
a < S n
x \<in> {a..S n}
[PROOF STEP]
show "x \<in> {a..<b}"
[PROOF STATE]
proof (prove)
using this:
S n < b
a < S n
x \<in> {a..S n}

goal (1 subgoal):
 1. x \<in> {a..<b}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> {a..<b}

goal (1 subgoal):
 1. \<And>x. x \<in> {a..<b} \<Longrightarrow> x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..<b} \<Longrightarrow> x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> {a..<b} \<Longrightarrow> x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
assume "x \<in> {a..<b}"
[PROOF STATE]
proof (state)
this:
x \<in> {a..<b}

goal (1 subgoal):
 1. \<And>x. x \<in> {a..<b} \<Longrightarrow> x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
with order_tendstoD[OF \<open>S \<longlonglongrightarrow> b\<close>, of x]
[PROOF STATE]
proof (chain)
picking this:
x < b \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. x < S xa
b < x \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. S xa < x
x \<in> {a..<b}
[PROOF STEP]
show "x \<in> (\<Union>n. {a..S n})"
[PROOF STATE]
proof (prove)
using this:
x < b \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. x < S xa
b < x \<Longrightarrow> \<forall>\<^sub>F xa in sequentially. S xa < x
x \<in> {a..<b}

goal (1 subgoal):
 1. x \<in> (\<Union>n. {a..S n})
[PROOF STEP]
by (force simp: eventually_at_top_linorder dest: less_imp_le)
[PROOF STATE]
proof (state)
this:
x \<in> (\<Union>n. {a..S n})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Union>n. {a..S n}) = {a..<b}

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < b; \<And>n. a < S n; incseq S; S \<longlonglongrightarrow> b\<rbrakk> \<Longrightarrow> (\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M {a..<b} f
[PROOF STEP]
have "(\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M (\<Union>n. {a..S n}) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M (\<Union>n. {a..S n}) f
[PROOF STEP]
by (rule set_integral_cont_up) (insert assms 1, auto simp: eq incseq_def decseq_def less_imp_le)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M (\<Union>n. {a..S n}) f

goal (1 subgoal):
 1. \<And>S. \<lbrakk>\<And>n. S n < b; \<And>n. a < S n; incseq S; S \<longlonglongrightarrow> b\<rbrakk> \<Longrightarrow> (\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M {a..<b} f
[PROOF STEP]
with eq
[PROOF STATE]
proof (chain)
picking this:
(\<Union>n. {a..S n}) = {a..<b}
(\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M (\<Union>n. {a..S n}) f
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Union>n. {a..S n}) = {a..<b}
(\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M (\<Union>n. {a..S n}) f

goal (1 subgoal):
 1. (\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M {a..<b} f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. set_lebesgue_integral M {a..S n} f) \<longlonglongrightarrow> set_lebesgue_integral M {a..<b} f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lead_coeff_sym_mpoly_powerprod:
  assumes "finite A" "\<And>x. x \<in> X \<Longrightarrow> f x \<in> {1..card A}"
  shows   "lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f (x::'a)) ^ g x) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
have eq: "lead_coeff (sym_mpoly A (f x) ^ g x :: 'b mpoly) = 1" if "x \<in> X" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
using that assms
[PROOF STATE]
proof (prove)
using this:
x \<in> X
finite A
?x \<in> X \<Longrightarrow> f ?x \<in> {1..card A}

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
by (subst lead_coeff_power) (auto simp: lead_coeff_sym_mpoly assms)
[PROOF STATE]
proof (state)
this:
?x \<in> X \<Longrightarrow> Symmetric_Polynomials.lead_coeff (sym_mpoly A (f ?x) ^ g ?x) = (1::'b)

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
hence "(\<Prod>x\<in>X. lead_coeff (sym_mpoly A (f x) ^ g x :: 'b mpoly)) = (\<Prod>x\<in>X. 1)"
[PROOF STATE]
proof (prove)
using this:
?x \<in> X \<Longrightarrow> Symmetric_Polynomials.lead_coeff (sym_mpoly A (f ?x) ^ g ?x) = (1::'b)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x)) = (\<Prod>x\<in>X. (1::'b))
[PROOF STEP]
by (intro prod.cong eq refl)
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x)) = (\<Prod>x\<in>X. (1::'b))

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x)) = (\<Prod>x\<in>X. (1::'b))

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Prod>x\<in>X. (1::'b)) = (1::'b)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. (1::'b)) = (1::'b)

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Prod>x\<in>X. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x)) = (1::'b)
[PROOF STEP]
have eq': "(\<Prod>x\<in>X. lead_coeff (sym_mpoly A (f x) ^ g x :: 'b mpoly)) = 1"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>x\<in>X. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x)) = (1::'b)

goal (1 subgoal):
 1. (\<Prod>x\<in>X. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x)) = (1::'b)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Prod>x\<in>X. Symmetric_Polynomials.lead_coeff (sym_mpoly A (f x) ^ g x)) = (1::'b)

goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)
[PROOF STEP]
by (subst lead_coeff_prod) (auto simp: eq eq')
[PROOF STATE]
proof (state)
this:
Symmetric_Polynomials.lead_coeff (\<Prod>x\<in>X. sym_mpoly A (f x) ^ g x) = (1::'b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iT_Plus_iRelease_conv: "(P t1. t1 \<R> t2 (I \<oplus> k). Q t2) = (P (t1 + k). t1 \<R> t2 I. Q (t2 + k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P t1. t1 \<R> t2 I \<oplus> k. Q t2) = (P (t1 + k). t1 \<R> t2 I. Q (t2 + k))
[PROOF STEP]
by (simp add: iRelease_iWeakUntil_conv iT_Plus_iWeakUntil_conv)


[STATEMENT]
lemma "(cl, f) \<in> CLF \<Longrightarrow> CLF = (SIGMA cl: CL.{f. f \<in> pset cl}) \<Longrightarrow> f \<in> pset cl"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(cl, f) \<in> CLF; CLF = (SIGMA cl:CL. {f. f \<in> pset cl})\<rbrakk> \<Longrightarrow> f \<in> pset cl
[PROOF STEP]
by (metis Collect_mem_eq SigmaD2)


[STATEMENT]
lemma rank_less_imp_inconsistent:
  fixes A::"'a::{field}^'cols::{mod_type}^'rows::{mod_type}"
  assumes inc: "rank A < (if (\<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) then (to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0) + 1) else 0)"
  shows "inconsistent A b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inconsistent A b
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> inconsistent A b \<Longrightarrow> False
[PROOF STEP]
define i where "i = (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
i = (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a))

goal (1 subgoal):
 1. \<not> inconsistent A b \<Longrightarrow> False
[PROOF STEP]
define j where "j = (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))"
[PROOF STATE]
proof (state)
this:
j = (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A))

goal (1 subgoal):
 1. \<not> inconsistent A b \<Longrightarrow> False
[PROOF STEP]
assume "\<not> inconsistent A b"
[PROOF STATE]
proof (state)
this:
\<not> inconsistent A b

goal (1 subgoal):
 1. \<not> inconsistent A b \<Longrightarrow> False
[PROOF STEP]
hence ex_solution: "\<exists>x. is_solution x A b"
[PROOF STATE]
proof (prove)
using this:
\<not> inconsistent A b

goal (1 subgoal):
 1. \<exists>x. is_solution x A b
[PROOF STEP]
unfolding inconsistent_def consistent_def
[PROOF STATE]
proof (prove)
using this:
\<not> (\<nexists>x. is_solution x A b)

goal (1 subgoal):
 1. \<exists>x. is_solution x A b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>x. is_solution x A b

goal (1 subgoal):
 1. \<not> inconsistent A b \<Longrightarrow> False
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. is_solution x A b
[PROOF STEP]
obtain x where "is_solution x A b"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. is_solution x A b

goal (1 subgoal):
 1. (\<And>x. is_solution x A b \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
is_solution x A b

goal (1 subgoal):
 1. \<not> inconsistent A b \<Longrightarrow> False
[PROOF STEP]
hence is_solution_solve: "is_solution x (Gauss_Jordan A) (P_Gauss_Jordan A *v b)"
[PROOF STATE]
proof (prove)
using this:
is_solution x A b

goal (1 subgoal):
 1. is_solution x (Gauss_Jordan A) (P_Gauss_Jordan A *v b)
[PROOF STEP]
using is_solution_solve_system
[PROOF STATE]
proof (prove)
using this:
is_solution x A b
is_solution ?x ?A ?b = is_solution ?x (fst (solve_system ?A ?b)) (snd (solve_system ?A ?b))

goal (1 subgoal):
 1. is_solution x (Gauss_Jordan A) (P_Gauss_Jordan A *v b)
[PROOF STEP]
by (metis Gauss_Jordan_PA_eq P_Gauss_Jordan_def fst_conv snd_conv solve_system_def)
[PROOF STATE]
proof (state)
this:
is_solution x (Gauss_Jordan A) (P_Gauss_Jordan A *v b)

goal (1 subgoal):
 1. \<not> inconsistent A b \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
proof (cases "A=0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A = 0 \<Longrightarrow> False
 2. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
A = 0

goal (2 subgoals):
 1. A = 0 \<Longrightarrow> False
 2. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence rank_eq_0: "rank A = 0"
[PROOF STATE]
proof (prove)
using this:
A = 0

goal (1 subgoal):
 1. rank A = 0
[PROOF STEP]
using rank_0
[PROOF STATE]
proof (prove)
using this:
A = 0
rank 0 = 0

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

goal (2 subgoals):
 1. A = 0 \<Longrightarrow> False
 2. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence exists_not_0:"(\<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0)"
[PROOF STATE]
proof (prove)
using this:
rank A = 0

goal (1 subgoal):
 1. \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)
[PROOF STEP]
using inc
[PROOF STATE]
proof (prove)
using this:
rank A = 0
rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)
[PROOF STEP]
unfolding inconsistent
[PROOF STATE]
proof (prove)
using this:
rank A = 0
rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)
[PROOF STEP]
using to_nat_plus_1_set[of "(GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> 0)"]
[PROOF STATE]
proof (prove)
using this:
rank A = 0
rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)
mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 \<in> {1..<CARD('rows) + 1}

goal (1 subgoal):
 1. \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)

goal (2 subgoals):
 1. A = 0 \<Longrightarrow> False
 2. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. False
[PROOF STEP]
using True \<open>is_solution x A b\<close> exists_not_0 is_solution_def
[PROOF STATE]
proof (prove)
using this:
A = 0
is_solution x A b
\<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)
is_solution ?x ?A ?b = (?A *v ?x = ?b)

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

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
A \<noteq> 0

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
have j_less_i: "j<i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. j < i
[PROOF STEP]
have rank_less_greatest_i: "rank A < to_nat i + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A < mod_type_class.to_nat i + 1
[PROOF STEP]
using inc
[PROOF STATE]
proof (prove)
using this:
rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. rank A < mod_type_class.to_nat i + 1
[PROOF STEP]
unfolding i_def inconsistent
[PROOF STATE]
proof (prove)
using this:
rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. rank A < mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
rank A < mod_type_class.to_nat i + 1

goal (1 subgoal):
 1. j < i
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
rank A < mod_type_class.to_nat i + 1

goal (1 subgoal):
 1. j < i
[PROOF STEP]
have rank_eq_greatest_A: "rank A = to_nat j + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = mod_type_class.to_nat j + 1
[PROOF STEP]
unfolding j_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A = mod_type_class.to_nat (GREATEST a. \<not> is_zero_row a (Gauss_Jordan A)) + 1
[PROOF STEP]
by (rule rank_eq_suc_to_nat_greatest[OF False])
[PROOF STATE]
proof (state)
this:
rank A = mod_type_class.to_nat j + 1

goal (1 subgoal):
 1. j < i
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
rank A < mod_type_class.to_nat i + 1
rank A = mod_type_class.to_nat j + 1
[PROOF STEP]
have "to_nat j + 1 < to_nat i + 1"
[PROOF STATE]
proof (prove)
using this:
rank A < mod_type_class.to_nat i + 1
rank A = mod_type_class.to_nat j + 1

goal (1 subgoal):
 1. mod_type_class.to_nat j + 1 < mod_type_class.to_nat i + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j + 1 < mod_type_class.to_nat i + 1

goal (1 subgoal):
 1. j < i
[PROOF STEP]
hence "to_nat j < to_nat i"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat j + 1 < mod_type_class.to_nat i + 1

goal (1 subgoal):
 1. mod_type_class.to_nat j < mod_type_class.to_nat i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mod_type_class.to_nat j < mod_type_class.to_nat i

goal (1 subgoal):
 1. j < i
[PROOF STEP]
thus "j<i"
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat j < mod_type_class.to_nat i

goal (1 subgoal):
 1. j < i
[PROOF STEP]
by (metis (full_types) not_le to_nat_mono')
[PROOF STATE]
proof (state)
this:
j < i

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

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
have is_zero_i: "is_zero_row i (Gauss_Jordan A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row i (Gauss_Jordan A)
[PROOF STEP]
by (metis (full_types) j_def j_less_i not_greater_Greatest)
[PROOF STATE]
proof (state)
this:
is_zero_row i (Gauss_Jordan A)

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
have "(Gauss_Jordan A *v x) $ i = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Gauss_Jordan A *v x) $ i = (0::'a)
[PROOF STEP]
proof (unfold matrix_vector_mult_def, auto, rule sum.neutral,clarify)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> UNIV \<Longrightarrow> Gauss_Jordan A $ i $ xa * x $ xa = (0::'a)
[PROOF STEP]
fix a::'cols
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>xa. xa \<in> UNIV \<Longrightarrow> Gauss_Jordan A $ i $ xa * x $ xa = (0::'a)
[PROOF STEP]
show "Gauss_Jordan A $ i $ a * x $ a = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan A $ i $ a * x $ a = (0::'a)
[PROOF STEP]
using is_zero_i
[PROOF STATE]
proof (prove)
using this:
is_zero_row i (Gauss_Jordan A)

goal (1 subgoal):
 1. Gauss_Jordan A $ i $ a * x $ a = (0::'a)
[PROOF STEP]
unfolding is_zero_row_def'
[PROOF STATE]
proof (prove)
using this:
\<forall>j. Gauss_Jordan A $ i $ j = (0::'a)

goal (1 subgoal):
 1. Gauss_Jordan A $ i $ a * x $ a = (0::'a)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Gauss_Jordan A $ i $ a * x $ a = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(Gauss_Jordan A *v x) $ i = (0::'a)

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(Gauss_Jordan A *v x) $ i = (0::'a)

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
have "(Gauss_Jordan A *v x) $ i \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
have "Gauss_Jordan A *v x = P_Gauss_Jordan A *v b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gauss_Jordan A *v x = P_Gauss_Jordan A *v b
[PROOF STEP]
using is_solution_def is_solution_solve
[PROOF STATE]
proof (prove)
using this:
is_solution ?x ?A ?b = (?A *v ?x = ?b)
is_solution x (Gauss_Jordan A) (P_Gauss_Jordan A *v b)

goal (1 subgoal):
 1. Gauss_Jordan A *v x = P_Gauss_Jordan A *v b
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Gauss_Jordan A *v x = P_Gauss_Jordan A *v b

goal (1 subgoal):
 1. (Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Gauss_Jordan A *v x = P_Gauss_Jordan A *v b

goal (1 subgoal):
 1. (Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
have "... $ i \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P_Gauss_Jordan A *v b) $ i \<noteq> (0::'a)
[PROOF STEP]
unfolding i_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P_Gauss_Jordan A *v b) $ (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) \<noteq> (0::'a)
[PROOF STEP]
proof (rule GreatestI_ex)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>x. (P_Gauss_Jordan A *v b) $ x \<noteq> (0::'a)
[PROOF STEP]
show "\<exists>x. (P_Gauss_Jordan A *v b) $ x \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. (P_Gauss_Jordan A *v b) $ x \<noteq> (0::'a)
[PROOF STEP]
using inc
[PROOF STATE]
proof (prove)
using this:
rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. \<exists>x. (P_Gauss_Jordan A *v b) $ x \<noteq> (0::'a)
[PROOF STEP]
unfolding i_def inconsistent
[PROOF STATE]
proof (prove)
using this:
rank A < (if \<exists>a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a) then mod_type_class.to_nat (GREATEST a. (P_Gauss_Jordan A *v b) $ a \<noteq> (0::'a)) + 1 else 0)

goal (1 subgoal):
 1. \<exists>x. (P_Gauss_Jordan A *v b) $ x \<noteq> (0::'a)
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
\<exists>x. (P_Gauss_Jordan A *v b) $ x \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(P_Gauss_Jordan A *v b) $ i \<noteq> (0::'a)

goal (1 subgoal):
 1. (Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Gauss_Jordan A *v x) $ i \<noteq> (0::'a)

goal (1 subgoal):
 1. (Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(Gauss_Jordan A *v x) $ i \<noteq> (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(Gauss_Jordan A *v x) $ i \<noteq> (0::'a)

goal (1 subgoal):
 1. A \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(Gauss_Jordan A *v x) $ i = (0::'a)
(Gauss_Jordan A *v x) $ i \<noteq> (0::'a)
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
(Gauss_Jordan A *v x) $ i = (0::'a)
(Gauss_Jordan A *v x) $ i \<noteq> (0::'a)

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma aboveS_AboveS_trans:
assumes TRANS: "trans r" and ANTISYM: "antisym r" and
        IN1: "a \<in> aboveS r b" and IN2: "b \<in> AboveS r C"
shows "a \<in> AboveS r C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> AboveS r C
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<in> AboveS r C
[PROOF STEP]
from IN2
[PROOF STATE]
proof (chain)
picking this:
b \<in> AboveS r C
[PROOF STEP]
have "b \<in> Above r C"
[PROOF STATE]
proof (prove)
using this:
b \<in> AboveS r C

goal (1 subgoal):
 1. b \<in> Above r C
[PROOF STEP]
using AboveS_subset_Above[of r C]
[PROOF STATE]
proof (prove)
using this:
b \<in> AboveS r C
AboveS r C \<subseteq> Above r C

goal (1 subgoal):
 1. b \<in> Above r C
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b \<in> Above r C

goal (1 subgoal):
 1. a \<in> AboveS r C
[PROOF STEP]
with aboveS_Above_trans assms
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>trans ?r; antisym ?r; ?a \<in> aboveS ?r ?b; ?b \<in> Above ?r ?C\<rbrakk> \<Longrightarrow> ?a \<in> AboveS ?r ?C
trans r
antisym r
a \<in> aboveS r b
b \<in> AboveS r C
b \<in> Above r C
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>trans ?r; antisym ?r; ?a \<in> aboveS ?r ?b; ?b \<in> Above ?r ?C\<rbrakk> \<Longrightarrow> ?a \<in> AboveS ?r ?C
trans r
antisym r
a \<in> aboveS r b
b \<in> AboveS r C
b \<in> Above r C

goal (1 subgoal):
 1. a \<in> AboveS r C
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
a \<in> AboveS r C

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma theorem24xxiv_pp:
  "-(x * y) \<squnion> --(x * z) = -(x * (y \<sqinter> -z)) \<squnion> --(x * z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x * y) \<squnion> - - (x * z) = - (x * (y \<sqinter> - z)) \<squnion> - - (x * z)
[PROOF STEP]
by (metis p_dist_inf theorem24xxiii)


[STATEMENT]
lemma distinct_adj_Cons: "distinct_adj (x # xs) \<longleftrightarrow> xs = [] \<or> x \<noteq> hd xs \<and> distinct_adj xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct_adj (x # xs) = (xs = [] \<or> x \<noteq> hd xs \<and> distinct_adj xs)
[PROOF STEP]
by (cases xs) auto


[STATEMENT]
lemma int_lsb_numeral [simp]:
  "lsb (0 :: int) = False"
  "lsb (1 :: int) = True"
  "lsb (Numeral1 :: int) = True"
  "lsb (- 1 :: int) = True"
  "lsb (- Numeral1 :: int) = True"
  "lsb (numeral (num.Bit0 w) :: int) = False"
  "lsb (numeral (num.Bit1 w) :: int) = True"
  "lsb (- numeral (num.Bit0 w) :: int) = False"
  "lsb (- numeral (num.Bit1 w) :: int) = True"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((lsb 0 = False &&& lsb 1 = True) &&& lsb Numeral1 = True &&& lsb (- 1) = True) &&& (lsb (- Numeral1) = True &&& lsb (numeral (num.Bit0 w)) = False) &&& lsb (numeral (num.Bit1 w)) = True &&& lsb (- numeral (num.Bit0 w)) = False &&& lsb (- numeral (num.Bit1 w)) = True
[PROOF STEP]
by (simp_all add: lsb_int_def bit_0)


[STATEMENT]
lemma frechet_derivative_scaleR_fun:
  "y differentiable at a \<Longrightarrow>
  frechet_derivative (x *\<^sub>R y) (at a) =
    x *\<^sub>R frechet_derivative y (at a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y differentiable at a \<Longrightarrow> frechet_derivative (x *\<^sub>R y) (at a) = x *\<^sub>R frechet_derivative y (at a)
[PROOF STEP]
by (rule frechet_derivative_at')
    (auto intro!: derivative_eq_intros frechet_derivative_worksI)


[STATEMENT]
lemma ord_option_Some2_iff: "ord_option R x (Some b) \<longleftrightarrow> (\<forall>a. x = Some a \<longrightarrow> R a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ord_option R x (Some b) = (\<forall>a. x = Some a \<longrightarrow> R a b)
[PROOF STEP]
by (cases x; auto)


[STATEMENT]
lemma inf_transitive:
  "transitive x \<Longrightarrow> transitive y \<Longrightarrow> transitive (x \<sqinter> y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>transitive x; transitive y\<rbrakk> \<Longrightarrow> transitive (x \<sqinter> y)
[PROOF STEP]
by (meson inf_mono order_trans mult_left_sub_dist_inf_left mult_left_sub_dist_inf_right mult_right_sub_dist_inf)


[STATEMENT]
lemma Nats_mult_nonpos_Ints: "x \<in> \<nat> \<Longrightarrow> y \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x * y \<in> \<int>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> \<nat>; y \<in> \<int>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> x * y \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
using Nats_mult[of x "-y"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x \<in> \<nat>; - y \<in> \<nat>\<rbrakk> \<Longrightarrow> x * - y \<in> \<nat>

goal (1 subgoal):
 1. \<lbrakk>x \<in> \<nat>; y \<in> \<int>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> x * y \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by (simp add: uminus_in_Nats_iff)