[STATEMENT]
lemma derived_set_of_mono:
   "S \<subseteq> T \<Longrightarrow> X derived_set_of S \<subseteq> X derived_set_of T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> T \<Longrightarrow> X derived_set_of S \<subseteq> X derived_set_of T
[PROOF STEP]
unfolding derived_set_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> T \<Longrightarrow> {x \<in> topspace X. \<forall>T. x \<in> T \<and> openin X T \<longrightarrow> (\<exists>y. y \<noteq> x \<and> y \<in> S \<and> y \<in> T)} \<subseteq> {x \<in> topspace X. \<forall>Ta. x \<in> Ta \<and> openin X Ta \<longrightarrow> (\<exists>y. y \<noteq> x \<and> y \<in> T \<and> y \<in> Ta)}
[PROOF STEP]
by blast


[STATEMENT]
lemma goodstein_aux:
  "goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) =
    goodsteinC (c+2) (N2H (c+3) (H2N (c+3) (N2H (c+2) (n+1)) - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = goodsteinC (c + 2) (N2H (c + 3) (H2N (c + 3) (N2H (c + 2) (n + 1)) - 1))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = goodsteinC (c + 2) (N2H (c + 3) (H2N (c + 3) (N2H (c + 2) (n + 1)) - 1))
[PROOF STEP]
have [simp]: "n \<noteq> C [] \<Longrightarrow> goodsteinC c n = goodsteinC (c+1) (stepC c n)" for c n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<noteq> C [] \<Longrightarrow> goodsteinC c n = goodsteinC (c + 1) (stepC c n)
[PROOF STEP]
by (induct c n rule: stepC.induct) simp_all
[PROOF STATE]
proof (state)
this:
?n \<noteq> C [] \<Longrightarrow> goodsteinC ?c ?n = goodsteinC (?c + 1) (stepC ?c ?n)

goal (1 subgoal):
 1. goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = goodsteinC (c + 2) (N2H (c + 3) (H2N (c + 3) (N2H (c + 2) (n + 1)) - 1))
[PROOF STEP]
have [simp]: "stepC (Suc c) (N2H (Suc (Suc c)) (Suc n)) \<in> hbase (Suc (Suc (Suc c)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stepC (Suc c) (N2H (Suc (Suc c)) (Suc n)) \<in> hbase (Suc (Suc (Suc c)))
[PROOF STEP]
by (metis H2N_def N2H_inv evalC_surjective hbase_ext.intros(1) hbase_mono stepC_sound)
[PROOF STATE]
proof (state)
this:
stepC (Suc c) (N2H (Suc (Suc c)) (Suc n)) \<in> hbase (Suc (Suc (Suc c)))

goal (1 subgoal):
 1. goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = goodsteinC (c + 2) (N2H (c + 3) (H2N (c + 3) (N2H (c + 2) (n + 1)) - 1))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = goodsteinC (c + 2) (N2H (c + 3) (H2N (c + 3) (N2H (c + 2) (n + 1)) - 1))
[PROOF STEP]
using arg_cong[OF stepC_dec[of "N2H (c+2) (n+1)" "c+1", folded H2N_def], of "\<lambda>n. N2H (c+3) (n-1)"]
[PROOF STATE]
proof (prove)
using this:
N2H (c + 2) (n + 1) \<noteq> C [] \<Longrightarrow> N2H (c + 3) (Suc (H2N (Suc (Suc (c + 1))) (stepC (c + 1) (N2H (c + 2) (n + 1)))) - 1) = N2H (c + 3) (H2N (Suc (Suc (c + 1))) (N2H (c + 2) (n + 1)) - 1)

goal (1 subgoal):
 1. goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = goodsteinC (c + 2) (N2H (c + 3) (H2N (c + 3) (N2H (c + 2) (n + 1)) - 1))
[PROOF STEP]
by (simp add: eval_nat_numeral N2H_inv)
[PROOF STATE]
proof (state)
this:
goodsteinC (Suc c) (N2H (Suc (Suc c)) (Suc n)) = goodsteinC (c + 2) (N2H (c + 3) (H2N (c + 3) (N2H (c + 2) (n + 1)) - 1))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma closed_imp_fip_compact:
  fixes S :: "'a::heine_borel set"
  shows
   "\<lbrakk>closed S; \<And>T. T \<in> \<F> \<Longrightarrow> compact T;
     \<And>\<F>'. \<lbrakk>finite \<F>'; \<F>' \<subseteq> \<F>\<rbrakk> \<Longrightarrow> S \<inter> \<Inter>\<F>' \<noteq> {}\<rbrakk>
        \<Longrightarrow> S \<inter> \<Inter>\<F> \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>closed S; \<And>T. T \<in> \<F> \<Longrightarrow> compact T; \<And>\<F>'. \<lbrakk>finite \<F>'; \<F>' \<subseteq> \<F>\<rbrakk> \<Longrightarrow> S \<inter> \<Inter> \<F>' \<noteq> {}\<rbrakk> \<Longrightarrow> S \<inter> \<Inter> \<F> \<noteq> {}
[PROOF STEP]
by (metis Inf_greatest closed_imp_fip compact_eq_bounded_closed empty_subsetI finite.emptyI inf.orderE)


[STATEMENT]
lemma DERIV_neg_imp_decreasing:
  fixes a b :: real and f :: "real \<Rightarrow> real"
  assumes "a < b"
    and der: "\<And>x. \<lbrakk>a \<le> x; x \<le> b\<rbrakk> \<Longrightarrow> \<exists>y. DERIV f x :> y \<and> y < 0"
  shows "f a > f b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f b < f a
[PROOF STEP]
by (metis less_le_not_le DERIV_atLeastAtMost_imp_continuous_on DERIV_neg_imp_decreasing_open [OF \<open>a < b\<close>] der)


[STATEMENT]
lemma Busemann_function_liminf:
  assumes "(\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi"
  shows "Busemann_function_at xi x y \<le> liminf (\<lambda>n. dist (x::'a::Gromov_hyperbolic_space) (u n) - dist y (u n)) + 2 * deltaG(TYPE('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
proof (cases xi)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xa. xi = to_Gromov_completion xa \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
 2. xi \<in> Gromov_boundary \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
case (to_Gromov_completion z)
[PROOF STATE]
proof (state)
this:
xi = to_Gromov_completion z

goal (2 subgoals):
 1. \<And>xa. xi = to_Gromov_completion xa \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
 2. xi \<in> Gromov_boundary \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
have *: "liminf (\<lambda>n. dist x (u n) - dist y (u n)) = dist x z - dist y z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) = ereal (dist x z - dist y z)
[PROOF STEP]
apply (rule lim_imp_Liminf, simp, intro tendsto_intros)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. u \<longlonglongrightarrow> z
 2. u \<longlonglongrightarrow> z
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi

goal (2 subgoals):
 1. u \<longlonglongrightarrow> z
 2. u \<longlonglongrightarrow> z
[PROOF STEP]
unfolding to_Gromov_completion
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> to_Gromov_completion z

goal (2 subgoals):
 1. u \<longlonglongrightarrow> z
 2. u \<longlonglongrightarrow> z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) = ereal (dist x z - dist y z)

goal (2 subgoals):
 1. \<And>xa. xi = to_Gromov_completion xa \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
 2. xi \<in> Gromov_boundary \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
unfolding to_Gromov_completion plus_ereal.simps(1)[symmetric] Busemann_function_inner *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (dist x z - dist y z) \<le> ereal (dist x z - dist y z) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))

goal (1 subgoal):
 1. xi \<in> Gromov_boundary \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. xi \<in> Gromov_boundary \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
case boundary
[PROOF STATE]
proof (state)
this:
xi \<in> Gromov_boundary

goal (1 subgoal):
 1. xi \<in> Gromov_boundary \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
have I: "limsup (\<lambda>n. ereal(dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal(dist x (u n) - dist y (u n))) + 2 * deltaG(TYPE('a))"
    if v: "(\<lambda>n. to_Gromov_completion (v n)) \<longlonglongrightarrow> xi" for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
obtain N where N: "\<And>m n. m \<ge> N \<Longrightarrow> n \<ge> N \<Longrightarrow> Gromov_product_at x (u m) (v n) \<ge> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>N. (\<And>m n. \<lbrakk>N \<le> m; N \<le> n\<rbrakk> \<Longrightarrow> dist x y \<le> Gromov_product_at x (u m) (v n)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using same_limit_imp_Gromov_product_tendsto_infinity[OF boundary assms v]
[PROOF STATE]
proof (prove)
using this:
\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. ?C \<le> Gromov_product_at ?a (u n) (v m)

