[STATEMENT]
lemma card_1_Collect_ex1: assumes "card (Collect P) = 1"
  shows "\<exists>! x. P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>!x. P x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>!x. P x
[PROOF STEP]
from assms[unfolded card_eq_1_iff]
[PROOF STATE]
proof (chain)
picking this:
\<exists>x. Collect P = {x}
[PROOF STEP]
obtain x where "Collect P = {x}"
[PROOF STATE]
proof (prove)
using this:
\<exists>x. Collect P = {x}

goal (1 subgoal):
 1. (\<And>x. Collect P = {x} \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Collect P = {x}

goal (1 subgoal):
 1. \<exists>!x. P x
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Collect P = {x}

goal (1 subgoal):
 1. \<exists>!x. P x
[PROOF STEP]
by (intro ex1I[of _ x], auto)
[PROOF STATE]
proof (state)
this:
\<exists>!x. P x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma path_weight_elem_trans:
  "s \<in>\<^sub>A path_weight l1 l2 \<Longrightarrow> s' \<in>\<^sub>A path_weight l2 l3 \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
assume ps1: "s  \<in>\<^sub>A path_weight l1 l2"
[PROOF STATE]
proof (state)
this:
s \<in>\<^sub>A path_weight l1 l2

goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
assume ps2: "s' \<in>\<^sub>A path_weight l2 l3"
[PROOF STATE]
proof (state)
this:
s' \<in>\<^sub>A path_weight l2 l3

goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
from ps1
[PROOF STATE]
proof (chain)
picking this:
s \<in>\<^sub>A path_weight l1 l2
[PROOF STEP]
obtain xs where path1: "path l1 l2 xs" "s = sum_path_weights xs"
[PROOF STATE]
proof (prove)
using this:
s \<in>\<^sub>A path_weight l1 l2

goal (1 subgoal):
 1. (\<And>xs. \<lbrakk>path l1 l2 xs; s = sum_weights (map (\<lambda>(s, l, t). l) xs)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto intro: path_weight_path)
[PROOF STATE]
proof (state)
this:
path l1 l2 xs
s = sum_weights (map (\<lambda>(s, l, t). l) xs)

goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
from ps2
[PROOF STATE]
proof (chain)
picking this:
s' \<in>\<^sub>A path_weight l2 l3
[PROOF STEP]
obtain ys where path2: "path l2 l3 ys" "s' = sum_path_weights ys"
[PROOF STATE]
proof (prove)
using this:
s' \<in>\<^sub>A path_weight l2 l3

goal (1 subgoal):
 1. (\<And>ys. \<lbrakk>path l2 l3 ys; s' = sum_weights (map (\<lambda>(s, l, t). l) ys)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto intro: path_weight_path)
[PROOF STATE]
proof (state)
this:
path l2 l3 ys
s' = sum_weights (map (\<lambda>(s, l, t). l) ys)

goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
from path1(1) path2(1)
[PROOF STATE]
proof (chain)
picking this:
path l1 l2 xs
path l2 l3 ys
[PROOF STEP]
have "path l1 l3 (xs @ ys)"
[PROOF STATE]
proof (prove)
using this:
path l1 l2 xs
path l2 l3 ys

goal (1 subgoal):
 1. path l1 l3 (xs @ ys)
[PROOF STEP]
by (rule path_trans)
[PROOF STATE]
proof (state)
this:
path l1 l3 (xs @ ys)

goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
with path1(2) path2(2)
[PROOF STATE]
proof (chain)
picking this:
s = sum_weights (map (\<lambda>(s, l, t). l) xs)
s' = sum_weights (map (\<lambda>(s, l, t). l) ys)
path l1 l3 (xs @ ys)
[PROOF STEP]
have "s + s' \<in> {s. path_weightp l1 l3 s}"
[PROOF STATE]
proof (prove)
using this:
s = sum_weights (map (\<lambda>(s, l, t). l) xs)
s' = sum_weights (map (\<lambda>(s, l, t). l) ys)
path l1 l3 (xs @ ys)

goal (1 subgoal):
 1. s + s' \<in> {s. path_weightp l1 l3 s}
[PROOF STEP]
by (auto simp: path_weightp_def sum_weights_append[symmetric])
[PROOF STATE]
proof (state)
this:
s + s' \<in> {s. path_weightp l1 l3 s}

goal (1 subgoal):
 1. \<lbrakk>s \<in>\<^sub>A path_weight l1 l2; s' \<in>\<^sub>A path_weight l2 l3\<rbrakk> \<Longrightarrow> \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
s + s' \<in> {s. path_weightp l1 l3 s}
[PROOF STEP]
show "\<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'"
[PROOF STATE]
proof (prove)
using this:
s + s' \<in> {s. path_weightp l1 l3 s}

goal (1 subgoal):
 1. \<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'
[PROOF STEP]
by transfer (simp add: minimal_antichain_path_weightp_member)
[PROOF STATE]
proof (state)
this:
\<exists>u. u \<in>\<^sub>A path_weight l1 l3 \<and> u \<le> s + s'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma GRP130_1_002:
  "(group_element(e_1)) &
  (group_element(e_2)) &
  (~equal(e_1::'a,e_2)) &
  (~equal(e_2::'a,e_1)) &
  (\<forall>X Y. group_element(X) & group_element(Y) --> product(X::'a,Y,e_1) | product(X::'a,Y,e_2)) &
  (\<forall>X Y W Z. product(X::'a,Y,W) & product(X::'a,Y,Z) --> equal(W::'a,Z)) &
  (\<forall>X Y W Z. product(X::'a,W,Y) & product(X::'a,Z,Y) --> equal(W::'a,Z)) &
  (\<forall>Y X W Z. product(W::'a,Y,X) & product(Z::'a,Y,X) --> equal(W::'a,Z)) &
  (\<forall>Z1 Z2 Y X. product(X::'a,Y,Z1) & product(X::'a,Z1,Z2) --> product(Z2::'a,Y,X)) --> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. group_element e_1 \<and> group_element e_2 \<and> \<not> equal (e_1, e_2) \<and> \<not> equal (e_2, e_1) \<and> (\<forall>X Y. group_element X \<and> group_element Y \<longrightarrow> product (X, Y, e_1) \<or> product (X, Y, e_2)) \<and> (\<forall>X Y W Z. product (X, Y, W) \<and> product (X, Y, Z) \<longrightarrow> equal (W, Z)) \<and> (\<forall>X Y W Z. product (X, W, Y) \<and> product (X, Z, Y) \<longrightarrow> equal (W, Z)) \<and> (\<forall>Y X W Z. product (W, Y, X) \<and> product (Z, Y, X) \<longrightarrow> equal (W, Z)) \<and> (\<forall>Z1 Z2 Y X. product (X, Y, Z1) \<and> product (X, Z1, Z2) \<longrightarrow> product (Z2, Y, X)) \<longrightarrow> False
[PROOF STEP]
by meson


[STATEMENT]
lemma (in prob_space) discounted_value_real_cond_exp:
  assumes "integrable M X"
  and "-1 < r"
and "subalgebra M G"
  shows "AE w in M. real_cond_exp M G ((discounted_value r (\<lambda> m. X)) n) w =
    discounted_value r (\<lambda>m. (real_cond_exp M G X)) n w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AEeq M (real_cond_exp M G (discounted_value r (\<lambda>m. X) n)) (discounted_value r (\<lambda>m. real_cond_exp M G X) n)
[PROOF STEP]
using  assms
[PROOF STATE]
proof (prove)
using this:
integrable M X
- 1 < r
subalgebra M G

goal (1 subgoal):
 1. AEeq M (real_cond_exp M G (discounted_value r (\<lambda>m. X) n)) (discounted_value r (\<lambda>m. real_cond_exp M G X) n)
[PROOF STEP]
unfolding discounted_value_def  init_triv_filt_def filtration_def
[PROOF STATE]
proof (prove)
using this:
integrable M X
- 1 < r
subalgebra M G

goal (1 subgoal):
 1. AEeq M (real_cond_exp M G (\<lambda>w. discount_factor r n w * X w)) (\<lambda>w. discount_factor r n w * real_cond_exp M G X w)
[PROOF STEP]
by (simp add: assms discount_factor_real_cond_exp)


[STATEMENT]
lemma tendsto_powr_complex' [tendsto_intros]:
  fixes f g :: "_ \<Rightarrow> complex"
  assumes "a \<notin> \<real>\<^sub>\<le>\<^sub>0 \<or> (a = 0 \<and> Re b > 0)" and "(f \<longlongrightarrow> a) F" "(g \<longlongrightarrow> b) F"
  shows   "((\<lambda>z. f z powr g z) \<longlongrightarrow> a powr b) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>z. f z powr g z) \<longlongrightarrow> a powr b) F
[PROOF STEP]
using assms tendsto_powr_complex tendsto_powr_complex_0
[PROOF STATE]
proof (prove)
using this:
a \<notin> \<real>\<^sub>\<le>\<^sub>0 \<or> a = 0 \<and> 0 < Re b
(f \<longlongrightarrow> a) F
(g \<longlongrightarrow> b) F
\<lbrakk>?a \<notin> \<real>\<^sub>\<le>\<^sub>0; (?f \<longlongrightarrow> ?a) ?F; (?g \<longlongrightarrow> ?b) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>z. ?f z powr ?g z) \<longlongrightarrow> ?a powr ?b) ?F
\<lbrakk>(?f \<longlongrightarrow> 0) ?F; (?g \<longlongrightarrow> ?b) ?F; 0 < Re ?b\<rbrakk> \<Longrightarrow> ((\<lambda>z. ?f z powr ?g z) \<longlongrightarrow> 0) ?F

goal (1 subgoal):
 1. ((\<lambda>z. f z powr g z) \<longlongrightarrow> a powr b) F
[PROOF STEP]
by fastforce


[STATEMENT]
lemma H_g_orbital:
  "P = (\<lambda>s. (\<forall>X\<in>ivp_sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> Q (X t))) \<Longrightarrow>
  \<^bold>{P\<^bold>} (x\<acute>= f & G on U S @ t\<^sub>0) \<^bold>{Q\<^bold>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P = (\<lambda>s. \<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> Q (X t)) \<Longrightarrow> \<^bold>{P\<^bold>}x\<acute>= f & G on U S @ t\<^sub>0\<^bold>{Q\<^bold>}
[PROOF STEP]
unfolding ndfun_kat_H g_ode_def g_orbital_eq
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P = (\<lambda>s. \<forall>X\<in>Sols f U S t\<^sub>0 s. \<forall>t\<in>U s. (\<forall>\<tau>\<in>down (U s) t. G (X \<tau>)) \<longrightarrow> Q (X t)) \<Longrightarrow> \<forall>s s'. P s \<longrightarrow> s2p ((((\<lambda>s. {X t |t X. s2p (U s) t \<and> \<P> X (down (U s) t) \<subseteq> Collect G \<and> s2p (Sols f U S t\<^sub>0 s) X})\<^sup>\<bullet>)\<^sub>\<bullet>) s) s' \<longrightarrow> Q s'
[PROOF STEP]
by clarsimp


[STATEMENT]
lemma uminus_Sup: "- (\<Squnion>A) = \<Sqinter>(uminus ` A)" for A :: \<open>'a::complete_orthocomplemented_lattice set\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - \<Squnion> A = \<Sqinter> (uminus ` A)
[PROOF STEP]
by (metis (no_types, lifting) uminus_INF image_cong image_ident ortho_involution)


[STATEMENT]
lemma delete_edges_correct:
    "FiniteGraph.delete_edges (list_graph_to_graph G) (set E) = list_graph_to_graph (delete_edges G E)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FiniteGraph.delete_edges (list_graph_to_graph G) (set E) = list_graph_to_graph (FiniteListGraph.delete_edges G E)
[PROOF STEP]
unfolding list_graph_to_graph_def FiniteGraph.delete_edges_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lparr>nodes = nodes \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr>, edges = {(e1, e2). (e1, e2) \<in> edges \<lparr>nodes = set (nodesL G), edges = set (edgesL G)\<rparr> \<and> (e1, e2) \<notin> set E}\<rparr> = \<lparr>nodes = set (nodesL (FiniteListGraph.delete_edges G E)), edges = set (edgesL (FiniteListGraph.delete_edges G E))\<rparr>
[PROOF STEP]
by (auto simp add: delete_edges_as_filter )


[STATEMENT]
lemma stirling_integral_conv_stirling_integral_Suc:
  assumes "n > 0"
  shows   "stirling_integral n s =
             of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s -
             of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. stirling_integral n s = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. stirling_integral n s = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
have "(\<lambda>N. of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) -
             of_real (bernoulli (Suc n)) / (real (Suc n) * s ^ n) +
             integral {0..real N} (\<lambda>x. of_nat n / of_nat (Suc n) *
                (of_real (pbernpoly (Suc n) x) / (of_real x + s) ^ Suc n)))
           \<longlonglongrightarrow> 0 - of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) +
                   of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s" (is "?f \<longlonglongrightarrow> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + integral {0..real N} (\<lambda>x. of_nat n / of_nat (Suc n) * (complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s
[PROOF STEP]
unfolding stirling_integral_def integral_mult_right
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + of_nat n / of_nat (Suc n) * integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n)) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * lim (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))
[PROOF STEP]
using convergent_stirling_integral[of "Suc n"] assms s
[PROOF STATE]
proof (prove)
using this:
0 < Suc n \<Longrightarrow> convergent (\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))
0 < n
s \<notin> \<real>\<^sub>\<le>\<^sub>0

goal (1 subgoal):
 1. (\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + of_nat n / of_nat (Suc n) * integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n)) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * lim (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))
[PROOF STEP]
by (intro tendsto_intros pbernpoly_over_power_tendsto_0)
       (auto simp: convergent_LIMSEQ_iff simp del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
(\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + integral {0..real N} (\<lambda>x. of_nat n / of_nat (Suc n) * (complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s

goal (1 subgoal):
 1. stirling_integral n s = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + integral {0..real N} (\<lambda>x. of_nat n / of_nat (Suc n) * (complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s

goal (1 subgoal):
 1. stirling_integral n s = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
have "?this \<longleftrightarrow> (\<lambda>N. integral {0..real N}
               (\<lambda>x. of_real (pbernpoly n x) / (of_real x + s) ^ n)) \<longlonglongrightarrow>
               of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s -
                 of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + integral {0..real N} (\<lambda>x. of_nat n / of_nat (Suc n) * (complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s = (\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
using eventually_gt_at_top[of "0::nat"] pbernpoly_integral_conv_pbernpoly_integral_Suc[of n]
          assms
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially
1 \<le> n \<Longrightarrow> integral {0..real ?N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n) = complex_of_real (pbernpoly (Suc n) (real ?N)) / (of_nat (Suc n) * (s + of_nat ?N) ^ n) - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * integral {0..real ?N} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n)
0 < n

goal (1 subgoal):
 1. (\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + integral {0..real N} (\<lambda>x. of_nat n / of_nat (Suc n) * (complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s = (\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
unfolding integral_mult_right
[PROOF STATE]
proof (prove)
using this:
eventually ((<) 0) sequentially
1 \<le> n \<Longrightarrow> integral {0..real ?N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n) = complex_of_real (pbernpoly (Suc n) (real ?N)) / (of_nat (Suc n) * (s + of_nat ?N) ^ n) - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * integral {0..real ?N} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n)
0 < n

goal (1 subgoal):
 1. (\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + of_nat n / of_nat (Suc n) * integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n)) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s = (\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
by (intro filterlim_cong refl) (auto elim!: eventually_mono simp del: power_Suc)
[PROOF STATE]
proof (state)
this:
(\<lambda>N. complex_of_real (pbernpoly (Suc n) (real N)) / (of_nat (Suc n) * (s + of_nat N) ^ n) - complex_of_real (bernoulli (Suc n)) / (complex_of_real (real (Suc n)) * s ^ n) + integral {0..real N} (\<lambda>x. of_nat n / of_nat (Suc n) * (complex_of_real (pbernpoly (Suc n) x) / (complex_of_real x + s) ^ Suc n))) \<longlonglongrightarrow> 0 - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n) + of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s = (\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)

goal (1 subgoal):
 1. stirling_integral n s = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)

goal (1 subgoal):
 1. stirling_integral n s = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
unfolding stirling_integral_def[of n]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>N. integral {0..real N} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) \<longlonglongrightarrow> of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)

goal (1 subgoal):
 1. lim (\<lambda>x. integral {0..real x} (\<lambda>x. complex_of_real (pbernpoly n x) / (complex_of_real x + s) ^ n)) = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)
[PROOF STEP]
by (rule limI)
[PROOF STATE]
proof (state)
this:
stirling_integral n s = of_nat n / of_nat (Suc n) * stirling_integral (Suc n) s - complex_of_real (bernoulli (Suc n)) / (of_nat (Suc n) * s ^ n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cancel_separate_2:
  assumes "x * y \<le> 1"
    shows "((w \<sqinter> x) \<squnion> (z \<sqinter> y))\<^sup>\<star> = (z \<sqinter> y)\<^sup>\<star> * (w \<sqinter> x)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<sqinter> x \<squnion> z \<sqinter> y)\<^sup>\<star> = (z \<sqinter> y)\<^sup>\<star> * (w \<sqinter> x)\<^sup>\<star>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (w \<sqinter> x \<squnion> z \<sqinter> y)\<^sup>\<star> = (z \<sqinter> y)\<^sup>\<star> * (w \<sqinter> x)\<^sup>\<star>
[PROOF STEP]
have "(w \<sqinter> x) * (z \<sqinter> y) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coreflexive ((w \<sqinter> x) * (z \<sqinter> y))
[PROOF STEP]
by (meson assms comp_isotone order.trans inf.cobounded2)
[PROOF STATE]
proof (state)
this:
coreflexive ((w \<sqinter> x) * (z \<sqinter> y))

goal (1 subgoal):
 1. (w \<sqinter> x \<squnion> z \<sqinter> y)\<^sup>\<star> = (z \<sqinter> y)\<^sup>\<star> * (w \<sqinter> x)\<^sup>\<star>
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
coreflexive ((w \<sqinter> x) * (z \<sqinter> y))

goal (1 subgoal):
 1. (w \<sqinter> x \<squnion> z \<sqinter> y)\<^sup>\<star> = (z \<sqinter> y)\<^sup>\<star> * (w \<sqinter> x)\<^sup>\<star>
[PROOF STEP]
using cancel_separate_1 sup_commute
[PROOF STATE]
proof (prove)
using this:
coreflexive ((w \<sqinter> x) * (z \<sqinter> y))
coreflexive (?x * ?y) \<Longrightarrow> (?x \<squnion> ?y)\<^sup>\<star> = ?y\<^sup>\<star> * ?x\<^sup>\<star>
?x \<squnion> ?y = ?y \<squnion> ?x

goal (1 subgoal):
 1. (w \<sqinter> x \<squnion> z \<sqinter> y)\<^sup>\<star> = (z \<sqinter> y)\<^sup>\<star> * (w \<sqinter> x)\<^sup>\<star>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(w \<sqinter> x \<squnion> z \<sqinter> y)\<^sup>\<star> = (z \<sqinter> y)\<^sup>\<star> * (w \<sqinter> x)\<^sup>\<star>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in domain) univ_poly_units':
  assumes "subfield K R" shows "p \<in> Units (K[X]) \<longleftrightarrow> p \<in> carrier (K[X]) \<and> p \<noteq> [] \<and> degree p = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in> Units (K [X])) = (p \<in> carrier (K [X]) \<and> p \<noteq> [] \<and> degree p = 0)
[PROOF STEP]
unfolding univ_poly_units[OF assms] sym[OF univ_poly_carrier] polynomial_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (p \<in> {[k] |k. k \<in> K - {\<zero>}}) = ((p = [] \<or> set p \<subseteq> K \<and> lead_coeff p \<noteq> \<zero>) \<and> p \<noteq> [] \<and> degree p = 0)
[PROOF STEP]
by (auto, metis hd_in_set le_0_eq le_Suc_eq length_0_conv length_Suc_conv list.sel(1) subsetD)


[STATEMENT]
lemma num_params_split_by_prec_le: "num_params (fst (split_by_prec ord x)) \<le> K"
  "num_params (snd (split_by_prec ord x)) \<le> K"
  if "num_params x \<le> K" for x::"float poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. num_params (fst (split_by_prec ord x)) \<le> K &&& num_params (snd (split_by_prec ord x)) \<le> K
[PROOF STEP]
using split_by_prec_correct_insertion(2,3)[of ord x, OF surjective_pairing] that
[PROOF STATE]
proof (prove)
using this:
num_params (fst (split_by_prec ord x)) \<le> num_params x
num_params (snd (split_by_prec ord x)) \<le> num_params x
num_params x \<le> K

goal (1 subgoal):
 1. num_params (fst (split_by_prec ord x)) \<le> K &&& num_params (snd (split_by_prec ord x)) \<le> K
[PROOF STEP]
by auto


[STATEMENT]
lemma final_Plus [simp]: "final (Plus fsm1 fsm2) = final fsm1 + final fsm2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. final (Plus fsm1 fsm2) = final fsm1 + final fsm2
[PROOF STEP]
by (simp add: Plus_def)


[STATEMENT]
lemma not_USUP_ind: "(\<not> (\<Squnion> i \<bullet> P(i))) = (\<Sqinter> i \<bullet> \<not> P(i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (\<Squnion> i \<bullet> P i)) = (\<Sqinter> i \<bullet> \<not> P i)
[PROOF STEP]
by (pred_auto)


[STATEMENT]
lemma extended_Gromov_product_le_liminf:
  assumes "(\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi"
          "(\<lambda>n. to_Gromov_completion (v n)) \<longlonglongrightarrow> eta"
  shows "liminf (\<lambda>n. Gromov_product_at e (u n) (v n)) \<ge> extended_Gromov_product_at e xi eta"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. extended_Gromov_product_at e xi eta \<le> liminf (\<lambda>x. ereal (Gromov_product_at e (u x) (v x)))
[PROOF STEP]
unfolding extended_Gromov_product_at_topological
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Inf {liminf (\<lambda>n. ereal (Gromov_product_at e (u n) (v n))) |u v. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi \<and> (\<lambda>n. to_Gromov_completion (v n)) \<longlonglongrightarrow> eta} \<le> liminf (\<lambda>x. ereal (Gromov_product_at e (u x) (v x)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi
(\<lambda>n. to_Gromov_completion (v n)) \<longlonglongrightarrow> eta

goal (1 subgoal):
 1. Inf {liminf (\<lambda>n. ereal (Gromov_product_at e (u n) (v n))) |u v. (\<lambda>n. to_Gromov_completion (u n)) \<longlonglongrightarrow> xi \<and> (\<lambda>n. to_Gromov_completion (v n)) \<longlonglongrightarrow> eta} \<le> liminf (\<lambda>x. ereal (Gromov_product_at e (u x) (v x)))
[PROOF STEP]
by (auto intro!: Inf_lower)


[STATEMENT]
theorem wls_vsubstEnv_compose2:
assumes  "wlsEnv rho"
and "ys \<noteq> zs \<or> y \<notin> {z,z1}"
shows "((rho &[y1 // y]_ys) &[z1 // z]_zs) =
       ((rho &[z1 // z]_zs) &[(y1 @ys[z1 / z]_zs) // y]_ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rho &[y1 // y]_ys &[z1 // z]_zs = rho &[z1 // z]_zs &[y1 @ys[z1 / z]_zs // y]_ys
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
wlsEnv rho
ys \<noteq> zs \<or> y \<notin> {z, z1}

goal (1 subgoal):
 1. rho &[y1 // y]_ys &[z1 // z]_zs = rho &[z1 // z]_zs &[y1 @ys[z1 / z]_zs // y]_ys
[PROOF STEP]
by(simp add: vsubstEnv_compose2)


[STATEMENT]
lemma light_year_eq [si_eq]: "\<lbrakk>light_year\<rbrakk>\<^sub>Q = \<lbrakk>\<^bold>c \<^bold>\<cdot> julian_year\<rbrakk>\<^sub>Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>light_year\<rbrakk>\<^sub>Q = \<lbrakk>\<^bold>c \<^bold>\<cdot> julian_year\<rbrakk>\<^sub>Q
[PROOF STEP]
using light_year quant_equiv_iff
[PROOF STATE]
proof (prove)
using this:
light_year \<cong>\<^sub>Q \<^bold>c \<^bold>\<cdot> julian_year
(?x \<cong>\<^sub>Q ?y) = (\<lbrakk>?x\<rbrakk>\<^sub>Q = \<lbrakk>?y\<rbrakk>\<^sub>Q \<and> QD(?'u\<^sub>1) = QD(?'u\<^sub>2))

goal (1 subgoal):
 1. \<lbrakk>light_year\<rbrakk>\<^sub>Q = \<lbrakk>\<^bold>c \<^bold>\<cdot> julian_year\<rbrakk>\<^sub>Q
[PROOF STEP]
by blast


[STATEMENT]
lemma while_mult_zero_zero:
  "(x * (y \<star> bot)) \<star> bot = x * (y \<star> bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (y \<star> bot) \<star> bot = x * (y \<star> bot)
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x * (y \<star> bot) \<star> bot \<le> x * (y \<star> bot)
 2. x * (y \<star> bot) \<le> x * (y \<star> bot) \<star> bot
[PROOF STEP]
apply (metis sup_bot_left while_left_unfold mult_assoc le_supI1 mult_left_zero mult_right_isotone while_left_dist_sup while_sub_associative)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (y \<star> bot) \<le> x * (y \<star> bot) \<star> bot
[PROOF STEP]
by (metis mult_left_zero while_denest_1)


[STATEMENT]
lemma exec_tmp:
  "rec_exec (rec_all (Cn 2 rec_minus [recf.id 2 0, Cn 2 (constn (Suc 0)) [recf.id 2 0]])
  (Cn 3 rec_noteq [Cn 3 rec_mult [recf.id 3 (Suc 0), recf.id 3 2], recf.id 3 0]))  [x, k] =
  ((if (\<forall>w\<le>rec_exec (Cn 2 rec_minus [recf.id 2 0, Cn 2 (constn (Suc 0)) [recf.id 2 0]]) ([x, k]).
  0 < rec_exec (Cn 3 rec_noteq [Cn 3 rec_mult [recf.id 3 (Suc 0), recf.id 3 2], recf.id 3 0])
  ([x, k] @ [w])) then 1 else 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rec_exec (rec_all (Cn 2 rec_minus [recf.id 2 0, Cn 2 (constn (Suc 0)) [recf.id 2 0]]) (Cn 3 rec_noteq [Cn 3 rec_mult [recf.id 3 (Suc 0), recf.id 3 2], recf.id 3 0])) [x, k] = (if \<forall>w\<le>rec_exec (Cn 2 rec_minus [recf.id 2 0, Cn 2 (constn (Suc 0)) [recf.id 2 0]]) [x, k]. 0 < rec_exec (Cn 3 rec_noteq [Cn 3 rec_mult [recf.id 3 (Suc 0), recf.id 3 2], recf.id 3 0]) ([x, k] @ [w]) then 1 else 0)
[PROOF STEP]
apply(rule_tac all_lemma)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. primerec (Cn 3 rec_noteq [Cn 3 rec_mult [recf.id 3 (Suc 0), recf.id 3 2], recf.id 3 0]) (Suc (length [x, k]))
 2. primerec (Cn 2 rec_minus [recf.id 2 0, Cn 2 (constn (Suc 0)) [recf.id 2 0]]) (length [x, k])
[PROOF STEP]
apply(auto simp:numeral_eqs_upto_12)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>i. i < Suc (Suc 0) \<Longrightarrow> primerec ([Cn (Suc (Suc (Suc 0))) rec_mult [recf.id (Suc (Suc (Suc 0))) (Suc 0), recf.id (Suc (Suc (Suc 0))) (Suc (Suc 0))], recf.id (Suc (Suc (Suc 0))) 0] ! i) (Suc (Suc (Suc 0)))
 2. \<And>i. i < Suc (Suc 0) \<Longrightarrow> primerec ([recf.id (Suc (Suc 0)) 0, Cn (Suc (Suc 0)) (constn (Suc 0)) [recf.id (Suc (Suc 0)) 0]] ! i) (Suc (Suc 0))
[PROOF STEP]
apply (metis (no_types, lifting) Suc_mono length_Cons less_2_cases list.size(3) nth_Cons_0
      nth_Cons_Suc numeral_2_eq_2 prime_cn prime_id primerec_rec_mult_2 zero_less_Suc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < Suc (Suc 0) \<Longrightarrow> primerec ([recf.id (Suc (Suc 0)) 0, Cn (Suc (Suc 0)) (constn (Suc 0)) [recf.id (Suc (Suc 0)) 0]] ! i) (Suc (Suc 0))
[PROOF STEP]
by (metis (no_types, lifting) One_nat_def length_Cons less_2_cases nth_Cons_0 nth_Cons_Suc
      prime_cn_reverse primerec_rec_eq_2 rec_eq_def zero_less_Suc)


[STATEMENT]
lemma DERIV_local_const:
  fixes f :: "real \<Rightarrow> real"
  shows "DERIV f x :> l \<Longrightarrow> 0 < d \<Longrightarrow> \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> f x = f y \<Longrightarrow> l = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_real_derivative l) (at x); 0 < d; \<forall>y. \<bar>x - y\<bar> < d \<longrightarrow> f x = f y\<rbrakk> \<Longrightarrow> l = 0
[PROOF STEP]
by (auto dest!: DERIV_local_max)


[STATEMENT]
lemma interval_integral_to_infinity_eq: "(LINT x=ereal a..\<infinity> | M. f x) = (LINT x : {a<..} | M. f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integral M (ereal a) \<infinity> f = set_lebesgue_integral M {a<..} f
[PROOF STEP]
unfolding interval_lebesgue_integral_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if ereal a \<le> \<infinity> then set_lebesgue_integral M (einterval (ereal a) \<infinity>) f else - set_lebesgue_integral M (einterval \<infinity> (ereal a)) f) = set_lebesgue_integral M {a<..} f
[PROOF STEP]
by auto


[STATEMENT]
lemma matrix_to_iarray_fst_Gauss_Jordan_det_P:
shows "fst (Gauss_Jordan_det_P A) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_det_P A) = fst (Gauss_Jordan_det_P_iarrays (matrix_to_iarray A))
[PROOF STEP]
unfolding Gauss_Jordan_det_P_def Gauss_Jordan_det_P_iarrays_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_upt_k_det_P A (ncols A - 1)) = fst (Gauss_Jordan_upt_k_det_P_iarrays (matrix_to_iarray A) (ncols_iarray (matrix_to_iarray A) - 1))
[PROOF STEP]
using matrix_to_iarray_fst_Gauss_Jordan_upt_k_det_P
[PROOF STATE]
proof (prove)
using this:
?k < ncols ?A \<Longrightarrow> fst (Gauss_Jordan_upt_k_det_P ?A ?k) = fst (Gauss_Jordan_upt_k_det_P_iarrays (matrix_to_iarray ?A) ?k)

goal (1 subgoal):
 1. fst (Gauss_Jordan_upt_k_det_P A (ncols A - 1)) = fst (Gauss_Jordan_upt_k_det_P_iarrays (matrix_to_iarray A) (ncols_iarray (matrix_to_iarray A) - 1))
[PROOF STEP]
by (metis diff_less matrix_to_iarray_ncols ncols_not_0 neq0_conv zero_less_one)


[STATEMENT]
lemma "\<forall>(y::int) (z::int) (n::int).
    3 dvd z \<longrightarrow> 2 dvd (y::int) \<longrightarrow> (\<exists>(x::int). 2*x = y) \<and> (\<exists>(k::int). 3*k = z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>y z n. 3 dvd z \<longrightarrow> even y \<longrightarrow> (\<exists>x. 2 * x = y) \<and> (\<exists>k. 3 * k = z)
[PROOF STEP]
by cooper


[STATEMENT]
lemma ipurge_ref_last:
 "ipurge_ref I D u (xs @ [x]) X =
   (if (u, D x) \<in> I \<or> (\<exists>v \<in> sinks I D u xs. (v, D x) \<in> I)
    then ipurge_ref I D u xs {x' \<in> X. (D x, D x') \<notin> I}
    else ipurge_ref I D u xs X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipurge_ref I D u (xs @ [x]) X = (if (u, D x) \<in> I \<or> (\<exists>v\<in>sinks I D u xs. (v, D x) \<in> I) then ipurge_ref I D u xs {x' \<in> X. (D x, D x') \<notin> I} else ipurge_ref I D u xs X)
[PROOF STEP]
proof (cases "(u, D x) \<in> I \<or> (\<exists>v \<in> sinks I D u xs. (v, D x) \<in> I)",
 simp_all add: ipurge_ref_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (u, D x) \<in> I \<or> (\<exists>v\<in>sinks I D u xs. (v, D x) \<in> I) \<Longrightarrow> {xa \<in> X. (u, D xa) \<notin> I \<and> (D x, D xa) \<notin> I \<and> (\<forall>v\<in>sinks I D u xs. (v, D xa) \<notin> I)} = {xa \<in> X. (D x, D xa) \<notin> I \<and> (u, D xa) \<notin> I \<and> (\<forall>v\<in>sinks I D u xs. (v, D xa) \<notin> I)}
[PROOF STEP]
qed blast


[STATEMENT]
lemma alternate_length:
  "length (alternate xs) = (1+length xs) div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (alternate xs) = (1 + length xs) div 2
[PROOF STEP]
by (induct xs rule:induct_list012;simp)


[STATEMENT]
lemma "2 \<le> x \<and> x \<le> 125841 / 50000 \<and> 2 \<le> y \<and> y \<le> 125841 / 50000 \<and> 2 \<le> z \<and> z \<le> 125841 / 50000 \<longrightarrow>
    2 * (x * z + x * y + y * z) - (x * x + y * y + z * z) \<ge> (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> x \<and> x \<le> 125841 / 50000 \<and> 2 \<le> y \<and> y \<le> 125841 / 50000 \<and> 2 \<le> z \<and> z \<le> 125841 / 50000 \<longrightarrow> 0 \<le> 2 * (x * z + x * y + y * z) - (x * x + y * y + z * z)
[PROOF STEP]
by (sos "(((A<0 * R<1) + ((R<1 * ((R<5749028157/5000000000 * [~25000/222477*x + ~25000/222477*y + ~25000/222477*z + 1]^2) + ((R<864067/1779816 * [419113/864067*x + 419113/864067*y + z]^2) + ((R<320795/864067 * [419113/1283180*x + y]^2) + (R<1702293/5132720 * [x]^2))))) + (((A<=4 * (A<=5 * R<1)) * (R<3/2 * [1]^2)) + (((A<=3 * (A<=5 * R<1)) * (R<1/2 * [1]^2)) + (((A<=2 * (A<=4 * R<1)) * (R<1 * [1]^2)) + (((A<=2 * (A<=3 * R<1)) * (R<3/2 * [1]^2)) + (((A<=1 * (A<=5 * R<1)) * (R<1/2 * [1]^2)) + (((A<=1 * (A<=3 * R<1)) * (R<1/2 * [1]^2)) + (((A<=0 * (A<=4 * R<1)) * (R<1 * [1]^2)) + (((A<=0 * (A<=2 * R<1)) * (R<1 * [1]^2)) + ((A<=0 * (A<=1 * R<1)) * (R<3/2 * [1]^2)))))))))))))")


[STATEMENT]
lemma length_insert_nth: "length (insert_nth n x xs) = Suc (length xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (insert_nth n x xs) = Suc (length xs)
[PROOF STEP]
by (induct xs) auto


[STATEMENT]
lemma diff_ge_divisor_imp_sub_mod_less: "
  \<lbrakk> (x::nat) \<le> y; m \<le> y - x; 0 < m \<rbrakk> \<Longrightarrow> x < y - (y - x) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; m \<le> y - x; 0 < m\<rbrakk> \<Longrightarrow> x < y - (y - x) mod m
[PROOF STEP]
apply (simp only: less_diff_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; m \<le> y - x; 0 < m\<rbrakk> \<Longrightarrow> x + (y - x) mod m < y
[PROOF STEP]
apply (simp only: le_diff_conv2 add.commute[of m])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> y; x + m \<le> y; 0 < m\<rbrakk> \<Longrightarrow> x + (y - x) mod m < y
[PROOF STEP]
apply (rule less_le_trans[of _ "x + m"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>x \<le> y; x + m \<le> y; 0 < m\<rbrakk> \<Longrightarrow> x + (y - x) mod m < x + m
 2. \<lbrakk>x \<le> y; x + m \<le> y; 0 < m\<rbrakk> \<Longrightarrow> x + m \<le> y
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma drop_set: \<open>j \<le> length xs \<Longrightarrow> x \<in> set (drop j xs) \<equiv> (\<exists>k. j\<le>k\<and>k<length xs \<and> xs!k=x)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j \<le> length xs \<Longrightarrow> x \<in> set (drop j xs) \<equiv> \<exists>k\<ge>j. k < length xs \<and> xs ! k = x
[PROOF STEP]
by (smt (verit) Misc.in_set_drop_conv_nth)


[STATEMENT]
lemma Pring_smult_cfs:
  assumes "a \<in> carrier R"
  assumes "P \<in> carrier (Pring R I)"
  shows "(a \<odot>\<^bsub>Pring R I\<^esub> P) m = a \<otimes> (P m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (a \<odot>\<^bsub>Pring R I\<^esub> P) m = a \<otimes> P m
[PROOF STEP]
using assms Pring_smult
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier R
P \<in> carrier (Pring R I)
(\<odot>\<^bsub>Pring R ?I\<^esub>) = poly_scalar_mult R

goal (1 subgoal):
 1. (a \<odot>\<^bsub>Pring R I\<^esub> P) m = a \<otimes> P m
[PROOF STEP]
by (simp add: Pring_smult poly_scalar_mult_def)


[STATEMENT]
lemma DERIV_mult[derivative_intros]:
  "(f has_field_derivative Da) (at x within s) \<Longrightarrow> (g has_field_derivative Db) (at x within s) \<Longrightarrow>
    ((\<lambda>x. f x * g x) has_field_derivative Da * g x + Db * f x) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative Da) (at x within s); (g has_field_derivative Db) (at x within s)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_field_derivative Da * g x + Db * f x) (at x within s)
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative[OF has_derivative_mult])
     (auto simp: field_simps dest: has_field_derivative_imp_has_derivative)


[STATEMENT]
lemma Bounded_vec_rows_Bounded_mat[simp]: "set (rows A) \<subseteq> Bounded_vec B \<longleftrightarrow> A \<in> Bounded_mat B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set (rows A) \<subseteq> Bounded_vec B) = (A \<in> Bounded_mat B)
[PROOF STEP]
unfolding rows_def Bounded_vec_def Bounded_mat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set (map (row A) [0..<dim_row A]) \<subseteq> {x. \<forall>i<dim_vec x. \<bar>x $ i\<bar> \<le> B}) = (A \<in> {A. \<forall>i<dim_row A. \<forall>j<dim_col A. \<bar>A $$ (i, j)\<bar> \<le> B})
[PROOF STEP]
by force


[STATEMENT]
lemma tends_to_real_e:
  fixes u::"nat \<Rightarrow> real"
  assumes "u \<longlonglongrightarrow> l" "e>0"
  shows "\<exists>N. \<forall>n>N. abs(u n -l) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>N. \<forall>n>N. \<bar>u n - l\<bar> < e
[PROOF STEP]
by (metis assms dist_real_def le_less lim_sequentially)


[STATEMENT]
lemma SA_is_abelian_monoid:
  shows "abelian_monoid (SA n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. abelian_monoid (SA n)
[PROOF STEP]
using SA_is_ring[of n]
[PROOF STATE]
proof (prove)
using this:
ring (SA n)

goal (1 subgoal):
 1. abelian_monoid (SA n)
[PROOF STEP]
unfolding ring_def abelian_group_def
[PROOF STATE]
proof (prove)
using this:
(abelian_monoid (SA n) \<and> abelian_group_axioms (SA n)) \<and> Group.monoid (SA n) \<and> ring_axioms (SA n)

goal (1 subgoal):
 1. abelian_monoid (SA n)
[PROOF STEP]
by blast


[STATEMENT]
lemma bernoulli_stream_sets:
  assumes "0 < q"
  and "q < 1"
  and "0 < p"
  and "p < 1"
shows "sets (bernoulli_stream p) = sets (bernoulli_stream q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (bernoulli_stream p) = sets (bernoulli_stream q)
[PROOF STEP]
unfolding bernoulli_stream_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (stream_space (measure_pmf (bernoulli_pmf p))) = sets (stream_space (measure_pmf (bernoulli_pmf q)))
[PROOF STEP]
by (rule sets_stream_space_cong, simp)


[STATEMENT]
lemma arccos_less_mono: "\<bar>x\<bar> \<le> 1 \<Longrightarrow> \<bar>y\<bar> \<le> 1 \<Longrightarrow> arccos x < arccos y \<longleftrightarrow> y < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<bar>x\<bar> \<le> 1; \<bar>y\<bar> \<le> 1\<rbrakk> \<Longrightarrow> (arccos x < arccos y) = (y < x)
[PROOF STEP]
by (rule trans [OF cos_mono_less_eq [symmetric]]) (use arccos_ubound arccos_lbound in auto)


[STATEMENT]
lemma eval_Mn [simp]:
  assumes "recfn (length xs) (Mn n f)"
  shows "eval (Mn n f) xs =
   (if (\<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>))
    then Some (LEAST z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>))
    else None)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval (Mn n f) xs = (if \<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>) then Some (LEAST z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>)) else None)
[PROOF STEP]
using assms eval_def
[PROOF STATE]
proof (prove)
using this:
recfn (length xs) (Mn n f)
recfn (length ?xs) ?f \<Longrightarrow> eval ?f ?xs \<equiv> eval_wellf ?f ?xs

goal (1 subgoal):
 1. eval (Mn n f) xs = (if \<exists>z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>) then Some (LEAST z. eval f (z # xs) \<down>= 0 \<and> (\<forall>y<z. eval f (y # xs) \<down>)) else None)
[PROOF STEP]
by auto


[STATEMENT]
lemma joinTree_cases: "(\<exists>r. t=(Relation r)) \<or> (\<exists>l rr. t=(Join l (Relation rr)))
    \<or> (\<exists>l lr rr. t=(Join l (Join lr rr)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>r. t = Relation r) \<or> (\<exists>l rr. t = Join l (Relation rr)) \<or> (\<exists>l lr rr. t = Join l (Join lr rr))
[PROOF STEP]
apply(cases t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1. t = Relation x1 \<Longrightarrow> (\<exists>r. t = Relation r) \<or> (\<exists>l rr. t = Join l (Relation rr)) \<or> (\<exists>l lr rr. t = Join l (Join lr rr))
 2. \<And>x21 x22. t = Join x21 x22 \<Longrightarrow> (\<exists>r. t = Relation r) \<or> (\<exists>l rr. t = Join l (Relation rr)) \<or> (\<exists>l lr rr. t = Join l (Join lr rr))
[PROOF STEP]
apply(auto)[2]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x21 x22. \<lbrakk>t = Join x21 x22; \<forall>lr rr. x22 \<noteq> Join lr rr\<rbrakk> \<Longrightarrow> \<exists>rr. x22 = Relation rr
[PROOF STEP]
by (meson joinTree.exhaust)


[STATEMENT]
lemma polytope_translation_eq: "polytope (image (\<lambda>x. a + x) S) \<longleftrightarrow> polytope S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polytope ((+) a ` S) = polytope S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. polytope ((+) a ` S) = polytope S
[PROOF STEP]
have "\<And>a A. polytope A \<Longrightarrow> polytope ((+) a ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a A. polytope A \<Longrightarrow> polytope ((+) a ` A)
[PROOF STEP]
by (metis (no_types) convex_hull_translation finite_imageI polytope_def)
[PROOF STATE]
proof (state)
this:
polytope ?A \<Longrightarrow> polytope ((+) ?a ` ?A)

goal (1 subgoal):
 1. polytope ((+) a ` S) = polytope S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
polytope ?A \<Longrightarrow> polytope ((+) ?a ` ?A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
polytope ?A \<Longrightarrow> polytope ((+) ?a ` ?A)

goal (1 subgoal):
 1. polytope ((+) a ` S) = polytope S
[PROOF STEP]
by (metis (no_types) add.left_inverse image_add_0 translation_assoc)
[PROOF STATE]
proof (state)
this:
polytope ((+) a ` S) = polytope S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tendsto_of_real_iff:
  "((\<lambda>x. of_real (f x) :: 'a::real_normed_div_algebra) \<longlongrightarrow> of_real c) F \<longleftrightarrow> (f \<longlongrightarrow> c) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. of_real (f x)) \<longlongrightarrow> of_real c) F = (f \<longlongrightarrow> c) F
[PROOF STEP]
unfolding tendsto_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>e>0. \<forall>\<^sub>F x in F. dist (of_real (f x)) (of_real c) < e) = (\<forall>e>0. \<forall>\<^sub>F x in F. dist (f x) c < e)
[PROOF STEP]
by simp


[STATEMENT]
lemma funpow_shift1_degree: "degree (funpow k shift1 p) = k + degree p "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Reflected_Multivariate_Polynomial.degree ((shift1 ^^ k) p) = k + Reflected_Multivariate_Polynomial.degree p
[PROOF STEP]
by (induct k arbitrary: p) (auto simp add: shift1_degree)


[STATEMENT]
lemma power_mk_dimvec [si_def]:
  "(power (mk_dimvec xs) n :: ('n::ring_1, 'a::enum) dimvec) =
    (if (length xs = CARD('a)) then mk_dimvec (map ((*) (of_nat n)) xs) else mk_dimvec xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_dimvec xs ^ n = (if length xs = CARD('a) then mk_dimvec (map ((\<cdot>) (of_nat n)) xs) else mk_dimvec xs)
[PROOF STEP]
by (induct n, simp add: one_dimvec_def mk_dimvec_def)
     (auto simp add: times_mk_dimvec zip_map_map[where f="id", simplified] comp_def split_beta' zip_same_conv_map distrib_right mult.commute)


[STATEMENT]
lemma darcs_children_count_ge2_aux:
  assumes "(t1,e1) \<in> fset xs" and "(t2,e2) \<in> fset xs" and "(t1,e1) \<noteq> (t2,e2)"
      and "e \<in> darcs t1" and "e \<in> darcs t2"
    shows "(\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e) \<ge> 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)
[PROOF STEP]
have "2 \<le> 1 + count (darcs_mset t2) e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 \<le> 1 + count (darcs_mset t2) e
[PROOF STEP]
using assms(2,5)
[PROOF STATE]
proof (prove)
using this:
(t2, e2) \<in> fset xs
e \<in> darcs t2

goal (1 subgoal):
 1. 2 \<le> 1 + count (darcs_mset t2) e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 \<le> 1 + count (darcs_mset t2) e

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
2 \<le> 1 + count (darcs_mset t2) e

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)
[PROOF STEP]
have "\<dots> \<le> count (darcs_mset t1) e + count (darcs_mset t2) e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 + count (darcs_mset t2) e \<le> count (darcs_mset t1) e + count (darcs_mset t2) e
[PROOF STEP]
using assms(1,4)
[PROOF STATE]
proof (prove)
using this:
(t1, e1) \<in> fset xs
e \<in> darcs t1

goal (1 subgoal):
 1. 1 + count (darcs_mset t2) e \<le> count (darcs_mset t1) e + count (darcs_mset t2) e
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 + count (darcs_mset t2) e \<le> count (darcs_mset t1) e + count (darcs_mset t2) e

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
2 \<le> count (darcs_mset t1) e + count (darcs_mset t2) e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
2 \<le> count (darcs_mset t1) e + count (darcs_mset t2) e

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)
[PROOF STEP]
using fset_sum_ge_elem2[OF assms(1-3), of "\<lambda>(t1,e1). count (darcs_mset t1) e"]
[PROOF STATE]
proof (prove)
using this:
2 \<le> count (darcs_mset t1) e + count (darcs_mset t2) e
(case (t1, e1) of (t1, e1) \<Rightarrow> count (darcs_mset t1) e) + (case (t2, e2) of (t1, e1) \<Rightarrow> count (darcs_mset t1) e) \<le> (\<Sum>x\<in>fset xs. case x of (t1, e1) \<Rightarrow> count (darcs_mset t1) e)

goal (1 subgoal):
 1. 2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
2 \<le> (\<Sum>(t1, e1)\<in>fset xs. count (darcs_mset t1) e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_mat_kernel_berlekamp_resulting_mat:
assumes x: "transpose_mat (berlekamp_mat u) *\<^sub>v x = x"
and x_dim: "x \<in> carrier_vec (degree u)"
shows "x \<in> mat_kernel (berlekamp_resulting_mat u)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
let ?QI="(mat(dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u))
         (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
have *: "(transpose_mat (berlekamp_mat u) - 1\<^sub>m (degree u)) = transpose_mat  ?QI"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (berlekamp_mat u)\<^sup>T - 1\<^sub>m (degree u) = (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(berlekamp_mat u)\<^sup>T - 1\<^sub>m (degree u) = (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T

goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
have "(transpose_mat (berlekamp_mat u) - 1\<^sub>m (dim_row (berlekamp_mat u))) *\<^sub>v x = 0\<^sub>v (dim_vec x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((berlekamp_mat u)\<^sup>T - 1\<^sub>m (dim_row (berlekamp_mat u))) *\<^sub>v x = 0\<^sub>v (dim_vec x)
[PROOF STEP]
using system_iff[of "berlekamp_mat u" x] x_dim x
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>dim_row (berlekamp_mat u) = dim_col (berlekamp_mat u); dim_row (berlekamp_mat u) = dim_vec x\<rbrakk> \<Longrightarrow> ((berlekamp_mat u)\<^sup>T *\<^sub>v x = x) = (((berlekamp_mat u)\<^sup>T - 1\<^sub>m (dim_row (berlekamp_mat u))) *\<^sub>v x = 0\<^sub>v (dim_vec x))
x \<in> carrier_vec (degree u)
(berlekamp_mat u)\<^sup>T *\<^sub>v x = x

goal (1 subgoal):
 1. ((berlekamp_mat u)\<^sup>T - 1\<^sub>m (dim_row (berlekamp_mat u))) *\<^sub>v x = 0\<^sub>v (dim_vec x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((berlekamp_mat u)\<^sup>T - 1\<^sub>m (dim_row (berlekamp_mat u))) *\<^sub>v x = 0\<^sub>v (dim_vec x)

goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
hence "transpose_mat ?QI *\<^sub>v x = 0\<^sub>v (degree u)"
[PROOF STATE]
proof (prove)
using this:
((berlekamp_mat u)\<^sup>T - 1\<^sub>m (dim_row (berlekamp_mat u))) *\<^sub>v x = 0\<^sub>v (dim_vec x)

goal (1 subgoal):
 1. (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)
[PROOF STEP]
using x_dim *
[PROOF STATE]
proof (prove)
using this:
((berlekamp_mat u)\<^sup>T - 1\<^sub>m (dim_row (berlekamp_mat u))) *\<^sub>v x = 0\<^sub>v (dim_vec x)
x \<in> carrier_vec (degree u)
(berlekamp_mat u)\<^sup>T - 1\<^sub>m (degree u) = (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T

goal (1 subgoal):
 1. (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)

goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
hence "berlekamp_resulting_mat u *\<^sub>v x = 0\<^sub>v (degree u)"
[PROOF STATE]
proof (prove)
using this:
(mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)

goal (1 subgoal):
 1. berlekamp_resulting_mat u *\<^sub>v x = 0\<^sub>v (degree u)
[PROOF STEP]
unfolding berlekamp_resulting_mat_def Let_def
[PROOF STATE]
proof (prove)
using this:
(mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)

goal (1 subgoal):
 1. gauss_jordan_single (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)
[PROOF STEP]
using gauss_jordan_single(1)[of "transpose_mat ?QI" "degree u" "degree u" _ x] x_dim
[PROOF STATE]
proof (prove)
using this:
(mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)
\<lbrakk>(mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T \<in> carrier_mat (degree u) (degree u); gauss_jordan_single (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T = ?C; x \<in> carrier_vec (degree u)\<rbrakk> \<Longrightarrow> ((mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)) = (?C *\<^sub>v x = 0\<^sub>v (degree u))
x \<in> carrier_vec (degree u)

goal (1 subgoal):
 1. gauss_jordan_single (mat (dim_row (berlekamp_mat u)) (dim_row (berlekamp_mat u)) (\<lambda>(i, j). if i = j then berlekamp_mat u $$ (i, j) - 1 else berlekamp_mat u $$ (i, j)))\<^sup>T *\<^sub>v x = 0\<^sub>v (degree u)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
berlekamp_resulting_mat u *\<^sub>v x = 0\<^sub>v (degree u)

goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
berlekamp_resulting_mat u *\<^sub>v x = 0\<^sub>v (degree u)

goal (1 subgoal):
 1. x \<in> mat_kernel (berlekamp_resulting_mat u)
[PROOF STEP]
by (auto simp add: mat_kernel_def x_dim)
[PROOF STATE]
proof (state)
this:
x \<in> mat_kernel (berlekamp_resulting_mat u)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fv_foldr1_Disj[simp]: "fv (foldr1 Disj Qs Q) = (if Qs = [] then fv Q else (\<Union>Q \<in> set Qs. fv Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv (foldr1 Disj Qs Q) = (if Qs = [] then fv Q else \<Union> (fv ` set Qs))
[PROOF STEP]
by (cases Qs) auto


[STATEMENT]
lemma coeff_0_mult: "coeff (p * q) 0 = coeff p 0 * coeff q 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. constant_term (p * q) = constant_term p * constant_term q
[PROOF STEP]
by (simp add: coeff_mult)


[STATEMENT]
lemma blinfun_inverse_left:
  fixes f::"'a::euclidean_space \<Rightarrow>\<^sub>L 'a" and f'
  shows "f o\<^sub>L f' = 1\<^sub>L \<longleftrightarrow> f' o\<^sub>L f = 1\<^sub>L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f o\<^sub>L f' = 1\<^sub>L) = (f' o\<^sub>L f = 1\<^sub>L)
[PROOF STEP]
by transfer
    (auto dest!: bounded_linear.linear simp: id_def[symmetric]
      linear_inverse_left)


[STATEMENT]
lemma inf_associative:
  "-x \<sqinter> (-y \<sqinter> -z) = (-x \<sqinter> -y) \<sqinter> -z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - x \<sqinter> (- y \<sqinter> - z) = - x \<sqinter> - y \<sqinter> - z
[PROOF STEP]
using sub_associative sub_inf_def sub_sup_closed
[PROOF STATE]
proof (prove)
using this:
- ?x \<squnion> (- ?y \<squnion> - ?z) = - ?x \<squnion> - ?y \<squnion> - ?z
- ?x \<sqinter> - ?y = - (- - ?x \<squnion> - - ?y)
- ?x \<squnion> - ?y = - - (- ?x \<squnion> - ?y)

goal (1 subgoal):
 1. - x \<sqinter> (- y \<sqinter> - z) = - x \<sqinter> - y \<sqinter> - z
[PROOF STEP]
by auto


[STATEMENT]
lemma arctan_le_self: "0 \<le> x \<Longrightarrow> arctan x \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> arctan x \<le> x
[PROOF STEP]
by (metis abs_arctan_le abs_of_nonneg zero_le_arctan_iff)


[STATEMENT]
lemma Liminf_set_filter_commute:
  "Liminf_llist (lmap (\<lambda>X. {x \<in> X. p x}) Xs) = {x \<in> Liminf_llist Xs. p x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Liminf_llist (lmap (\<lambda>X. {x \<in> X. p x}) Xs) = {x \<in> Liminf_llist Xs. p x}
[PROOF STEP]
unfolding Liminf_llist_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>i\<in>{i. enat i < llength (lmap (\<lambda>X. {x \<in> X. p x}) Xs)}. \<Inter> (lnth (lmap (\<lambda>X. {x \<in> X. p x}) Xs) ` {j. i \<le> j \<and> enat j < llength (lmap (\<lambda>X. {x \<in> X. p x}) Xs)})) = {x \<in> \<Union>i\<in>{i. enat i < llength Xs}. \<Inter> (lnth Xs ` {j. i \<le> j \<and> enat j < llength Xs}). p x}
[PROOF STEP]
by force


[STATEMENT]
lemma bfun_nonneg_pos: "bfun_nonneg x + bfun_nonneg (-x) = bfun_pos x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bfun_nonneg x + bfun_nonneg (- x) = bfun_pos x
[PROOF STEP]
by (auto simp: bfun_nonneg.rep_eq bfun_pos.rep_eq)


[STATEMENT]
lemma fincomp_0': "f \<in> {..n} \<rightarrow> M \<Longrightarrow> (f 0) \<cdot> fincomp f {Suc 0..n} = fincomp f {..n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> {..n} \<rightarrow> M \<Longrightarrow> f 0 \<cdot> fincomp f {Suc 0..n} = fincomp f {..n}
[PROOF STEP]
by (metis Pi_split_insert_domain Suc_n_not_le_n atLeastAtMost_iff atLeastAtMost_insertL atMost_atLeast0 finite_atLeastAtMost fincomp_insert le0)


[STATEMENT]
lemma power_strict_mono:
  shows "a < b \<Longrightarrow> 0 \<le> a \<Longrightarrow> 0 < n \<Longrightarrow> a ^ n < b ^ n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a < b; (0::'a) \<le> a; 0 < n\<rbrakk> \<Longrightarrow> a ^ n < b ^ n
[PROOF STEP]
by (subst nonneg_power_less, auto)


[STATEMENT]
lemma complete_treeD_node31:
  "\<lbrakk> complete (treeD l'); complete m; complete r; hD l' = height r; height m = height r \<rbrakk>
  \<Longrightarrow> complete (treeD (node31 l' a m b r))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>complete (treeD l'); complete m; complete r; hD l' = height r; height m = height r\<rbrakk> \<Longrightarrow> complete (treeD (node31 l' a m b r))
[PROOF STEP]
by(induct l' a m b r rule: node31.induct) auto


[STATEMENT]
lemma direct_decomp_independent_some_basis:
  assumes "direct_decomp A ss" and "\<And>s. s \<in> set ss \<Longrightarrow> subspace s"
  shows "independent (\<Union>(some_basis ` set ss))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.independent (\<Union> (some_basis ` set ss))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
direct_decomp A ss
?s \<in> set ss \<Longrightarrow> local.subspace ?s

goal (1 subgoal):
 1. local.independent (\<Union> (some_basis ` set ss))
[PROOF STEP]
proof (induct ss arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>direct_decomp A []; \<And>s. s \<in> set [] \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set []))
 2. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
direct_decomp A []
?s \<in> set [] \<Longrightarrow> local.subspace ?s

goal (2 subgoals):
 1. \<And>A. \<lbrakk>direct_decomp A []; \<And>s. s \<in> set [] \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set []))
 2. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
from independent_empty
[PROOF STATE]
proof (chain)
picking this:
local.independent {}
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
local.independent {}

goal (1 subgoal):
 1. local.independent (\<Union> (some_basis ` set []))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.independent (\<Union> (some_basis ` set []))

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
case (Cons s ss)
[PROOF STATE]
proof (state)
this:
\<lbrakk>direct_decomp ?A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss))
direct_decomp A (s # ss)
?s \<in> set (s # ss) \<Longrightarrow> local.subspace ?s

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
have 1: "\<And>s'. s' \<in> set ss \<Longrightarrow> subspace s'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s'. s' \<in> set ss \<Longrightarrow> local.subspace s'
[PROOF STEP]
by (rule Cons.prems) simp
[PROOF STATE]
proof (state)
this:
?s' \<in> set ss \<Longrightarrow> local.subspace ?s'

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
have "subspace s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.subspace s
[PROOF STEP]
by (rule Cons.prems) simp
[PROOF STATE]
proof (state)
this:
local.subspace s

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
hence "0 \<in> s" and eq1: "span (some_basis s) = s"
[PROOF STATE]
proof (prove)
using this:
local.subspace s

goal (1 subgoal):
 1. (0::'b) \<in> s &&& local.span (some_basis s) = s
[PROOF STEP]
by (rule subspace_0, rule span_some_basis)
[PROOF STATE]
proof (state)
this:
(0::'b) \<in> s
local.span (some_basis s) = s

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
from Cons.prems(1)
[PROOF STATE]
proof (chain)
picking this:
direct_decomp A (s # ss)
[PROOF STEP]
have *: "direct_decomp A ([s] @ ss)"
[PROOF STATE]
proof (prove)
using this:
direct_decomp A (s # ss)

goal (1 subgoal):
 1. direct_decomp A ([s] @ ss)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
direct_decomp A ([s] @ ss)

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
direct_decomp A ([s] @ ss)

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
from \<open>0 \<in> s\<close>
[PROOF STATE]
proof (chain)
picking this:
(0::'b) \<in> s
[PROOF STEP]
have "{} \<notin> set [s]"
[PROOF STATE]
proof (prove)
using this:
(0::'b) \<in> s

goal (1 subgoal):
 1. {} \<notin> set [s]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{} \<notin> set [s]

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
direct_decomp A ([s] @ ss)
{} \<notin> set [s]
[PROOF STEP]
have 2: "direct_decomp (sum_list ` listset ss) ss"
[PROOF STATE]
proof (prove)
using this:
direct_decomp A ([s] @ ss)
{} \<notin> set [s]

goal (1 subgoal):
 1. direct_decomp (sum_list ` listset ss) ss
[PROOF STEP]
by (rule direct_decomp_appendD)
[PROOF STATE]
proof (state)
this:
direct_decomp (sum_list ` listset ss) ss

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
hence eq2: "span (\<Union> (some_basis ` set ss)) = sum_list ` listset ss"
[PROOF STATE]
proof (prove)
using this:
direct_decomp (sum_list ` listset ss) ss

goal (1 subgoal):
 1. local.span (\<Union> (some_basis ` set ss)) = sum_list ` listset ss
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
direct_decomp (sum_list ` listset ss) ss
?s' \<in> set ss \<Longrightarrow> local.subspace ?s'

goal (1 subgoal):
 1. local.span (\<Union> (some_basis ` set ss)) = sum_list ` listset ss
[PROOF STEP]
by (rule direct_decomp_span_some_basis)
[PROOF STATE]
proof (state)
this:
local.span (\<Union> (some_basis ` set ss)) = sum_list ` listset ss

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
note independent_some_basis[of s]
[PROOF STATE]
proof (state)
this:
local.independent (some_basis s)

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.independent (some_basis s)

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
from 2 1
[PROOF STATE]
proof (chain)
picking this:
direct_decomp (sum_list ` listset ss) ss
?s' \<in> set ss \<Longrightarrow> local.subspace ?s'
[PROOF STEP]
have "independent (\<Union> (some_basis ` set ss))"
[PROOF STATE]
proof (prove)
using this:
direct_decomp (sum_list ` listset ss) ss
?s' \<in> set ss \<Longrightarrow> local.subspace ?s'

goal (1 subgoal):
 1. local.independent (\<Union> (some_basis ` set ss))
[PROOF STEP]
by (rule Cons.hyps)
[PROOF STATE]
proof (state)
this:
local.independent (\<Union> (some_basis ` set ss))

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.independent (\<Union> (some_basis ` set ss))

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
have "span (some_basis s) \<inter> span (\<Union> (some_basis ` set ss)) = {0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
from *
[PROOF STATE]
proof (chain)
picking this:
direct_decomp A ([s] @ ss)
[PROOF STEP]
have "direct_decomp A [sum_list ` listset [s], sum_list ` listset ss]"
[PROOF STATE]
proof (prove)
using this:
direct_decomp A ([s] @ ss)

goal (1 subgoal):
 1. direct_decomp A [sum_list ` listset [s], sum_list ` listset ss]
[PROOF STEP]
by (rule direct_decomp_appendD)
[PROOF STATE]
proof (state)
this:
direct_decomp A [sum_list ` listset [s], sum_list ` listset ss]

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
hence "direct_decomp A [s, sum_list ` listset ss]"
[PROOF STATE]
proof (prove)
using this:
direct_decomp A [sum_list ` listset [s], sum_list ` listset ss]

goal (1 subgoal):
 1. direct_decomp A [s, sum_list ` listset ss]
[PROOF STEP]
by (simp add: image_image)
[PROOF STATE]
proof (state)
this:
direct_decomp A [s, sum_list ` listset ss]

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
direct_decomp A [s, sum_list ` listset ss]

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
have "0 < (1::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 < 1

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 < 1

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
have "1 < length [s, sum_list ` listset ss]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < length [s, sum_list ` listset ss]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 < length [s, sum_list ` listset ss]

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
direct_decomp A [s, sum_list ` listset ss]
0 < 1
1 < length [s, sum_list ` listset ss]
[PROOF STEP]
have "[s, sum_list ` listset ss] ! 0 \<inter> [s, sum_list ` listset ss] ! 1 = {0}"
[PROOF STATE]
proof (prove)
using this:
direct_decomp A [s, sum_list ` listset ss]
0 < 1
1 < length [s, sum_list ` listset ss]

goal (1 subgoal):
 1. [s, sum_list ` listset ss] ! 0 \<inter> [s, sum_list ` listset ss] ! 1 = {0::'b}
[PROOF STEP]
by (rule direct_decomp_Int_zero) (auto simp: \<open>0 \<in> s\<close> eq2[symmetric] span_zero)
[PROOF STATE]
proof (state)
this:
[s, sum_list ` listset ss] ! 0 \<inter> [s, sum_list ` listset ss] ! 1 = {0::'b}

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
[s, sum_list ` listset ss] ! 0 \<inter> [s, sum_list ` listset ss] ! 1 = {0::'b}

goal (1 subgoal):
 1. local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
by (simp add: eq1 eq2)
[PROOF STATE]
proof (state)
this:
local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.independent (some_basis s)
local.independent (\<Union> (some_basis ` set ss))
local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}
[PROOF STEP]
have "independent (some_basis s \<union> (\<Union> (some_basis ` set ss)))"
[PROOF STATE]
proof (prove)
using this:
local.independent (some_basis s)
local.independent (\<Union> (some_basis ` set ss))
local.span (some_basis s) \<inter> local.span (\<Union> (some_basis ` set ss)) = {0::'b}

goal (1 subgoal):
 1. local.independent (some_basis s \<union> \<Union> (some_basis ` set ss))
[PROOF STEP]
by (rule independent_UnI)
[PROOF STATE]
proof (state)
this:
local.independent (some_basis s \<union> \<Union> (some_basis ` set ss))

goal (1 subgoal):
 1. \<And>a ss A. \<lbrakk>\<And>A. \<lbrakk>direct_decomp A ss; \<And>s. s \<in> set ss \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set ss)); direct_decomp A (a # ss); \<And>s. s \<in> set (a # ss) \<Longrightarrow> local.subspace s\<rbrakk> \<Longrightarrow> local.independent (\<Union> (some_basis ` set (a # ss)))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
local.independent (some_basis s \<union> \<Union> (some_basis ` set ss))

goal (1 subgoal):
 1. local.independent (\<Union> (some_basis ` set (s # ss)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
local.independent (\<Union> (some_basis ` set (s # ss)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Infinitesimal_square_iff: "x \<in> Infinitesimal \<longleftrightarrow> x * x \<in> Infinitesimal"
  for x :: "'a::real_normed_div_algebra star"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<in> Infinitesimal) = (x * x \<in> Infinitesimal)
[PROOF STEP]
using Infinitesimal_mult Infinitesimal_mult_disj
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> Infinitesimal; ?y \<in> Infinitesimal\<rbrakk> \<Longrightarrow> ?x * ?y \<in> Infinitesimal
?x * ?y \<in> Infinitesimal \<Longrightarrow> ?x \<in> Infinitesimal \<or> ?y \<in> Infinitesimal

goal (1 subgoal):
 1. (x \<in> Infinitesimal) = (x * x \<in> Infinitesimal)
[PROOF STEP]
by auto


[STATEMENT]
lemma fold_union_empty_iff: "fold List.union xss ys = [] \<longleftrightarrow> (\<forall>xs \<in> set xss. xs = []) \<and> ys = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (fold List.union xss ys = []) = ((\<forall>xs\<in>set xss. xs = []) \<and> ys = [])
[PROOF STEP]
by (induct xss arbitrary: ys) (auto simp: union_empty_iff)


[STATEMENT]
lemma eq_len_iff: assumes eq: "x \<cdot> y = u \<cdot> v" shows "\<^bold>|x\<^bold>| \<le> \<^bold>|u\<^bold>| \<longleftrightarrow> \<^bold>|v\<^bold>| \<le> \<^bold>|y\<^bold>|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<^bold>|x\<^bold>| \<le> \<^bold>|u\<^bold>|) = (\<^bold>|v\<^bold>| \<le> \<^bold>|y\<^bold>|)
[PROOF STEP]
using lenarg[OF eq]
[PROOF STATE]
proof (prove)
using this:
\<^bold>|x \<cdot> y\<^bold>| = \<^bold>|u \<cdot> v\<^bold>|

goal (1 subgoal):
 1. (\<^bold>|x\<^bold>| \<le> \<^bold>|u\<^bold>|) = (\<^bold>|v\<^bold>| \<le> \<^bold>|y\<^bold>|)
[PROOF STEP]
unfolding lenmorph
[PROOF STATE]
proof (prove)
using this:
\<^bold>|x\<^bold>| + \<^bold>|y\<^bold>| = \<^bold>|u\<^bold>| + \<^bold>|v\<^bold>|

goal (1 subgoal):
 1. (\<^bold>|x\<^bold>| \<le> \<^bold>|u\<^bold>|) = (\<^bold>|v\<^bold>| \<le> \<^bold>|y\<^bold>|)
[PROOF STEP]
by auto


[STATEMENT]
lemma wnf_lemma_5:
  "(-p \<squnion> -q) * (-q * x \<squnion> --q * y) = -q * x \<squnion> --q * -p * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- p \<squnion> - q) * (- q * x \<squnion> - - q * y) = - q * x \<squnion> - - q * - p * y
[PROOF STEP]
by (smt (z3) mult_left_dist_sup sup_commute tests_dual.sba_dual.sub_sup_closed tests_dual.sba_dual.sup_complement_intro tests_dual.sba_dual.sup_idempotent tests_dual.sup_idempotent mult_assoc tests_dual.wnf_lemma_3)


[STATEMENT]
lemma prime_divisors: "prime p \<longleftrightarrow> divisors p = {1,p} \<and> p>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p = (divisors p = {1, p} \<and> 1 < p)
[PROOF STEP]
by (auto simp add: divisors_def prime_nat_iff)


[STATEMENT]
lemma vintersection_assoc: "A \<inter>\<^sub>\<circ> (B \<inter>\<^sub>\<circ> C) = (A \<inter>\<^sub>\<circ> B) \<inter>\<^sub>\<circ> C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<inter>\<^sub>\<circ> (B \<inter>\<^sub>\<circ> C) = A \<inter>\<^sub>\<circ> B \<inter>\<^sub>\<circ> C
[PROOF STEP]
by auto


[STATEMENT]
lemma add_eq_exists: "\<exists>x. a+x = (b::'a::ab_group_add)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x. a + x = b
[PROOF STEP]
by (rule_tac x="b-a" in exI, simp)


[STATEMENT]
lemma card_numbers2[simp]: "card ([n]^\<two>) = n choose 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card [n]^\<two> = n choose 2
[PROOF STEP]
by (subst card_sameprod, auto simp: numbers_def)


[STATEMENT]
lemma nat_geSucSuc0_conv: "(Suc (Suc 0) \<le> n) = (n \<noteq> 0 \<and> n \<noteq> Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Suc (Suc 0) \<le> n) = (n \<noteq> 0 \<and> n \<noteq> Suc 0)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma unitary11_gen_comp:
  assumes "unitary11_gen M1" and "mat_det M1 \<noteq> 0" and "unitary11_gen M2"  and "mat_det M2 \<noteq> 0"
  shows "unitary11_gen (M1 *\<^sub>m\<^sub>m M2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unitary11_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. unitary11_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
unitary11_gen M1
mat_det M1 \<noteq> 0
unitary11_gen M2
mat_det M2 \<noteq> 0
[PROOF STEP]
obtain k1 k2 a1 a2 b1 b2 where
    "k1 \<noteq> 0 \<and> mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0 \<and> M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1)"
    "k2 \<noteq> 0 \<and> mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0 \<and> M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2)"
[PROOF STATE]
proof (prove)
using this:
unitary11_gen M1
mat_det M1 \<noteq> 0
unitary11_gen M2
mat_det M2 \<noteq> 0

goal (1 subgoal):
 1. (\<And>k1 a1 b1 k2 a2 b2. \<lbrakk>k1 \<noteq> 0 \<and> mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0 \<and> M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1); k2 \<noteq> 0 \<and> mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0 \<and> M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using unitary11_gen_iff[of M1]  unitary11_gen_iff[of M2]
[PROOF STATE]
proof (prove)
using this:
unitary11_gen M1
mat_det M1 \<noteq> 0
unitary11_gen M2
mat_det M2 \<noteq> 0
unitary11_gen M1 = (\<exists>k a b. k \<noteq> 0 \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0 \<and> M1 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a))
unitary11_gen M2 = (\<exists>k a b. k \<noteq> 0 \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0 \<and> M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a))

goal (1 subgoal):
 1. (\<And>k1 a1 b1 k2 a2 b2. \<lbrakk>k1 \<noteq> 0 \<and> mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0 \<and> M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1); k2 \<noteq> 0 \<and> mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0 \<and> M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
k1 \<noteq> 0 \<and> mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0 \<and> M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1)
k2 \<noteq> 0 \<and> mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0 \<and> M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2)

goal (1 subgoal):
 1. unitary11_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
k1 \<noteq> 0 \<and> mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0 \<and> M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1)
k2 \<noteq> 0 \<and> mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0 \<and> M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2)
[PROOF STEP]
obtain k a b where "k \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a) \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
k1 \<noteq> 0 \<and> mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0 \<and> M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1)
k2 \<noteq> 0 \<and> mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0 \<and> M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2)

goal (1 subgoal):
 1. (\<And>k a b. k \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a) \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using unitary11_comp[of k1 M1 a1 b1 k2 M2 a2 b2]
[PROOF STATE]
proof (prove)
using this:
k1 \<noteq> 0 \<and> mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0 \<and> M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1)
k2 \<noteq> 0 \<and> mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0 \<and> M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2)
\<lbrakk>k1 \<noteq> 0; M1 = k1 *\<^sub>s\<^sub>m (a1, b1, cnj b1, cnj a1); mat_det (a1, b1, cnj b1, cnj a1) \<noteq> 0; k2 \<noteq> 0; M2 = k2 *\<^sub>s\<^sub>m (a2, b2, cnj b2, cnj a2); mat_det (a2, b2, cnj b2, cnj a2) \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>k a b. k \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a) \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0

goal (1 subgoal):
 1. (\<And>k a b. k \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a) \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
k \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a) \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0

goal (1 subgoal):
 1. unitary11_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a) \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0

goal (1 subgoal):
 1. unitary11_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
using unitary11_gen_iff[of "M1 *\<^sub>m\<^sub>m M2"]
[PROOF STATE]
proof (prove)
using this:
k \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a) \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0
unitary11_gen (M1 *\<^sub>m\<^sub>m M2) = (\<exists>k a b. k \<noteq> 0 \<and> mat_det (a, b, cnj b, cnj a) \<noteq> 0 \<and> M1 *\<^sub>m\<^sub>m M2 = k *\<^sub>s\<^sub>m (a, b, cnj b, cnj a))

goal (1 subgoal):
 1. unitary11_gen (M1 *\<^sub>m\<^sub>m M2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
unitary11_gen (M1 *\<^sub>m\<^sub>m M2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "!!a::int. [| a <= b; b+b <= c |] ==> a+a <= c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a. \<lbrakk>a \<le> b; b + b \<le> c\<rbrakk> \<Longrightarrow> a + a \<le> c
[PROOF STEP]
by arith


[STATEMENT]
lemma distinct7_def: "distinct [A,B,C,D,E,F,G] = ((A \<noteq> B) \<and> (A \<noteq> C) \<and> (A \<noteq> D) \<and> (A \<noteq> E) \<and> (A \<noteq> F) \<and> (A \<noteq> G) \<and>
(B \<noteq> C) \<and> (B \<noteq> D) \<and> (B \<noteq> E) \<and> (B \<noteq> F) \<and> (B \<noteq> G) \<and>
(C \<noteq> D) \<and> (C \<noteq> E) \<and> (C \<noteq> F) \<and> (C \<noteq> G) \<and>
(D \<noteq> E) \<and> (D \<noteq> F) \<and> (D \<noteq> G) \<and>
(E \<noteq> F) \<and> (E \<noteq> G) \<and>
(F \<noteq> G))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distinct [A, B, C, D, E, F, G] = (A \<noteq> B \<and> A \<noteq> C \<and> A \<noteq> D \<and> A \<noteq> E \<and> A \<noteq> F \<and> A \<noteq> G \<and> B \<noteq> C \<and> B \<noteq> D \<and> B \<noteq> E \<and> B \<noteq> F \<and> B \<noteq> G \<and> C \<noteq> D \<and> C \<noteq> E \<and> C \<noteq> F \<and> C \<noteq> G \<and> D \<noteq> E \<and> D \<noteq> F \<and> D \<noteq> G \<and> E \<noteq> F \<and> E \<noteq> G \<and> F \<noteq> G)
[PROOF STEP]
by auto


[STATEMENT]
lemma "3.2 \<le> (x::real) \<and> x \<le> 6.2 \<Longrightarrow> sin x \<le> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 32 / 10 \<le> x \<and> x \<le> 62 / 10 \<Longrightarrow> sin x \<le> 0
[PROOF STEP]
by (approximation 10)


[STATEMENT]
lemma set_mset_minus_replicate_mset[simp]:
  "n \<ge> count A a \<Longrightarrow> set_mset (A - replicate_mset n a) = set_mset A - {a}"
  "n < count A a \<Longrightarrow> set_mset (A - replicate_mset n a) = set_mset A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (count A a \<le> n \<Longrightarrow> set_mset (A - replicate_mset n a) = set_mset A - {a}) &&& (n < count A a \<Longrightarrow> set_mset (A - replicate_mset n a) = set_mset A)
[PROOF STEP]
unfolding set_mset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (count A a \<le> n \<Longrightarrow> {x. 0 < count (A - replicate_mset n a) x} = {x. 0 < count A x} - {a}) &&& (n < count A a \<Longrightarrow> {x. 0 < count (A - replicate_mset n a) x} = {x. 0 < count A x})
[PROOF STEP]
by (auto split: if_split simp: not_in_iff)


[STATEMENT]
lemma (in Ring) bilinear_l_add:"\<lbrakk>R module M1; R module M2; R module N;
       m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2;
       bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow>
       f (m11 \<plusminus>\<^bsub>M1\<^esub> m12, m2) = f (m11, m2) \<plusminus>\<^bsub>N\<^esub> (f (m12, m2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M1; R module M2; R module N; m11 \<in> carrier M1; m12 \<in> carrier M1; m2 \<in> carrier M2; bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow> f (m11 \<plusminus>\<^bsub>M1\<^esub> m12, m2) = f (m11, m2) \<plusminus>\<^bsub>N\<^esub> f (m12, m2)
[PROOF STEP]
apply (simp add:bilinear_map_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma primepow_mult_aprimedivisorI:
  assumes "primepow (n :: 'a :: factorial_semiring_multiplicative)"
  shows   "primepow (aprimedivisor n * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primepow (aprimedivisor n * n)
[PROOF STEP]
by (subst (2) primepow_decompose[OF assms, symmetric], subst power_Suc [symmetric],
      subst primepow_prime_power)
     (insert assms, auto intro!: prime_aprimedivisor' dest: primepow_gt_Suc_0)


[STATEMENT]
lemma const_in_iff: "c \<noteq> 0 \<Longrightarrow> (\<lambda>_. c) \<in> L F (f) \<longleftrightarrow> (\<lambda>_. 1) \<in> L F (f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> ((\<lambda>_. c) \<in> L F f) = ((\<lambda>_. 1::'b) \<in> L F f)
[PROOF STEP]
using cmult_in_iff'[of c "\<lambda>_. 1"]
[PROOF STATE]
proof (prove)
using this:
c \<noteq> (0::'b) \<Longrightarrow> ((\<lambda>x. (1::'b) * c) \<in> L ?F ?g) = ((\<lambda>_. 1::'b) \<in> L ?F ?g)

goal (1 subgoal):
 1. c \<noteq> (0::'b) \<Longrightarrow> ((\<lambda>_. c) \<in> L F f) = ((\<lambda>_. 1::'b) \<in> L F f)
[PROOF STEP]
by simp


[STATEMENT]
lemma negligible_iff_measure0: "S \<in> lmeasurable \<Longrightarrow> (negligible S \<longleftrightarrow> measure lebesgue S = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<in> lmeasurable \<Longrightarrow> negligible S = (Sigma_Algebra.measure lebesgue S = 0)
[PROOF STEP]
by (metis (full_types) completion.null_sets_outer negligible_iff_null_sets negligible_imp_measure0 order_refl)


[STATEMENT]
lemma Qp_nonzero_int_pow:
  assumes "x \<in> carrier Q\<^sub>p"
  assumes "n > 0"
  assumes "x[^](n::int) \<in> nonzero Q\<^sub>p"
  shows "x \<in> nonzero Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p
[PROOF STEP]
using Frac_nonzero_int_pow Q\<^sub>p_def assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier (Frac Z\<^sub>p); 0 < ?n; ?x [^]\<^bsub>Frac Z\<^sub>p\<^esub> ?n \<in> nonzero (Frac Z\<^sub>p)\<rbrakk> \<Longrightarrow> ?x \<in> nonzero (Frac Z\<^sub>p)
Q\<^sub>p \<equiv> Frac Z\<^sub>p
x \<in> carrier Q\<^sub>p
0 < n
x [^] n \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. x \<in> nonzero Q\<^sub>p
[PROOF STEP]
by auto


[STATEMENT]
lemma evaluate_net_Conv_copy_first:
assumes "valid_net' m"
and "input_sizes m = map dim_vec input"
and "j<nr"
and "output_size' m > 0"
shows "evaluate_net (Conv (copy_first_matrix nr (output_size' m)) m) input $ j
 = evaluate_net m input $ 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. evaluate_net (Conv (copy_first_matrix nr (output_size' m)) m) input $ j = evaluate_net m input $ 0
[PROOF STEP]
unfolding evaluate_net.simps output_size_correct[OF assms(1) assms(2)[symmetric]]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ j = evaluate_net m input $ 0
[PROOF STEP]
using mult_copy_first_matrix[OF \<open>j<nr\<close>, of "evaluate_net m input", unfolded dim_vec_of_list]
  assms(3) copy_first_matrix_dim(1)
[PROOF STATE]
proof (prove)
using this:
0 < dim_vec (evaluate_net m input) \<Longrightarrow> (copy_first_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ j = evaluate_net m input $ 0
j < nr
dim_row (copy_first_matrix ?nr ?nc) = ?nr

goal (1 subgoal):
 1. (copy_first_matrix nr (dim_vec (evaluate_net m input)) *\<^sub>v evaluate_net m input) $ j = evaluate_net m input $ 0
[PROOF STEP]
by (metis \<open>output_size' m = dim_vec (evaluate_net m input)\<close> assms(4))


[STATEMENT]
lemma finite_lattice_complete_Sup_empty: "Sup {} = (bot :: 'a::finite_lattice_complete)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sup {} = bot
[PROOF STEP]
by (simp add: Sup_def)


[STATEMENT]
lemma from_hma\<^sub>v_diff: "from_hma\<^sub>v v - from_hma\<^sub>v w = from_hma\<^sub>v (v - w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. from_hma\<^sub>v v - from_hma\<^sub>v w = from_hma\<^sub>v (v - w)
[PROOF STEP]
unfolding from_hma\<^sub>v_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.vec CARD('b) (\<lambda>i. v $h Bij_Nat.from_nat i) - Matrix.vec CARD('b) (\<lambda>i. w $h Bij_Nat.from_nat i) = Matrix.vec CARD('b) (\<lambda>i. (v - w) $h Bij_Nat.from_nat i)
[PROOF STEP]
by auto


[STATEMENT]
theorem Theorem2_final':
  shows A_eq_B: "OFCLASS('a::comm_ring_1, bezout_ring_class) \<equiv> (\<And>A::'a mat. admits_SNF_JNF A)"
  and A_eq_C: "OFCLASS('a::comm_ring_1, bezout_ring_class) \<equiv>
      (\<And>(A::'a mat). A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)"
  and B_eq_C: "(\<forall>(A::'a::comm_ring_1 mat). admits_SNF_JNF A) =
      (\<forall>(A::'a mat) \<in> carrier_mat 2 2. admits_SNF_JNF A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. admits_SNF_JNF A)) &&& (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)) &&& (\<forall>A. admits_SNF_JNF A) = (\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A)
[PROOF STEP]
using diagonal_admits_SNF_iff_bezout_ring'
[PROOF STATE]
proof (prove)
using this:
OFCLASS(?'a, bezout_ring_class) \<equiv> (\<And>A. admits_SNF_JNF A)

goal (1 subgoal):
 1. (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. admits_SNF_JNF A)) &&& (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)) &&& (\<forall>A. admits_SNF_JNF A) = (\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A)
[PROOF STEP]
using diagonal_2x2_admits_SNF_iff_bezout_ring
[PROOF STATE]
proof (prove)
using this:
OFCLASS(?'a, bezout_ring_class) \<equiv> (\<And>A. admits_SNF_JNF A)
OFCLASS(?'a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)

goal (1 subgoal):
 1. (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. admits_SNF_JNF A)) &&& (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)) &&& (\<forall>A. admits_SNF_JNF A) = (\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A)
[PROOF STEP]
using diagonal_2x2_admits_SNF_iff_diagonal_admits_SNF
[PROOF STATE]
proof (prove)
using this:
OFCLASS(?'a, bezout_ring_class) \<equiv> (\<And>A. admits_SNF_JNF A)
OFCLASS(?'a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)
(\<forall>A. admits_SNF_JNF A) = (\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A)

goal (1 subgoal):
 1. (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. admits_SNF_JNF A)) &&& (OFCLASS('a, bezout_ring_class) \<equiv> (\<And>A. A \<in> carrier_mat 2 2 \<longrightarrow> admits_SNF_JNF A)) &&& (\<forall>A. admits_SNF_JNF A) = (\<forall>A\<in>carrier_mat 2 2. admits_SNF_JNF A)
[PROOF STEP]
by auto