goal (1 subgoal):
 1. (\<And>N. (\<And>m n. \<lbrakk>N \<le> m; N \<le> n\<rbrakk> \<Longrightarrow> dist x y \<le> Gromov_product_at x (u m) (v n)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<lbrakk>N \<le> ?m; N \<le> ?n\<rbrakk> \<Longrightarrow> dist x y \<le> Gromov_product_at x (u ?m) (v ?n)

goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
have A: "dist x (v n) - dist y (v n) - 2 * deltaG(TYPE('a)) \<le> dist x (u m) - dist y (u m)" if "m \<ge> N" "n \<ge> N" for m n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
have "Gromov_product_at x (v n) y \<le> dist x y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Gromov_product_at x (v n) y \<le> dist x y
[PROOF STEP]
by (intro mono_intros)
[PROOF STATE]
proof (state)
this:
Gromov_product_at x (v n) y \<le> dist x y

goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Gromov_product_at x (v n) y \<le> dist x y
[PROOF STEP]
have "min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) = Gromov_product_at x (v n) y"
[PROOF STATE]
proof (prove)
using this:
Gromov_product_at x (v n) y \<le> dist x y

goal (1 subgoal):
 1. min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) = Gromov_product_at x (v n) y
[PROOF STEP]
using N[OF \<open>m \<ge> N\<close> \<open>n \<ge> N\<close>]
[PROOF STATE]
proof (prove)
using this:
Gromov_product_at x (v n) y \<le> dist x y
dist x y \<le> Gromov_product_at x (u m) (v n)

goal (1 subgoal):
 1. min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) = Gromov_product_at x (v n) y
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) = Gromov_product_at x (v n) y

goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) = Gromov_product_at x (v n) y

goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
have "Gromov_product_at x (u m) y \<ge> min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) - deltaG(TYPE('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y
[PROOF STEP]
by (intro mono_intros)
[PROOF STATE]
proof (state)
this:
min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y

goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) = Gromov_product_at x (v n) y
min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y
[PROOF STEP]
have "Gromov_product_at x (u m) y \<ge> Gromov_product_at x (v n) y - deltaG(TYPE('a))"
[PROOF STATE]
proof (prove)
using this:
min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) = Gromov_product_at x (v n) y
min (Gromov_product_at x (u m) (v n)) (Gromov_product_at x (v n) y) - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y

goal (1 subgoal):
 1. Gromov_product_at x (v n) y - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Gromov_product_at x (v n) y - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y

goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Gromov_product_at x (v n) y - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Gromov_product_at x (v n) y - deltaG TYPE('a) \<le> Gromov_product_at x (u m) y

goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
unfolding Gromov_product_at_def
[PROOF STATE]
proof (prove)
using this:
(dist x (v n) + dist x y - dist (v n) y) / 2 - deltaG TYPE('a) \<le> (dist x (u m) + dist x y - dist (u m) y) / 2

goal (1 subgoal):
 1. dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)
[PROOF STEP]
by (auto simp add: algebra_simps divide_simps dist_commute)
[PROOF STATE]
proof (state)
this:
dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u m) - dist y (u m)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>N \<le> ?m; N \<le> ?n\<rbrakk> \<Longrightarrow> dist x (v ?n) - dist y (v ?n) - 2 * deltaG TYPE('a) \<le> dist x (u ?m) - dist y (u ?m)

goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
have B: "dist x (v n) - dist y (v n) - 2 * deltaG(TYPE('a)) \<le> liminf (\<lambda>m. dist x (u m) - dist y (u m))" if "n \<ge> N" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a)) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa)))
[PROOF STEP]
apply (rule Liminf_bounded)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F na in sequentially. ereal (dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a)) \<le> ereal (dist x (u na) - dist y (u na))
[PROOF STEP]
using A[OF _ that]
[PROOF STATE]
proof (prove)
using this:
N \<le> ?m \<Longrightarrow> dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u ?m) - dist y (u ?m)

goal (1 subgoal):
 1. \<forall>\<^sub>F na in sequentially. ereal (dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a)) \<le> ereal (dist x (u na) - dist y (u na))
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
using this:
N \<le> ?m \<Longrightarrow> dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a) \<le> dist x (u ?m) - dist y (u ?m)

goal (1 subgoal):
 1. \<exists>N. \<forall>na\<ge>N. ereal (dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a)) \<le> ereal (dist x (u na) - dist y (u na))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> ereal (dist x (v ?n) - dist y (v ?n) - 2 * deltaG TYPE('a)) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa)))

goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
have C: "dist x (v n) - dist y (v n) \<le> liminf (\<lambda>m. dist x (u m) - dist y (u m)) + 2 * deltaG(TYPE('a))" if "n \<ge> N" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (dist x (v n) - dist y (v n)) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
using B[OF that]
[PROOF STATE]
proof (prove)
using this:
ereal (dist x (v n) - dist y (v n) - 2 * deltaG TYPE('a)) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa)))

goal (1 subgoal):
 1. ereal (dist x (v n) - dist y (v n)) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
by (subst ereal_minus_le[symmetric], auto)
[PROOF STATE]
proof (state)
this:
N \<le> ?n \<Longrightarrow> ereal (dist x (v ?n) - dist y (v ?n)) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))

goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
apply (rule Limsup_bounded)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. ereal (dist x (v n) - dist y (v n)) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
unfolding eventually_sequentially
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n\<ge>N. ereal (dist x (v n) - dist y (v n)) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
apply (rule exI[of _ N])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n\<ge>N. ereal (dist x (v n) - dist y (v n)) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
using C
[PROOF STATE]
proof (prove)
using this:
N \<le> ?n \<Longrightarrow> ereal (dist x (v ?n) - dist y (v ?n)) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))

goal (1 subgoal):
 1. \<forall>n\<ge>N. ereal (dist x (v n) - dist y (v n)) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
limsup (\<lambda>n. ereal (dist x (v n) - dist y (v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. to_Gromov_completion (?v n)) \<longlonglongrightarrow> xi \<Longrightarrow> limsup (\<lambda>n. ereal (dist x (?v n) - dist y (?v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))

goal (1 subgoal):
 1. xi \<in> Gromov_boundary \<Longrightarrow> ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
unfolding Busemann_function_ereal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup {limsup (\<lambda>n. ereal (dist x (u n) - dist y (u n))) |u. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi} \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
apply (rule Sup_least)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xa. xa \<in> {limsup (\<lambda>n. ereal (dist x (u n) - dist y (u n))) |u. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi} \<Longrightarrow> xa \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
using I
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. to_Gromov_completion (?v n)) \<longlonglongrightarrow> xi \<Longrightarrow> limsup (\<lambda>n. ereal (dist x (?v n) - dist y (?v n))) \<le> liminf (\<lambda>n. ereal (dist x (u n) - dist y (u n))) + ereal (2 * deltaG TYPE('a))

goal (1 subgoal):
 1. \<And>xa. xa \<in> {limsup (\<lambda>n. ereal (dist x (u n) - dist y (u n))) |u. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi} \<Longrightarrow> xa \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ereal (Busemann_function_at xi x y) \<le> liminf (\<lambda>xa. ereal (dist x (u xa) - dist y (u xa))) + ereal (2 * deltaG TYPE('a))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bernoulli_pmf_half_conv_pmf_of_set: "bernoulli_pmf (1 / 2) = pmf_of_set UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_pmf (1 / 2) = local.pmf_of_set UNIV
[PROOF STEP]
by (rule pmf_eqI) simp_all


[STATEMENT]
lemma enat_add2_eq [simp]: "y + enat x = z + enat x \<longleftrightarrow> y = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y + enat x = z + enat x) = (y = z)
[PROOF STEP]
by (metis enat_add1_eq add.commute)


[STATEMENT]
lemma ACI_nPlus_flatten_PLUS:
  "\<lbrakk>X1 \<noteq> {}; X2 \<noteq> {}; finite X1; finite X2; \<forall>x \<in> X1 \<union> X2. \<not>(\<exists>r s. x = Plus r s)\<rbrakk>\<Longrightarrow>
  ACI_nPlus (flatten PLUS X1) (flatten PLUS X2) = flatten PLUS (X1 \<union> X2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X1 \<noteq> {}; X2 \<noteq> {}; finite X1; finite X2; \<forall>x\<in>X1 \<union> X2. \<nexists>r s. x = Plus r s\<rbrakk> \<Longrightarrow> ACI_nPlus (flatten PLUS X1) (flatten PLUS X2) = flatten PLUS (X1 \<union> X2)
[PROOF STEP]
by (rule trans[OF ACI_nPlus_PLUS]) auto


[STATEMENT]
lemma logic_aux1: "(\<exists>k. (i = k \<longrightarrow> x = f i j) \<and> (i \<noteq> k \<longrightarrow> x = 0)) \<longleftrightarrow> (\<exists>k. i = k \<and> x = f i j) \<or> (\<exists>k. i \<noteq> k \<and> x = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>k. (i = k \<longrightarrow> x = f i j) \<and> (i \<noteq> k \<longrightarrow> x = (0::'b))) = ((\<exists>k. i = k \<and> x = f i j) \<or> (\<exists>k. i \<noteq> k \<and> x = (0::'b)))
[PROOF STEP]
by blast


[STATEMENT]
lemma fetch_jump_over1_o:
  "fetch (mopup_a n @ shift mopup_b (2 * n)) (Suc (2 * n)) Oc
  = (R, Suc (2 * n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fetch (mopup_a n @ shift mopup_b (2 * n)) (Suc (2 * n)) Oc = (R, Suc (2 * n))
[PROOF STEP]
apply(subgoal_tac "length (mopup_a n) = 4 * n")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. length (mopup_a n) = 4 * n \<Longrightarrow> fetch (mopup_a n @ shift mopup_b (2 * n)) (Suc (2 * n)) Oc = (R, Suc (2 * n))
 2. length (mopup_a n) = 4 * n
[PROOF STEP]
apply(auto simp: mopup_b_def nth_append shift.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fundamental_theorem_of_calculus_interior_stronger:
  fixes f :: "real \<Rightarrow> 'a::banach"
  assumes "finite S"
    and "a \<le> b" "\<And>x. x \<in> {a <..< b} - S \<Longrightarrow> (f has_vector_derivative f'(x)) (at x)"
    and "continuous_on {a .. b} f"
  shows "(f' has_integral (f b - f a)) {a .. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
a \<le> b
?x \<in> {a<..<b} - S \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f

goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
proof (induction arbitrary: a b)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; \<And>x. x \<in> {a<..<b} - {} \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
 2. \<And>x F a b. \<lbrakk>finite F; x \<notin> F; \<And>a b. \<lbrakk>a \<le> b; \<And>x. x \<in> {a<..<b} - F \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}; a \<le> b; \<And>xa. xa \<in> {a<..<b} - insert x F \<Longrightarrow> (f has_vector_derivative f' xa) (at xa); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
a \<le> b
?x \<in> {a<..<b} - {} \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f

goal (2 subgoals):
 1. \<And>a b. \<lbrakk>a \<le> b; \<And>x. x \<in> {a<..<b} - {} \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
 2. \<And>x F a b. \<lbrakk>finite F; x \<notin> F; \<And>a b. \<lbrakk>a \<le> b; \<And>x. x \<in> {a<..<b} - F \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}; a \<le> b; \<And>xa. xa \<in> {a<..<b} - insert x F \<Longrightarrow> (f has_vector_derivative f' xa) (at xa); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a \<le> b
?x \<in> {a<..<b} - {} \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
a \<le> b
?x \<in> {a<..<b} - {} \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f

goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
using fundamental_theorem_of_calculus_interior
[PROOF STATE]
proof (prove)
using this:
a \<le> b
?x \<in> {a<..<b} - {} \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f
\<lbrakk>?a \<le> ?b; continuous_on {?a..?b} ?f; \<And>x. x \<in> {?a<..<?b} \<Longrightarrow> (?f has_vector_derivative ?f' x) (at x)\<rbrakk> \<Longrightarrow> (?f' has_integral ?f ?b - ?f ?a) {?a..?b}

goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
(f' has_integral f b - f a) {a..b}

goal (1 subgoal):
 1. \<And>x F a b. \<lbrakk>finite F; x \<notin> F; \<And>a b. \<lbrakk>a \<le> b; \<And>x. x \<in> {a<..<b} - F \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}; a \<le> b; \<And>xa. xa \<in> {a<..<b} - insert x F \<Longrightarrow> (f has_vector_derivative f' xa) (at xa); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a b. \<lbrakk>finite F; x \<notin> F; \<And>a b. \<lbrakk>a \<le> b; \<And>x. x \<in> {a<..<b} - F \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}; a \<le> b; \<And>xa. xa \<in> {a<..<b} - insert x F \<Longrightarrow> (f has_vector_derivative f' xa) (at xa); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
case (insert x S)
[PROOF STATE]
proof (state)
this:
finite S
x \<notin> S
\<lbrakk>?a \<le> ?b; \<And>x. x \<in> {?a<..<?b} - S \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {?a..?b} f\<rbrakk> \<Longrightarrow> (f' has_integral f ?b - f ?a) {?a..?b}
a \<le> b
?x \<in> {a<..<b} - insert x S \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f

goal (1 subgoal):
 1. \<And>x F a b. \<lbrakk>finite F; x \<notin> F; \<And>a b. \<lbrakk>a \<le> b; \<And>x. x \<in> {a<..<b} - F \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}; a \<le> b; \<And>xa. xa \<in> {a<..<b} - insert x F \<Longrightarrow> (f has_vector_derivative f' xa) (at xa); continuous_on {a..b} f\<rbrakk> \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
proof (cases "x \<in> {a<..<b}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
 2. x \<notin> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
x \<notin> {a<..<b}

goal (2 subgoals):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
 2. x \<notin> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<notin> {a<..<b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x \<notin> {a<..<b}

goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
x \<notin> {a<..<b}
finite S
x \<notin> S
\<lbrakk>?a \<le> ?b; \<And>x. x \<in> {?a<..<?b} - S \<Longrightarrow> (f has_vector_derivative f' x) (at x); continuous_on {?a..?b} f\<rbrakk> \<Longrightarrow> (f' has_integral f ?b - f ?a) {?a..?b}
a \<le> b
?x \<in> {a<..<b} - insert x S \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f

goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(f' has_integral f b - f a) {a..b}

goal (1 subgoal):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
x \<in> {a<..<b}

goal (1 subgoal):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> {a<..<b}
[PROOF STEP]
have "a < x" "x < b"
[PROOF STATE]
proof (prove)
using this:
x \<in> {a<..<b}

goal (1 subgoal):
 1. a < x &&& x < b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a < x
x < b

goal (1 subgoal):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
have "(f' has_integral f x - f a) {a..x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f' has_integral f x - f a) {a..x}
[PROOF STEP]
apply (rule insert)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. a \<le> x
 2. \<And>xa. xa \<in> {a<..<x} - S \<Longrightarrow> (f has_vector_derivative f' xa) (at xa)
 3. continuous_on {a..x} f
[PROOF STEP]
using \<open>a < x\<close> \<open>x < b\<close> insert.prems continuous_on_subset
[PROOF STATE]
proof (prove)
using this:
a < x
x < b
a \<le> b
?x \<in> {a<..<b} - insert x S \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f

goal (3 subgoals):
 1. a \<le> x
 2. \<And>xa. xa \<in> {a<..<x} - S \<Longrightarrow> (f has_vector_derivative f' xa) (at xa)
 3. continuous_on {a..x} f
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
(f' has_integral f x - f a) {a..x}

goal (1 subgoal):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(f' has_integral f x - f a) {a..x}

goal (1 subgoal):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
have "(f' has_integral f b - f x) {x..b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f' has_integral f b - f x) {x..b}
[PROOF STEP]
apply (rule insert)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. x \<le> b
 2. \<And>xa. xa \<in> {x<..<b} - S \<Longrightarrow> (f has_vector_derivative f' xa) (at xa)
 3. continuous_on {x..b} f
[PROOF STEP]
using \<open>x < b\<close> \<open>a < x\<close> insert.prems continuous_on_subset
[PROOF STATE]
proof (prove)
using this:
x < b
a < x
a \<le> b
?x \<in> {a<..<b} - insert x S \<Longrightarrow> (f has_vector_derivative f' ?x) (at ?x)
continuous_on {a..b} f
\<lbrakk>continuous_on ?s ?f; ?t \<subseteq> ?s\<rbrakk> \<Longrightarrow> continuous_on ?t ?f

goal (3 subgoals):
 1. x \<le> b
 2. \<And>xa. xa \<in> {x<..<b} - S \<Longrightarrow> (f has_vector_derivative f' xa) (at xa)
 3. continuous_on {x..b} f
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
(f' has_integral f b - f x) {x..b}

goal (1 subgoal):
 1. x \<in> {a<..<b} \<Longrightarrow> (f' has_integral f b - f a) {a..b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(f' has_integral f x - f a) {a..x}
(f' has_integral f b - f x) {x..b}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f' has_integral f x - f a) {a..x}
(f' has_integral f b - f x) {x..b}

goal (1 subgoal):
 1. (f' has_integral f b - f a) {a..b}
[PROOF STEP]
by (meson finite_insert fundamental_theorem_of_calculus_interior_strong insert.hyps(1) insert.prems(1) insert.prems(2) insert.prems(3))
[PROOF STATE]
proof (state)
this:
(f' has_integral f b - f a) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f' has_integral f b - f a) {a..b}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma relation_of_Seq: "relation_of (P `;` Q) = (relation_of P ;; relation_of Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. action.relation_of (P `;` Q) = (action.relation_of P ;; action.relation_of Q)
[PROOF STEP]
by (simp add: Seq_def action_of_inverse Seq_is_CSP)


[STATEMENT]
lemma upper_cos_float_interval: "upper (cos_float_interval p x) = snd (bnds_cos p (lower x) (upper x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. upper (cos_float_interval p x) = snd (bnds_cos p (lower x) (upper x))
[PROOF STEP]
by transfer auto


[STATEMENT]
lemma continuous_vnmD:
  assumes "continuous_vnm C P"
  shows "(\<forall>p \<in> C. \<forall>q \<in> C. \<forall>r \<in> C. p \<succeq>[P] q \<and> q \<succeq>[P] r \<longrightarrow>
    (\<exists>\<alpha> \<in> {0..1}. (mix_pmf \<alpha> p r) \<approx>[P] q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>p\<in>C. \<forall>q\<in>C. \<forall>r\<in>C. p \<succeq>[P] q \<and> q \<succeq>[P] r \<longrightarrow> (\<exists>\<alpha>\<in>{0..1}. mix_pmf \<alpha> p r \<approx>[P] q)
[PROOF STEP]
using continuous_vnm_def assms
[PROOF STATE]
proof (prove)
using this:
continuous_vnm ?C ?P = (\<forall>p\<in>?C. \<forall>q\<in>?C. \<forall>r\<in>?C. p \<succeq>[?P] q \<and> q \<succeq>[?P] r \<longrightarrow> (\<exists>\<alpha>\<in>{0..1}. mix_pmf \<alpha> p r \<approx>[?P] q))
continuous_vnm C P

goal (1 subgoal):
 1. \<forall>p\<in>C. \<forall>q\<in>C. \<forall>r\<in>C. p \<succeq>[P] q \<and> q \<succeq>[P] r \<longrightarrow> (\<exists>\<alpha>\<in>{0..1}. mix_pmf \<alpha> p r \<approx>[P] q)
[PROOF STEP]
by blast


[STATEMENT]
lemma (in is_cat_pullback) cat_pb_unique:
  assumes "x' : X' <\<^sub>C\<^sub>F\<^sub>.\<^sub>p\<^sub>b \<aa>\<rightarrow>\<gg>\<rightarrow>\<oo>\<leftarrow>\<ff>\<leftarrow>\<bb> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  shows "\<exists>!f'. f' : X' \<mapsto>\<^bsub>\<CC>\<^esub> X \<and> x' = x \<bullet>\<^sub>N\<^sub>T\<^sub>C\<^sub>F ntcf_const \<rightarrow>\<bullet>\<leftarrow>\<^sub>C \<CC> f'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!f'. f' : X' \<mapsto>\<^bsub>\<CC>\<^esub> X \<and> x' = x \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const \<rightarrow>\<bullet>\<leftarrow>\<^sub>C \<CC> f'
[PROOF STEP]
by (rule cat_lim_unique[OF is_cat_pullbackD(1)[OF assms]])


[STATEMENT]
theorem is_inf_uniq: "is_inf x y inf \<Longrightarrow> is_inf x y inf' \<Longrightarrow> inf = inf'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>is_inf x y inf; is_inf x y inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>is_inf x y inf; is_inf x y inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
assume inf: "is_inf x y inf"
[PROOF STATE]
proof (state)
this:
is_inf x y inf

goal (1 subgoal):
 1. \<lbrakk>is_inf x y inf; is_inf x y inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
assume inf': "is_inf x y inf'"
[PROOF STATE]
proof (state)
this:
is_inf x y inf'

goal (1 subgoal):
 1. \<lbrakk>is_inf x y inf; is_inf x y inf'\<rbrakk> \<Longrightarrow> inf = inf'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inf = inf'
[PROOF STEP]
proof (rule leq_antisym)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inf \<sqsubseteq> inf'
 2. inf' \<sqsubseteq> inf
[PROOF STEP]
from inf'
[PROOF STATE]
proof (chain)
picking this:
is_inf x y inf'
[PROOF STEP]
show "inf \<sqsubseteq> inf'"
[PROOF STATE]
proof (prove)
using this:
is_inf x y inf'

goal (1 subgoal):
 1. inf \<sqsubseteq> inf'
[PROOF STEP]
proof (rule is_inf_greatest)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inf \<sqsubseteq> x
 2. inf \<sqsubseteq> y
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
is_inf x y inf
[PROOF STEP]
show "inf \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
using this:
is_inf x y inf

goal (1 subgoal):
 1. inf \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
inf \<sqsubseteq> x

goal (1 subgoal):
 1. inf \<sqsubseteq> y
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
is_inf x y inf
[PROOF STEP]
show "inf \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
using this:
is_inf x y inf

goal (1 subgoal):
 1. inf \<sqsubseteq> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
inf \<sqsubseteq> y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inf \<sqsubseteq> inf'

goal (1 subgoal):
 1. inf' \<sqsubseteq> inf
[PROOF STEP]
from inf
[PROOF STATE]
proof (chain)
picking this:
is_inf x y inf
[PROOF STEP]
show "inf' \<sqsubseteq> inf"
[PROOF STATE]
proof (prove)
using this:
is_inf x y inf

goal (1 subgoal):
 1. inf' \<sqsubseteq> inf
[PROOF STEP]
proof (rule is_inf_greatest)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. inf' \<sqsubseteq> x
 2. inf' \<sqsubseteq> y
[PROOF STEP]
from inf'
[PROOF STATE]
proof (chain)
picking this:
is_inf x y inf'
[PROOF STEP]
show "inf' \<sqsubseteq> x"
[PROOF STATE]
proof (prove)
using this:
is_inf x y inf'

goal (1 subgoal):
 1. inf' \<sqsubseteq> x
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
inf' \<sqsubseteq> x

goal (1 subgoal):
 1. inf' \<sqsubseteq> y
[PROOF STEP]
from inf'
[PROOF STATE]
proof (chain)
picking this:
is_inf x y inf'
[PROOF STEP]
show "inf' \<sqsubseteq> y"
[PROOF STATE]
proof (prove)
using this:
is_inf x y inf'

goal (1 subgoal):
 1. inf' \<sqsubseteq> y
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
inf' \<sqsubseteq> y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inf' \<sqsubseteq> inf

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_tower_2: "k * (2 ^ Suc k) \<le> 2^(2^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
proof (induction k rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> y * 2 ^ Suc y \<le> 2 ^ 2 ^ y) \<Longrightarrow> x * 2 ^ Suc x \<le> 2 ^ 2 ^ x
[PROOF STEP]
case (less k)
[PROOF STATE]
proof (state)
this:
?y < k \<Longrightarrow> ?y * 2 ^ Suc ?y \<le> 2 ^ 2 ^ ?y

goal (1 subgoal):
 1. \<And>x. (\<And>y. y < x \<Longrightarrow> y * 2 ^ Suc y \<le> 2 ^ 2 ^ y) \<Longrightarrow> x * 2 ^ Suc x \<le> 2 ^ 2 ^ x
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
proof (cases "k \<le> Suc (Suc 0)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> k \<le> Suc (Suc 0)

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
define j where "j = k - Suc 0"
[PROOF STATE]
proof (state)
this:
j = k - Suc 0

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
have kj: "k = Suc j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = Suc j
[PROOF STEP]
using False j_def
[PROOF STATE]
proof (prove)
using this:
\<not> k \<le> Suc (Suc 0)
j = k - Suc 0

goal (1 subgoal):
 1. k = Suc j
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
k = Suc j

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
with False
[PROOF STATE]
proof (chain)
picking this:
\<not> k \<le> Suc (Suc 0)
k = Suc j
[PROOF STEP]
have \<section>: "(2^j + 3) \<le> (2::nat) ^ k"
[PROOF STATE]
proof (prove)
using this:
\<not> k \<le> Suc (Suc 0)
k = Suc j

goal (1 subgoal):
 1. 2 ^ j + 3 \<le> 2 ^ k
[PROOF STEP]
by (simp add: Suc_leI le_less_trans not_less_eq_eq numeral_3_eq_3)
[PROOF STATE]
proof (state)
this:
2 ^ j + 3 \<le> 2 ^ k

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
have "k * (2 ^ Suc k) \<le> 6 * j * 2^j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k * 2 ^ Suc k \<le> 6 * j * 2 ^ j
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
\<not> k \<le> Suc (Suc 0)

goal (1 subgoal):
 1. k * 2 ^ Suc k \<le> 6 * j * 2 ^ j
[PROOF STEP]
by (simp add: kj)
[PROOF STATE]
proof (state)
this:
k * 2 ^ Suc k \<le> 6 * j * 2 ^ j

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k * 2 ^ Suc k \<le> 6 * j * 2 ^ j

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
have "\<dots> \<le> 6 * 2^(2^j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 6 * j * 2 ^ j \<le> 6 * 2 ^ 2 ^ j
[PROOF STEP]
using kj less.IH
[PROOF STATE]
proof (prove)
using this:
k = Suc j
?y < k \<Longrightarrow> ?y * 2 ^ Suc ?y \<le> 2 ^ 2 ^ ?y

goal (1 subgoal):
 1. 6 * j * 2 ^ j \<le> 6 * 2 ^ 2 ^ j
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
6 * j * 2 ^ j \<le> 6 * 2 ^ 2 ^ j

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
6 * j * 2 ^ j \<le> 6 * 2 ^ 2 ^ j

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
have "\<dots> < 2^(2^j + 3)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 6 * 2 ^ 2 ^ j < 2 ^ (2 ^ j + 3)
[PROOF STEP]
by (simp add: power_add)
[PROOF STATE]
proof (state)
this:
6 * 2 ^ 2 ^ j < 2 ^ (2 ^ j + 3)

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
6 * 2 ^ 2 ^ j < 2 ^ (2 ^ j + 3)

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
have "\<dots> \<le> 2^2^k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 ^ (2 ^ j + 3) \<le> 2 ^ 2 ^ k
[PROOF STEP]
by (simp add: \<section>)
[PROOF STATE]
proof (state)
this:
2 ^ (2 ^ j + 3) \<le> 2 ^ 2 ^ k

goal (2 subgoals):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
 2. \<not> k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
k * 2 ^ Suc k < 2 ^ 2 ^ k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
k * 2 ^ Suc k < 2 ^ 2 ^ k

goal (1 subgoal):
 1. k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k * 2 ^ Suc k \<le> 2 ^ 2 ^ k

goal (1 subgoal):
 1. k \<le> Suc (Suc 0) \<Longrightarrow> k * 2 ^ Suc k \<le> 2 ^ 2 ^ k
[PROOF STEP]
qed (auto simp: le_Suc_eq)
[PROOF STATE]
proof (state)
this:
k * 2 ^ Suc k \<le> 2 ^ 2 ^ k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_upair_simps [simp]:
  "eq_upair (a, b) (c, d) \<longleftrightarrow> a = c \<and> b = d \<or> a = d \<and> b = c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eq_upair (a, b) (c, d) = (a = c \<and> b = d \<or> a = d \<and> b = c)
[PROOF STEP]
by(simp add: eq_upair_def)


[STATEMENT]
lemma Gr_incl: "Gr A f \<subseteq> A \<times> B \<longleftrightarrow> f ` A \<subseteq> B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Gr A f \<subseteq> A \<times> B) = (f ` A \<subseteq> B)
[PROOF STEP]
unfolding Gr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({(a, f a) |a. a \<in> A} \<subseteq> A \<times> B) = (f ` A \<subseteq> B)
[PROOF STEP]
by auto


[STATEMENT]
lemma pseudominimal_in_pow_singleton:
  "a\<in>A \<Longrightarrow> order.pseudominimal_in (Pow A) {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<in> A \<Longrightarrow> order.pseudominimal_in (Pow A) {a}
[PROOF STEP]
using singleton_pow bottom_pow
[PROOF STATE]
proof (prove)
using this:
?a \<in> ?A \<Longrightarrow> {?a} \<in> Pow ?A
order.bottom (Pow ?A) = {}

goal (1 subgoal):
 1. a \<in> A \<Longrightarrow> order.pseudominimal_in (Pow A) {a}
[PROOF STEP]
by (fast intro: order.pseudominimal_inI)


[STATEMENT]
lemma map_poly_mod[hom_distribs]: "map_poly hom (p mod q) = map_poly hom p mod map_poly hom q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map_poly hom (p mod q) = map_poly hom p mod map_poly hom q
[PROOF STEP]
using map_poly_pdivmod[of p q]
[PROOF STATE]
proof (prove)
using this:
map_prod (map_poly hom) (map_poly hom) (p div q, p mod q) = (map_poly hom p div map_poly hom q, map_poly hom p mod map_poly hom q)

goal (1 subgoal):
 1. map_poly hom (p mod q) = map_poly hom p mod map_poly hom q
[PROOF STEP]
by simp


[STATEMENT]
lemma fst_leaves: "\<lbrakk> inorder t = [i..j]; i \<le> j+1\<rbrakk> \<Longrightarrow> fst ` leaves i t = {i..j+1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inorder t = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t = {i..j + 1}
[PROOF STEP]
proof(induction t arbitrary: i j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i j. \<lbrakk>inorder \<langle>\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>\<rangle> = {i..j + 1}
 2. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t1 = {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t2 = {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>t1, x2, t2\<rangle> = {i..j + 1}
[PROOF STEP]
case Leaf
[PROOF STATE]
proof (state)
this:
inorder \<langle>\<rangle> = [i..j]
i \<le> j + 1

goal (2 subgoals):
 1. \<And>i j. \<lbrakk>inorder \<langle>\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>\<rangle> = {i..j + 1}
 2. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t1 = {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t2 = {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>t1, x2, t2\<rangle> = {i..j + 1}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inorder \<langle>\<rangle> = [i..j]
i \<le> j + 1
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
inorder \<langle>\<rangle> = [i..j]
i \<le> j + 1

goal (1 subgoal):
 1. fst ` leaves i \<langle>\<rangle> = {i..j + 1}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst ` leaves i \<langle>\<rangle> = {i..j + 1}

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t1 = {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t2 = {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>t1, x2, t2\<rangle> = {i..j + 1}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t1 = {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t2 = {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>t1, x2, t2\<rangle> = {i..j + 1}
[PROOF STEP]
case (Node t1 k t2)
[PROOF STATE]
proof (state)
this:
\<lbrakk>inorder t1 = [?i..?j]; ?i \<le> ?j + 1\<rbrakk> \<Longrightarrow> fst ` leaves ?i t1 = {?i..?j + 1}
\<lbrakk>inorder t2 = [?i..?j]; ?i \<le> ?j + 1\<rbrakk> \<Longrightarrow> fst ` leaves ?i t2 = {?i..?j + 1}
inorder \<langle>t1, k, t2\<rangle> = [i..j]
i \<le> j + 1

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t1 = {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t2 = {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>t1, x2, t2\<rangle> = {i..j + 1}
[PROOF STEP]
note inorder = inorder_upto_split[OF Node.prems(1)]
[PROOF STATE]
proof (state)
this:
inorder t1 = [i..k - 1]
inorder t2 = [k + 1..j]
i \<le> k
k \<le> j

goal (1 subgoal):
 1. \<And>t1 x2 t2 i j. \<lbrakk>\<And>i j. \<lbrakk>inorder t1 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t1 = {i..j + 1}; \<And>i j. \<lbrakk>inorder t2 = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i t2 = {i..j + 1}; inorder \<langle>t1, x2, t2\<rangle> = [i..j]; i \<le> j + 1\<rbrakk> \<Longrightarrow> fst ` leaves i \<langle>t1, x2, t2\<rangle> = {i..j + 1}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` leaves i \<langle>t1, k, t2\<rangle> = {i..j + 1}
[PROOF STEP]
using  Node.IH(1)[OF inorder(1)] Node.IH(2)[OF inorder(2)] inorder(3,4) Node.prems(2)
[PROOF STATE]
proof (prove)
using this:
i \<le> k - 1 + 1 \<Longrightarrow> fst ` leaves i t1 = {i..k - 1 + 1}
k + 1 \<le> j + 1 \<Longrightarrow> fst ` leaves (k + 1) t2 = {k + 1..j + 1}
i \<le> k
k \<le> j
i \<le> j + 1

goal (1 subgoal):
 1. fst ` leaves i \<langle>t1, k, t2\<rangle> = {i..j + 1}
[PROOF STEP]
by (fastforce simp: image_def set_eq_iff bex_Un)
[PROOF STATE]
proof (state)
this:
fst ` leaves i \<langle>t1, k, t2\<rangle> = {i..j + 1}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mod_diff1_eq: "
  (a::nat) \<le> b \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
apply (case_tac "m = 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; m \<noteq> 0\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
assume a_as:"a \<le> b"
    and m_as: "0 < m"
[PROOF STATE]
proof (state)
this:
a \<le> b
0 < m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have a_mod_le_b_s: "a mod m \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod m \<le> b
[PROOF STEP]
by (rule le_trans[of _ a], simp only: mod_le_dividend, simp only: a_as)
[PROOF STATE]
proof (state)
this:
a mod m \<le> b

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "(b - a) mod m = (b - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
using a_as
[PROOF STATE]
proof (prove)
using this:
a \<le> b

goal (1 subgoal):
 1. (b - a) mod m = (b - a mod m) mod m
[PROOF STEP]
by (simp only: mod_diff_right_eq)
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (b - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b - a mod m + m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a mod m) mod m = (b - a mod m + m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b - a mod m) mod m = (b - a mod m + m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a mod m) mod m = (b - a mod m + m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b + m - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b - a mod m + m) mod m = (b + m - a mod m) mod m
[PROOF STEP]
using a_mod_le_b_s
[PROOF STATE]
proof (prove)
using this:
a mod m \<le> b

goal (1 subgoal):
 1. (b - a mod m + m) mod m = (b + m - a mod m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b - a mod m + m) mod m = (b + m - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b - a mod m + m) mod m = (b + m - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b div m * m + b mod m + m - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b + m - a mod m) mod m = (b div m * m + b mod m + m - a mod m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b + m - a mod m) mod m = (b div m * m + b mod m + m - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b + m - a mod m) mod m = (b div m * m + b mod m + m - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b div m * m + (b mod m + m - a mod m)) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b div m * m + b mod m + m - a mod m) mod m = (b div m * m + (b mod m + m - a mod m)) mod m
[PROOF STEP]
by (simp add: diff_add_assoc[OF mod_le_divisor, OF m_as])
[PROOF STATE]
proof (state)
this:
(b div m * m + b mod m + m - a mod m) mod m = (b div m * m + (b mod m + m - a mod m)) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b div m * m + b mod m + m - a mod m) mod m = (b div m * m + (b mod m + m - a mod m)) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "\<dots> = ((b mod m + m - a mod m) + b div m * m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b div m * m + (b mod m + m - a mod m)) mod m = (b mod m + m - a mod m + b div m * m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b div m * m + (b mod m + m - a mod m)) mod m = (b mod m + m - a mod m + b div m * m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b div m * m + (b mod m + m - a mod m)) mod m = (b mod m + m - a mod m + b div m * m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "\<dots> = (b mod m + m - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b mod m + m - a mod m + b div m * m) mod m = (b mod m + m - a mod m) mod m
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(b mod m + m - a mod m + b div m * m) mod m = (b mod m + m - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(b mod m + m - a mod m + b div m * m) mod m = (b mod m + m - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
have "\<dots> = (m + b mod m - a mod m) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b mod m + m - a mod m) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
by (simp only: add.commute)
[PROOF STATE]
proof (state)
this:
(b mod m + m - a mod m) mod m = (m + b mod m - a mod m) mod m

goal (1 subgoal):
 1. \<lbrakk>a \<le> b; 0 < m\<rbrakk> \<Longrightarrow> (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(b - a) mod m = (m + b mod m - a mod m) mod m

goal (1 subgoal):
 1. (b - a) mod m = (m + b mod m - a mod m) mod m
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(b - a) mod m = (m + b mod m - a mod m) mod m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma omega_import:
  assumes "p \<le> p * p"
      and "p * x \<le> x * p"
    shows "p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
have "p * x\<^sup>\<omega> \<le> p * (p * x) * x\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * x\<^sup>\<omega> \<le> p * (p * x) * x\<^sup>\<omega>
[PROOF STEP]
by (metis assms(1) mult_assoc mult_left_isotone omega_unfold)
[PROOF STATE]
proof (state)
this:
p * x\<^sup>\<omega> \<le> p * (p * x) * x\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
p * x\<^sup>\<omega> \<le> p * (p * x) * x\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
have "... \<le> p * x * p * x\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p * (p * x) * x\<^sup>\<omega> \<le> p * x * p * x\<^sup>\<omega>
[PROOF STEP]
by (metis assms(2) mult_assoc mult_left_isotone mult_right_isotone)
[PROOF STATE]
proof (state)
this:
p * (p * x) * x\<^sup>\<omega> \<le> p * x * p * x\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
p * x\<^sup>\<omega> \<le> p * x * p * x\<^sup>\<omega>
[PROOF STEP]
have "p * x\<^sup>\<omega> \<le> (p * x)\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
using this:
p * x\<^sup>\<omega> \<le> p * x * p * x\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> \<le> (p * x)\<^sup>\<omega>
[PROOF STEP]
by (simp add: mult_assoc omega_induct_mult)
[PROOF STATE]
proof (state)
this:
p * x\<^sup>\<omega> \<le> (p * x)\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
hence "p * x\<^sup>\<omega> \<le> p * (p * x)\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
using this:
p * x\<^sup>\<omega> \<le> (p * x)\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> \<le> p * (p * x)\<^sup>\<omega>
[PROOF STEP]
by (metis assms(1) mult_assoc mult_left_isotone mult_right_isotone order_trans)
[PROOF STATE]
proof (state)
this:
p * x\<^sup>\<omega> \<le> p * (p * x)\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
thus "p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>"
[PROOF STATE]
proof (prove)
using this:
p * x\<^sup>\<omega> \<le> p * (p * x)\<^sup>\<omega>

goal (1 subgoal):
 1. p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>
[PROOF STEP]
by (metis assms(2) sup_left_divisibility order.antisym mult_right_isotone omega_induct_mult omega_slide omega_sub_dist)
[PROOF STATE]
proof (state)
this:
p * x\<^sup>\<omega> = p * (p * x)\<^sup>\<omega>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem wls_fresh_subst_ident[simp]:
assumes "wls (asSort ys) Y" and "wls s X" and "fresh ys y X"
shows "(X #[Y / y]_ys) = X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X #[Y / y]_ys = X
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wls (asSort ys) Y
wls s X
fresh ys y X

goal (1 subgoal):
 1. X #[Y / y]_ys = X
[PROOF STEP]
by(simp add: fresh_subst_ident)


[STATEMENT]
lemma monom_coeff: "coeff (monom a n) = (\<lambda>i. if i = n then a else \<zero>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (local.monom a n) = (\<lambda>i. if i = n then a else \<zero>)
[PROOF STEP]
unfolding monom_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.coeff (a # replicate n \<zero>) = (\<lambda>i. if i = n then a else \<zero>)
[PROOF STEP]
by (induction n) (auto)


[STATEMENT]
lemma zero_less_one_ereal[simp]: "0 \<le> (1::ereal)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> 1
[PROOF STEP]
by (simp add: one_ereal_def zero_ereal_def)


[STATEMENT]
lemma pathin_iff_path_real [simp]: "pathin euclideanreal g \<longleftrightarrow> path g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pathin euclideanreal g = path g
[PROOF STEP]
by (simp add: pathin_def path_def)


[STATEMENT]
lemma measurable_on_combine:
  assumes f: "f measurable_on S" and g: "g measurable_on S"
    and h: "continuous_on UNIV (\<lambda>x. h (fst x) (snd x))" and "h 0 0 = 0"
  shows "(\<lambda>x. h (f x) (g x)) measurable_on S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. h (f x) (g x)) measurable_on S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>x. h (f x) (g x)) measurable_on S
[PROOF STEP]
have *: "(\<lambda>x. h (f x) (g x)) = (\<lambda>x. h (fst x) (snd x)) \<circ> (\<lambda>x. (f x, g x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. h (f x) (g x)) = (\<lambda>x. h (fst x) (snd x)) \<circ> (\<lambda>x. (f x, g x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. h (f x) (g x)) = (\<lambda>x. h (fst x) (snd x)) \<circ> (\<lambda>x. (f x, g x))

goal (1 subgoal):
 1. (\<lambda>x. h (f x) (g x)) measurable_on S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. h (f x) (g x)) measurable_on S
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. h (fst x) (snd x)) \<circ> (\<lambda>x. (f x, g x)) measurable_on S
[PROOF STEP]
by (auto simp: measurable_on_compose_continuous_0 measurable_on_Pair assms)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. h (f x) (g x)) measurable_on S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma quasi_inverses_isomorphic_right:
    assumes "quasi_inverses f g"
    shows "quasi_inverses f g' \<longleftrightarrow> g \<cong> g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. quasi_inverses f g' = (g \<cong> g')
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. quasi_inverses f g' \<Longrightarrow> g \<cong> g'
 2. g \<cong> g' \<Longrightarrow> quasi_inverses f g'
[PROOF STEP]
show "g \<cong> g' \<Longrightarrow> quasi_inverses f g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<cong> g' \<Longrightarrow> quasi_inverses f g'
[PROOF STEP]
using assms quasi_inverses_def isomorphic_def equivalence_preserved_by_iso_right
[PROOF STATE]
proof (prove)
using this:
quasi_inverses f g
quasi_inverses ?f ?g \<equiv> \<exists>\<phi> \<psi>. internal_equivalence ?f ?g \<phi> \<psi>
(?a \<cong> ?a') = (\<exists>f. \<guillemotleft>f : ?a \<Rightarrow> ?a'\<guillemotright> \<and> local.iso f)
\<lbrakk>internal_equivalence ?f ?g ?\<eta> ?\<epsilon>; \<guillemotleft>?\<phi> : ?g \<Rightarrow> ?g'\<guillemotright>; local.iso ?\<phi>\<rbrakk> \<Longrightarrow> internal_equivalence ?f ?g' ((?\<phi> \<star> ?f) \<cdot> ?\<eta>) (?\<epsilon> \<cdot> (?f \<star> local.inv ?\<phi>))

goal (1 subgoal):
 1. g \<cong> g' \<Longrightarrow> quasi_inverses f g'
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
g \<cong> g' \<Longrightarrow> quasi_inverses f g'

goal (1 subgoal):
 1. quasi_inverses f g' \<Longrightarrow> g \<cong> g'
[PROOF STEP]
assume g': "quasi_inverses f g'"
[PROOF STATE]
proof (state)
this:
quasi_inverses f g'

goal (1 subgoal):
 1. quasi_inverses f g' \<Longrightarrow> g \<cong> g'
[PROOF STEP]
show "g \<cong> g'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<cong> g'
[PROOF STEP]
using assms g' quasi_inverses_are_adjoint_pair left_adjoint_determines_right_up_to_iso
[PROOF STATE]
proof (prove)
using this:
quasi_inverses f g
quasi_inverses f g'
quasi_inverses ?f ?g \<Longrightarrow> adjoint_pair ?f ?g
\<lbrakk>adjoint_pair ?f ?g; adjoint_pair ?f ?g'\<rbrakk> \<Longrightarrow> ?g \<cong> ?g'

goal (1 subgoal):
 1. g \<cong> g'
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
g \<cong> g'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma H_k_ket_zero_k:
  "k < n \<Longrightarrow> (H_k k) *\<^sub>v (ket_zero_k k) = (ket_plus_k k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k
[PROOF STEP]
proof (induct k)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < n \<Longrightarrow> H_k 0 *\<^sub>v ket_zero_k 0 = ket_plus_k 0
 2. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 < n

goal (2 subgoals):
 1. 0 < n \<Longrightarrow> H_k 0 *\<^sub>v ket_zero_k 0 = ket_plus_k 0
 2. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H_k 0 *\<^sub>v ket_zero_k 0 = ket_plus_k 0
[PROOF STEP]
using hadamard_on_zero
[PROOF STATE]
proof (prove)
using this:
hadamard *\<^sub>v ket_zero = ket_plus

goal (1 subgoal):
 1. H_k 0 *\<^sub>v ket_zero_k 0 = ket_plus_k 0
[PROOF STEP]
unfolding H_k.simps ket_zero_k.simps ket_plus_k.simps
[PROOF STATE]
proof (prove)
using this:
hadamard *\<^sub>v ket_zero = ket_plus

goal (1 subgoal):
 1. hadamard *\<^sub>v ket_zero = ket_plus
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
H_k 0 *\<^sub>v ket_zero_k 0 = ket_plus_k 0

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k
Suc k < n

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k
Suc k < n
[PROOF STEP]
have k: "k < n"
[PROOF STATE]
proof (prove)
using this:
k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k
Suc k < n

goal (1 subgoal):
 1. k < n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
k < n

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
interpret st: partial_state2 dims "{0..<(Suc k)}" "{Suc k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. partial_state2 {0..<Suc k} {Suc k}
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {0..<Suc k} \<inter> {Suc k} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
have "nths dims {0..<Suc k} = replicate (Suc k) 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nths dims {0..<Suc k} = replicate (Suc k) 2
[PROOF STEP]
using dims_nths_le_n Suc
[PROOF STATE]
proof (prove)
using this:
?l \<le> n \<Longrightarrow> nths dims {0..<?l} = replicate ?l 2
k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k
Suc k < n

goal (1 subgoal):
 1. nths dims {0..<Suc k} = replicate (Suc k) 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
nths dims {0..<Suc k} = replicate (Suc k) 2

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
nths dims {0..<Suc k} = replicate (Suc k) 2
[PROOF STEP]
have std1: "st.d1 = 2^(Suc k)"
[PROOF STATE]
proof (prove)
using this:
nths dims {0..<Suc k} = replicate (Suc k) 2

goal (1 subgoal):
 1. st.d1 = 2 ^ Suc k
[PROOF STEP]
unfolding st.d1_def st.dims1_def
[PROOF STATE]
proof (prove)
using this:
nths dims {0..<Suc k} = replicate (Suc k) 2

goal (1 subgoal):
 1. prod_list (nths dims {0..<Suc k}) = 2 ^ Suc k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.d1 = 2 ^ Suc k

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
have std2: "st.d2 = 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.d2 = 2
[PROOF STEP]
unfolding st.d2_def st.dims2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (nths dims {Suc k}) = 2
[PROOF STEP]
using dims_nths_one_lt_n Suc
[PROOF STATE]
proof (prove)
using this:
?l < n \<Longrightarrow> nths dims {?l} = [2]
k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k
Suc k < n

goal (1 subgoal):
 1. prod_list (nths dims {Suc k}) = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.d2 = 2

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
have "H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
have "\<dots> = st.ptensor_vec ((H_k k) *\<^sub>v (ket_zero_k k)) (hadamard *\<^sub>v ket_zero)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero = st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero)
[PROOF STEP]
using st.ptensor_mat_mult_vec[unfolded std1 std2, OF H_k_dim[OF k] ket_zero_k_dim[OF k] hadamard_dim ket_zero_dim]
[PROOF STATE]
proof (prove)
using this:
st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero) = st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero

goal (1 subgoal):
 1. st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero = st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero = st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
st.ptensor_mat (H_k k) hadamard *\<^sub>v st.ptensor_vec (ket_zero_k k) ket_zero = st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero)

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
have "\<dots> = st.ptensor_vec (ket_plus_k k) ket_plus"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero) = st.ptensor_vec (ket_plus_k k) ket_plus
[PROOF STEP]
using Suc hadamard_on_zero
[PROOF STATE]
proof (prove)
using this:
k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k
Suc k < n
hadamard *\<^sub>v ket_zero = ket_plus

goal (1 subgoal):
 1. st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero) = st.ptensor_vec (ket_plus_k k) ket_plus
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
st.ptensor_vec (H_k k *\<^sub>v ket_zero_k k) (hadamard *\<^sub>v ket_zero) = st.ptensor_vec (ket_plus_k k) ket_plus

goal (1 subgoal):
 1. \<And>k. \<lbrakk>k < n \<Longrightarrow> H_k k *\<^sub>v ket_zero_k k = ket_plus_k k; Suc k < n\<rbrakk> \<Longrightarrow> H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = st.ptensor_vec (ket_plus_k k) ket_plus
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = st.ptensor_vec (ket_plus_k k) ket_plus

goal (1 subgoal):
 1. H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
H_k (Suc k) *\<^sub>v ket_zero_k (Suc k) = ket_plus_k (Suc k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma hom_boundary_chain_boundary:
  "\<lbrakk>singular_relcycle p X S c; 1 \<le> p\<rbrakk>
    \<Longrightarrow> hom_boundary (int p) X S (homologous_rel_set p X S c) =
        homologous_rel_set (p - Suc 0) (subtopology X S) {} (chain_boundary p c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>singular_relcycle p X S c; 1 \<le> p\<rbrakk> \<Longrightarrow> hom_boundary (int p) X S (homologous_rel_set p X S c) = homologous_rel_set (p - Suc 0) (subtopology X S) {} (chain_boundary p c)
[PROOF STEP]
by (metis hom_boundary)+


[STATEMENT]
lemma sparse_mult_eq_sum_lookup:
  fixes xs :: "(nat \<times> 'a::comm_semiring_1) list"
  assumes "list_all (\<lambda>(n, x). n < M) xs" "distinct (map fst xs)"
  shows "sparse_mult xs y = (\<Sum>i<M. lookup 0 xs i * y !! i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
from \<open>distinct (map fst xs)\<close>
[PROOF STATE]
proof (chain)
picking this:
distinct (map fst xs)
[PROOF STEP]
have "distinct xs" "inj_on fst (set xs)"
[PROOF STATE]
proof (prove)
using this:
distinct (map fst xs)

goal (1 subgoal):
 1. distinct xs &&& inj_on fst (set xs)
[PROOF STEP]
by (simp_all add: distinct_map)
[PROOF STATE]
proof (state)
this:
distinct xs
inj_on fst (set xs)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distinct xs
inj_on fst (set xs)
[PROOF STEP]
have "sparse_mult xs y = (\<Sum>x\<in>set xs. snd x * y !! fst x)"
[PROOF STATE]
proof (prove)
using this:
distinct xs
inj_on fst (set xs)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>x\<in>set xs. snd x * y !! fst x)
[PROOF STEP]
by (auto intro!: sum.cong simp add: sparse_mult_def sum_list_distinct_conv_sum_set)
[PROOF STATE]
proof (state)
this:
sparse_mult xs y = (\<Sum>x\<in>set xs. snd x * y !! fst x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sparse_mult xs y = (\<Sum>x\<in>set xs. snd x * y !! fst x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>set xs. lookup 0 xs (fst x) * y !! fst x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set xs. snd x * y !! fst x) = (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x) * y !! fst x)
[PROOF STEP]
by (intro sum.cong refl arg_cong2[where f="(*)"]) (simp add: lookup_in_set assms)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set xs. snd x * y !! fst x) = (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x) * y !! fst x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set xs. snd x * y !! fst x) = (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x) * y !! fst x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>fst ` set xs. lookup 0 xs x * y !! x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x) * y !! fst x) = (\<Sum>x\<in>fst ` set xs. lookup (0::'a) xs x * y !! x)
[PROOF STEP]
using \<open>inj_on fst (set xs)\<close>
[PROOF STATE]
proof (prove)
using this:
inj_on fst (set xs)

goal (1 subgoal):
 1. (\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x) * y !! fst x) = (\<Sum>x\<in>fst ` set xs. lookup (0::'a) xs x * y !! x)
[PROOF STEP]
by (simp add: sum.reindex)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x) * y !! fst x) = (\<Sum>x\<in>fst ` set xs. lookup (0::'a) xs x * y !! x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set xs. lookup (0::'a) xs (fst x) * y !! fst x) = (\<Sum>x\<in>fst ` set xs. lookup (0::'a) xs x * y !! x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
have "\<dots> = (\<Sum>x<M. lookup 0 xs x * y !! x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>fst ` set xs. lookup (0::'a) xs x * y !! x) = (\<Sum>x<M. lookup (0::'a) xs x * y !! x)
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
list_all (\<lambda>(n, x). n < M) xs

goal (1 subgoal):
 1. (\<Sum>x\<in>fst ` set xs. lookup (0::'a) xs x * y !! x) = (\<Sum>x<M. lookup (0::'a) xs x * y !! x)
[PROOF STEP]
by (intro sum.mono_neutral_cong_left)
       (auto simp: list_all_iff lookup_eq_map_of map_of_eq_None_iff[THEN iffD2])
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>fst ` set xs. lookup (0::'a) xs x * y !! x) = (\<Sum>x<M. lookup (0::'a) xs x * y !! x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sparse_mult xs y = (\<Sum>x<M. lookup (0::'a) xs x * y !! x)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sparse_mult xs y = (\<Sum>x<M. lookup (0::'a) xs x * y !! x)

goal (1 subgoal):
 1. sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sparse_mult xs y = (\<Sum>i<M. lookup (0::'a) xs i * y !! i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma permutes_implies_inv_image_on_eq:
  assumes "p permutes B"
  shows "(\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
have "\<forall>b \<in> B. \<forall>x \<in> A. p (f x) = b \<longleftrightarrow> f x = inv p b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>b\<in>B. \<forall>x\<in>A. (p (f x) = b) = (f x = inv p b)
[PROOF STEP]
using \<open>p permutes B\<close>
[PROOF STATE]
proof (prove)
using this:
p permutes B

goal (1 subgoal):
 1. \<forall>b\<in>B. \<forall>x\<in>A. (p (f x) = b) = (f x = inv p b)
[PROOF STEP]
by (auto simp add: permutes_inverses)
[PROOF STATE]
proof (state)
this:
\<forall>b\<in>B. \<forall>x\<in>A. (p (f x) = b) = (f x = inv p b)

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<forall>b\<in>B. \<forall>x\<in>A. (p (f x) = b) = (f x = inv p b)
[PROOF STEP]
have "(\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = inv p b}) ` B"
[PROOF STATE]
proof (prove)
using this:
\<forall>b\<in>B. \<forall>x\<in>A. (p (f x) = b) = (f x = inv p b)

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = inv p b}) ` B
[PROOF STEP]
using image_cong
[PROOF STATE]
proof (prove)
using this:
\<forall>b\<in>B. \<forall>x\<in>A. (p (f x) = b) = (f x = inv p b)
\<lbrakk>?M = ?N; \<And>x. x \<in> ?N \<Longrightarrow> ?f x = ?g x\<rbrakk> \<Longrightarrow> ?f ` ?M = ?g ` ?N

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = inv p b}) ` B
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = inv p b}) ` B

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = inv p b}) ` B

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
have "\<dots> = (\<lambda>b. {x \<in> A. f x = b}) ` inv p ` B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. f x = inv p b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` inv p ` B
[PROOF STEP]
by (auto simp add: image_comp)
[PROOF STATE]
proof (state)
this:
(\<lambda>b. {x \<in> A. f x = inv p b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` inv p ` B

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>b. {x \<in> A. f x = inv p b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` inv p ` B

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
have "\<dots> = (\<lambda>b. {x \<in> A. f x = b}) ` B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. f x = b}) ` inv p ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
by (simp add: \<open>p permutes B\<close> permutes_inv permutes_image)
[PROOF STATE]
proof (state)
this:
(\<lambda>b. {x \<in> A. f x = b}) ` inv p ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B

goal (1 subgoal):
 1. (\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>b. {x \<in> A. p (f x) = b}) ` B = (\<lambda>b. {x \<in> A. f x = b}) ` B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dim_unique:
  "B \<subseteq> V \<Longrightarrow> V \<subseteq> span B \<Longrightarrow> independent B \<Longrightarrow> card B = n \<Longrightarrow> dim V = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>B \<subseteq> V; V \<subseteq> span B; independent B; card B = n\<rbrakk> \<Longrightarrow> dim V = n
[PROOF STEP]
by (metis basis_card_eq_dim)


[STATEMENT]
lemma Max_wrt_of_weak_ranking:
  assumes "is_weak_ranking xs"
  shows   "Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
proof (cases xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
 2. \<And>a list. xs = a # list \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
xs = []

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
 2. \<And>a list. xs = a # list \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
hence "of_weak_ranking xs = (\<lambda>_ _. False)"
[PROOF STATE]
proof (prove)
using this:
xs = []

goal (1 subgoal):
 1. of_weak_ranking xs = (\<lambda>_ _. False)
[PROOF STEP]
by (intro ext) simp_all
[PROOF STATE]
proof (state)
this:
of_weak_ranking xs = (\<lambda>_ _. False)

goal (2 subgoals):
 1. xs = [] \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
 2. \<And>a list. xs = a # list \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
with Nil
[PROOF STATE]
proof (chain)
picking this:
xs = []
of_weak_ranking xs = (\<lambda>_ _. False)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
xs = []
of_weak_ranking xs = (\<lambda>_ _. False)

goal (1 subgoal):
 1. Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
by (simp add: Max_wrt_def Max_wrt_among_def)
[PROOF STATE]
proof (state)
this:
Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
case (Cons x xs')
[PROOF STATE]
proof (state)
this:
xs = x # xs'

goal (1 subgoal):
 1. \<And>a list. xs = a # list \<Longrightarrow> Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
is_weak_ranking xs
xs = x # xs'
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_weak_ranking xs
xs = x # xs'

goal (1 subgoal):
 1. Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)
[PROOF STEP]
by (simp add: Max_wrt_of_weak_ranking_Cons)
[PROOF STATE]
proof (state)
this:
Max_wrt (of_weak_ranking xs) = (if xs = [] then {} else hd xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rel_spmf_of_set_bij:
  assumes f: "bij_betw f A B"
  and R: "\<And>x. x \<in> A \<Longrightarrow> R x (f x)"
  shows "rel_spmf R (spmf_of_set A) (spmf_of_set B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
have "finite A \<longleftrightarrow> finite B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite A = finite B
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. finite A = finite B
[PROOF STEP]
by(rule bij_betw_finite)
[PROOF STATE]
proof (state)
this:
finite A = finite B

goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite A = finite B

goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
have "A = {} \<longleftrightarrow> B = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A = {}) = (B = {})
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. (A = {}) = (B = {})
[PROOF STEP]
by(auto dest: bij_betw_empty2 bij_betw_empty1)
[PROOF STATE]
proof (state)
this:
(A = {}) = (B = {})

goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite A = finite B
(A = {}) = (B = {})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
finite A = finite B
(A = {}) = (B = {})

goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A = finite B
(A = {}) = (B = {})
bij_betw f A B
?x \<in> A \<Longrightarrow> R ?x (f ?x)

goal (1 subgoal):
 1. rel_spmf R (spmf_of_set A) (spmf_of_set B)
[PROOF STEP]
by(auto simp add: spmf_of_set_def simp del: spmf_of_pmf_pmf_of_set intro: rel_pmf_of_set_bij)
[PROOF STATE]
proof (state)
this:
rel_spmf R (spmf_of_set A) (spmf_of_set B)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma VLambda_eqI:
  assumes "X = Y" and "\<And>x. x \<in>\<^sub>\<circ> X \<Longrightarrow> f x = g x"
  shows "(\<lambda>x\<in>\<^sub>\<circ>X. f x) = (\<lambda>y\<in>\<^sub>\<circ>Y. g y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VLambda X f = VLambda Y g
[PROOF STEP]
proof(rule vsv_eqI, unfold vdomain_VLambda; (intro assms(1) vsv_VLambda)?)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in>\<^sub>\<circ> X \<Longrightarrow> VLambda X f\<lparr>a\<rparr> = VLambda Y g\<lparr>a\<rparr>
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in>\<^sub>\<circ> X \<Longrightarrow> VLambda X f\<lparr>a\<rparr> = VLambda Y g\<lparr>a\<rparr>
[PROOF STEP]
assume "x \<in>\<^sub>\<circ> X"
[PROOF STATE]
proof (state)
this:
x \<in>\<^sub>\<circ> X

goal (1 subgoal):
 1. \<And>a. a \<in>\<^sub>\<circ> X \<Longrightarrow> VLambda X f\<lparr>a\<rparr> = VLambda Y g\<lparr>a\<rparr>
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
X = Y
?x \<in>\<^sub>\<circ> X \<Longrightarrow> f ?x = g ?x
x \<in>\<^sub>\<circ> X
[PROOF STEP]
show "VLambda X f\<lparr>x\<rparr> = VLambda Y g\<lparr>x\<rparr>"
[PROOF STATE]
proof (prove)
using this:
X = Y
?x \<in>\<^sub>\<circ> X \<Longrightarrow> f ?x = g ?x
x \<in>\<^sub>\<circ> X

goal (1 subgoal):
 1. VLambda X f\<lparr>x\<rparr> = VLambda Y g\<lparr>x\<rparr>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
VLambda X f\<lparr>x\<rparr> = VLambda Y g\<lparr>x\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed