[STATEMENT]
lemma ndiff_Sucs[simp]:
  "ndiff (Suc i) f X \<longleftrightarrow>
    (ndiff i f X) \<and>
    (\<forall>x \<in> X. (nderiv i f X) differentiable (at x within X))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ndiff (Suc i) f X = (ndiff i f X \<and> (\<forall>x\<in>X. nderiv i f X differentiable at x within X))
[PROOF STEP]
apply (auto simp: ndiff_def )
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>ia x. \<lbrakk>\<forall>ia<i. \<forall>x\<in>X. nderiv ia f X differentiable at x within X; \<forall>x\<in>X. nderiv i f X differentiable at x within X; ia < Suc i; x \<in> X\<rbrakk> \<Longrightarrow> nderiv ia f X differentiable at x within X
[PROOF STEP]
using less_antisym
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> ?n < ?m; ?n < Suc ?m\<rbrakk> \<Longrightarrow> ?m = ?n

goal (1 subgoal):
 1. \<And>ia x. \<lbrakk>\<forall>ia<i. \<forall>x\<in>X. nderiv ia f X differentiable at x within X; \<forall>x\<in>X. nderiv i f X differentiable at x within X; ia < Suc i; x \<in> X\<rbrakk> \<Longrightarrow> nderiv ia f X differentiable at x within X
[PROOF STEP]
by blast


[STATEMENT]
lemma eventually_at_top_compose:
  assumes "\<And>c. eventually (\<lambda>x. (f x:: 'a :: linorder) \<ge> c) F" "eventually P at_top"
  shows   "eventually (\<lambda>x. P (f x)) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. P (f x)
[PROOF STEP]
using assms filterlim_at_top filterlim_iff
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in F. ?c \<le> f x
eventually P at_top
filterlim ?f at_top ?F = (\<forall>Z. \<forall>\<^sub>F x in ?F. Z \<le> ?f x)
filterlim ?f ?F2.0 ?F1.0 = (\<forall>P. eventually P ?F2.0 \<longrightarrow> (\<forall>\<^sub>F x in ?F1.0. P (?f x)))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in F. P (f x)
[PROOF STEP]
by blast


[STATEMENT]
lemma NatMultiples_product_multiple_factor: "
  \<lbrakk> a \<in> NatMultiples F; b \<in> F \<rbrakk> \<Longrightarrow> a * b \<in> NatMultiples F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> NatMultiples F; b \<in> F\<rbrakk> \<Longrightarrow> a * b \<in> NatMultiples F
[PROOF STEP]
by (simp add: mult.commute[of a] NatMultiples_Product)


[STATEMENT]
lemma TC_INDUCT:
  fixes R :: "'a \<Rightarrow> 'a \<Rightarrow> bool" and P
  assumes "(\<forall>x y. R x y \<longrightarrow> P x y)" "(\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z)"
  shows "\<forall>u v. (TC R) u v \<longrightarrow> P u v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u v. TC R u v \<longrightarrow> P u v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. R x y \<longrightarrow> P x y
\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z

goal (1 subgoal):
 1. \<forall>u v. TC R u v \<longrightarrow> P u v
[PROOF STEP]
unfolding TC_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. R x y \<longrightarrow> P x y
\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z

goal (1 subgoal):
 1. \<forall>u v. (\<forall>P. (\<forall>x y. R x y \<longrightarrow> P x y) \<and> (\<forall>x y z. P x y \<and> P y z \<longrightarrow> P x z) \<longrightarrow> P u v) \<longrightarrow> P u v
[PROOF STEP]
by metis


[STATEMENT]
lemma tagged_division_of:
  "s tagged_division_of i \<longleftrightarrow>
    finite s \<and>
    (\<forall>x K. (x, K) \<in> s \<longrightarrow> x \<in> K \<and> K \<subseteq> i \<and> (\<exists>a b. K = cbox a b)) \<and>
    (\<forall>x1 K1 x2 K2. (x1, K1) \<in> s \<and> (x2, K2) \<in> s \<and> (x1, K1) \<noteq> (x2, K2) \<longrightarrow>
      interior K1 \<inter> interior K2 = {}) \<and>
    (\<Union>{K. \<exists>x. (x,K) \<in> s} = i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (s tagged_division_of i) = (finite s \<and> (\<forall>x K. (x, K) \<in> s \<longrightarrow> x \<in> K \<and> K \<subseteq> i \<and> (\<exists>a b. K = cbox a b)) \<and> (\<forall>x1 K1 x2 K2. (x1, K1) \<in> s \<and> (x2, K2) \<in> s \<and> (x1, K1) \<noteq> (x2, K2) \<longrightarrow> interior K1 \<inter> interior K2 = {}) \<and> \<Union> {K. \<exists>x. (x, K) \<in> s} = i)
[PROOF STEP]
unfolding tagged_division_of_def tagged_partial_division_of_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((finite s \<and> (\<forall>x K. (x, K) \<in> s \<longrightarrow> x \<in> K \<and> K \<subseteq> i \<and> (\<exists>a b. K = cbox a b)) \<and> (\<forall>x1 K1 x2 K2. (x1, K1) \<in> s \<and> (x2, K2) \<in> s \<and> (x1, K1) \<noteq> (x2, K2) \<longrightarrow> interior K1 \<inter> interior K2 = {})) \<and> \<Union> {K. \<exists>x. (x, K) \<in> s} = i) = (finite s \<and> (\<forall>x K. (x, K) \<in> s \<longrightarrow> x \<in> K \<and> K \<subseteq> i \<and> (\<exists>a b. K = cbox a b)) \<and> (\<forall>x1 K1 x2 K2. (x1, K1) \<in> s \<and> (x2, K2) \<in> s \<and> (x1, K1) \<noteq> (x2, K2) \<longrightarrow> interior K1 \<inter> interior K2 = {}) \<and> \<Union> {K. \<exists>x. (x, K) \<in> s} = i)
[PROOF STEP]
by auto


[STATEMENT]
lemma sum_in: "(\<Sum>i=0..<(x::nat). f i * (y ::('a mod_ring))) = (\<Sum>i=0..<x. f i )* (y) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<x. f i * y) = sum f {0..<x} * y
[PROOF STEP]
by(induction x) (auto simp add: algebra_simps)


[STATEMENT]
lemma "lset (lextdown a xs) \<subseteq> {a} \<union> lset xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lset (lextdown a xs) \<subseteq> {a} \<union> lset xs
[PROOF STEP]
apply (rule tendsto_le_ccpo[where g="\<lambda>xs. lset (lextdown a xs)" and f="\<lambda>xs. {a} \<union> lset xs" and F="at' xs"])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. at' xs \<noteq> \<bottom>
 2. ((\<lambda>xs. {a} \<union> lset xs) \<longlongrightarrow> {a} \<union> lset xs) (at' xs)
 3. ((\<lambda>xs. lset (lextdown a xs)) \<longlongrightarrow> lset (lextdown a xs)) (at' xs)
 4. \<forall>\<^sub>F x in at' xs. lset (lextdown a x) \<subseteq> {a} \<union> lset x
[PROOF STEP]
apply (rule tendsto_intros at'_bot tendsto_lup eventually_at'_llistI tendsto_id_at')+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xsa. \<lbrakk>lfinite xsa; xsa \<le> xs\<rbrakk> \<Longrightarrow> lset (lextdown a xsa) \<subseteq> {a} \<union> lset xsa
[PROOF STEP]
apply (auto dest!: lprefix_lsetD set_ext[THEN subsetD])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma homeomorphic_AR_iff_AR:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  shows "S homeomorphic T \<Longrightarrow> AR S \<longleftrightarrow> AR T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T \<Longrightarrow> AR S = AR T
[PROOF STEP]
by (metis AR_homeomorphic_AR homeomorphic_sym)


[STATEMENT]
lemma HUnion_hunion [simp]: "\<Squnion>(A \<squnion> B) =  \<Squnion>A \<squnion> \<Squnion>B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion>(A \<squnion> B) = \<Squnion>A \<squnion> \<Squnion>B
[PROOF STEP]
by blast


[STATEMENT]
lemma at_top_within_at_top_unbounded_right:
  fixes a::"'a::linorder"
  shows "at_top_within {a..} = at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. at_top_within {a..} = at_top
[PROOF STEP]
unfolding at_top_within_def at_top_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (INF k\<in>{a..}. principal ({k..} \<inter> {a..})) = (INF k. principal {k..})
[PROOF STEP]
apply (auto intro!: INF_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. \<exists>x\<in>{a..}. j \<le> x
[PROOF STEP]
by (metis linorder_class.linear linorder_class.max.cobounded1 linorder_class.max.idem ord_class.atLeast_iff)


[STATEMENT]
lemma (in Ring) ideal_pow_ideal:"ideal R I \<Longrightarrow> ideal R (I \<^bsup>\<diamondsuit>R n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal R I \<Longrightarrow> ideal R (I \<^bsup>\<diamondsuit>R n\<^esup>)
[PROOF STEP]
apply (induct_tac n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. ideal R I \<Longrightarrow> ideal R (I \<^bsup>\<diamondsuit>R 0\<^esup>)
 2. \<And>n. \<lbrakk>ideal R I; ideal R (I \<^bsup>\<diamondsuit>R n\<^esup>)\<rbrakk> \<Longrightarrow> ideal R (I \<^bsup>\<diamondsuit>R Suc n\<^esup>)
[PROOF STEP]
apply (simp add:whole_ideal)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R I; ideal R (I \<^bsup>\<diamondsuit>R n\<^esup>)\<rbrakk> \<Longrightarrow> ideal R (I \<^bsup>\<diamondsuit>R Suc n\<^esup>)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>ideal R I; ideal R (I \<^bsup>\<diamondsuit>R n\<^esup>)\<rbrakk> \<Longrightarrow> ideal R (I \<diamondsuit>\<^sub>r I \<^bsup>\<diamondsuit>R n\<^esup>)
[PROOF STEP]
apply (simp add:ideal_prod_ideal)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lucas_lehmer_add_cong:
  "[fst (lucas_lehmer_add m x y) = fst x + fst y] (mod m)"
  "[snd (lucas_lehmer_add m x y) = snd x + snd y] (mod m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [fst (lucas_lehmer_add m x y) = fst x + fst y] (mod m) &&& [snd (lucas_lehmer_add m x y) = snd x + snd y] (mod m)
[PROOF STEP]
by (simp_all add: lucas_lehmer_add_def cong_def case_prod_unfold)


[STATEMENT]
lemma nn_integral_measure_pmf: "(\<integral>\<^sup>+ x. f x \<partial>measure_pmf p) = \<integral>\<^sup>+ x. ennreal (pmf p x) * f x \<partial>count_space UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integral\<^sup>N (measure_pmf p) f = \<integral>\<^sup>+ x. ennreal (pmf p x) * f x \<partial>count_space UNIV
[PROOF STEP]
by(simp add: measure_pmf_eq_density nn_integral_density pmf_nonneg)


[STATEMENT]
lemma magQ_qdivivide [si_eq]: "\<lbrakk>(x::('a::field)[_,_]) \<^bold>/ y\<rbrakk>\<^sub>Q = \<lbrakk>x\<rbrakk>\<^sub>Q / \<lbrakk>y\<rbrakk>\<^sub>Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<^bold>\<cdot> y\<^sup>-\<^sup>\<one>\<rbrakk>\<^sub>Q = \<lbrakk>x\<rbrakk>\<^sub>Q / \<lbrakk>y\<rbrakk>\<^sub>Q
[PROOF STEP]
by (simp add: magQ_def, transfer, simp add: field_class.field_divide_inverse)


[STATEMENT]
lemma hyperdual_comb_sel [simp]:
  fixes a b c d :: "'a :: ring_1"
  shows "Base (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = a"
    and "Eps1 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = b"
    and "Eps2 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = c"
    and "Eps12 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Base (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = a &&& Eps1 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = b) &&& Eps2 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = c &&& Eps12 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = d
[PROOF STEP]
using Hyperdual_eq hyperdual.sel
[PROOF STATE]
proof (prove)
using this:
Hyperdual ?a ?b ?c ?d = ?a *\<^sub>H ba + ?b *\<^sub>H e1 + ?c *\<^sub>H e2 + ?d *\<^sub>H e12
Base (Hyperdual ?x1.0 ?x2.0 ?x3.0 ?x4.0) = ?x1.0
Eps1 (Hyperdual ?x1.0 ?x2.0 ?x3.0 ?x4.0) = ?x2.0
Eps2 (Hyperdual ?x1.0 ?x2.0 ?x3.0 ?x4.0) = ?x3.0
Eps12 (Hyperdual ?x1.0 ?x2.0 ?x3.0 ?x4.0) = ?x4.0

goal (1 subgoal):
 1. (Base (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = a &&& Eps1 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = b) &&& Eps2 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = c &&& Eps12 (a *\<^sub>H ba + b *\<^sub>H e1 + c *\<^sub>H e2 + d *\<^sub>H e12) = d
[PROOF STEP]
by metis+


[STATEMENT]
lemma cdf_interval_measure:
  "(\<And> x y. x \<le> y \<Longrightarrow> F x \<le> F y) \<Longrightarrow> (\<And>a. continuous (at_right a) F) \<Longrightarrow> (F \<longlongrightarrow> 0) at_bot \<Longrightarrow> cdf (interval_measure F) = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. x \<le> y \<Longrightarrow> F x \<le> F y; \<And>a. continuous (at_right a) F; (F \<longlongrightarrow> 0) at_bot\<rbrakk> \<Longrightarrow> cdf (interval_measure F) = F
[PROOF STEP]
by (simp add: cdf_def fun_eq_iff measure_interval_measure_Iic)


[STATEMENT]
lemma exponent_1: "exponent 1 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exponent 1 = 0
[PROOF STEP]
using exponent_float[of 1 0]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> is_unit 2; 1 \<noteq> 0\<rbrakk> \<Longrightarrow> exponent (float_of (real_of_int 1 * 2 powr real_of_int 0)) = 0

goal (1 subgoal):
 1. exponent 1 = 0
[PROOF STEP]
by (simp add: one_float_def)


[STATEMENT]
lemma rank_le_ncols:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  shows "rank A \<le> ncols A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank A \<le> ncols A
[PROOF STEP]
unfolding rank_def row_rank_def ncols_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (row_space A) \<le> CARD('n)
[PROOF STEP]
by (metis top_greatest vec.dim_subset vec_dim_card)


[STATEMENT]
theorem conjunction_in: "valid_in U (Con' p q) \<longleftrightarrow> valid_in U p \<and> valid_in U q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_in U (Con' p q) = (valid_in U p \<and> valid_in U q)
[PROOF STEP]
unfolding valid_in_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>i. range i \<subseteq> domain U \<longrightarrow> eval i (Con' p q) = Det True) = ((\<forall>i. range i \<subseteq> domain U \<longrightarrow> eval i p = Det True) \<and> (\<forall>i. range i \<subseteq> domain U \<longrightarrow> eval i q = Det True))
[PROOF STEP]
by auto


[STATEMENT]
lemma rdvd_left_0_eq: "(0 rdvd t) = (t=0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 rdvd t) = (t = 0)
[PROOF STEP]
by (auto simp add: rdvd_def)


[STATEMENT]
lemma flatten_superset:
  assumes "finite A" and "keys p \<subseteq> A"
  shows "flatten p = (\<Sum>t\<in>A. punit.monom_mult 1 t (lookup p t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. flatten p = (\<Sum>t\<in>A. punit.monom_mult (1::'b) t (lookup p t))
[PROOF STEP]
unfolding flatten_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>t\<in>keys p. punit.monom_mult (1::'b) t (lookup p t)) = (\<Sum>t\<in>A. punit.monom_mult (1::'b) t (lookup p t))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
keys p \<subseteq> A

goal (1 subgoal):
 1. (\<Sum>t\<in>keys p. punit.monom_mult (1::'b) t (lookup p t)) = (\<Sum>t\<in>A. punit.monom_mult (1::'b) t (lookup p t))
[PROOF STEP]
by (rule sum.mono_neutral_left) (simp add: in_keys_iff)


[STATEMENT]
lemma continuous_at_within_power_int[continuous_intros]:
  fixes f :: "'a::t2_space \<Rightarrow> 'b::real_normed_div_algebra"
  assumes "continuous (at a within s) f"
    and "f a \<noteq> 0"
  shows "continuous (at a within s) (\<lambda>x. power_int (f x) n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous (at a within s) (\<lambda>x. f x powi n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous (at a within s) f
f a \<noteq> (0::'b)

goal (1 subgoal):
 1. continuous (at a within s) (\<lambda>x. f x powi n)
[PROOF STEP]
unfolding continuous_within
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> f a) (at a within s)
f a \<noteq> (0::'b)

goal (1 subgoal):
 1. ((\<lambda>x. f x powi n) \<longlongrightarrow> f a powi n) (at a within s)
[PROOF STEP]
by (rule tendsto_power_int)


[STATEMENT]
lemma equiv_trans: "x \<approx> y \<Longrightarrow> y \<approx> z \<Longrightarrow> x \<approx> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<approx> y; y \<approx> z\<rbrakk> \<Longrightarrow> x \<approx> z
[PROOF STEP]
by (auto simp: equiv_def intro: order_trans)


[STATEMENT]
lemma pell_valuation_neg_pos:
  assumes "x < 0" "y > 0" "solution (x, y)"
  shows   "pell_valuation (x, y) \<in> {-1<..<0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pell_valuation (x, y) \<in> {- 1<..<0}
[PROOF STEP]
using pell_valuation_pos_neg[of "-x" "-y"] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < - x; - y < 0; solution (- x, - y)\<rbrakk> \<Longrightarrow> pell_valuation (- x, - y) \<in> {0<..<1}
x < 0
0 < y
solution (x, y)

goal (1 subgoal):
 1. pell_valuation (x, y) \<in> {- 1<..<0}
[PROOF STEP]
by simp


[STATEMENT]
lemma closed_map_fst:
  fixes S :: "'a::euclidean_space set" and T :: "'b::euclidean_space set"
  assumes "compact T" "closedin (top_of_set (S \<times> T)) c"
   shows "closedin (top_of_set S) (fst ` c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set S) (fst ` c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closedin (top_of_set S) (fst ` c)
[PROOF STEP]
have *: "fst ` (S \<times> T) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst ` (S \<times> T) \<subseteq> S
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
fst ` (S \<times> T) \<subseteq> S

goal (1 subgoal):
 1. closedin (top_of_set S) (fst ` c)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closedin (top_of_set S) (fst ` c)
[PROOF STEP]
using proper_map [OF _ _ *]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>closedin (top_of_set (S \<times> T)) ?K; \<And>U. \<lbrakk>U \<subseteq> S; compact U\<rbrakk> \<Longrightarrow> compact (S \<times> T \<inter> fst -` U)\<rbrakk> \<Longrightarrow> closedin (top_of_set S) (fst ` ?K)

goal (1 subgoal):
 1. closedin (top_of_set S) (fst ` c)
[PROOF STEP]
by (simp add: proper_map_fst assms)
[PROOF STATE]
proof (state)
this:
closedin (top_of_set S) (fst ` c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma contractible_space_product_topology:
  "contractible_space(product_topology X I) \<longleftrightarrow>
    topspace (product_topology X I) = {} \<or> (\<forall>i \<in> I. contractible_space(X i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
proof (cases "topspace (product_topology X I) = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. topspace (product_topology X I) = {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
 2. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
topspace (product_topology X I) \<noteq> {}

goal (2 subgoals):
 1. topspace (product_topology X I) = {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
 2. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
have 1: "contractible_space (X i)"
    if XI: "contractible_space (product_topology X I)" and "i \<in> I"
    for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space (X i)
[PROOF STEP]
proof (rule contractible_space_retraction_map_image [OF _ XI])
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) ?f
[PROOF STEP]
show "retraction_map (product_topology X I) (X i) (\<lambda>x. x i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
topspace (product_topology X I) \<noteq> {}

goal (1 subgoal):
 1. retraction_map (product_topology X I) (X i) (\<lambda>x. x i)
[PROOF STEP]
by (simp add: retraction_map_product_projection \<open>i \<in> I\<close>)
[PROOF STATE]
proof (state)
this:
retraction_map (product_topology X I) (X i) (\<lambda>x. x i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>contractible_space (product_topology X I); ?i \<in> I\<rbrakk> \<Longrightarrow> contractible_space (X ?i)

goal (2 subgoals):
 1. topspace (product_topology X I) = {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
 2. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
have 2: "contractible_space (product_topology X I)"
    if "x \<in> topspace (product_topology X I)" and cs: "\<forall>i\<in>I. contractible_space (X i)"
    for x :: "'a \<Rightarrow> 'b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space (product_topology X I)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. contractible_space (product_topology X I)
[PROOF STEP]
obtain f where f: "\<And>i. i\<in>I \<Longrightarrow> homotopic_with (\<lambda>x. True) (X i) (X i) id (\<lambda>x. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. (\<And>i. i \<in> I \<Longrightarrow> homotopic_with (\<lambda>x. True) (X i) (X i) id (\<lambda>x. f i)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using cs
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>I. contractible_space (X i)

goal (1 subgoal):
 1. (\<And>f. (\<And>i. i \<in> I \<Longrightarrow> homotopic_with (\<lambda>x. True) (X i) (X i) id (\<lambda>x. f i)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding contractible_space_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i\<in>I. \<exists>a. homotopic_with (\<lambda>x. True) (X i) (X i) id (\<lambda>x. a)

goal (1 subgoal):
 1. (\<And>f. (\<And>i. i \<in> I \<Longrightarrow> homotopic_with (\<lambda>x. True) (X i) (X i) id (\<lambda>x. f i)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
?i \<in> I \<Longrightarrow> homotopic_with (\<lambda>x. True) (X ?i) (X ?i) id (\<lambda>x. f ?i)

goal (1 subgoal):
 1. contractible_space (product_topology X I)
[PROOF STEP]
have "homotopic_with (\<lambda>x. True)
                         (product_topology X I) (product_topology X I) id (\<lambda>x. restrict f I)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homotopic_with (\<lambda>x. True) (product_topology X I) (product_topology X I) id (\<lambda>x. restrict f I)
[PROOF STEP]
by (rule homotopic_with_eq [OF homotopic_with_product_topology [OF f]]) (auto)
[PROOF STATE]
proof (state)
this:
homotopic_with (\<lambda>x. True) (product_topology X I) (product_topology X I) id (\<lambda>x. restrict f I)

goal (1 subgoal):
 1. contractible_space (product_topology X I)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
homotopic_with (\<lambda>x. True) (product_topology X I) (product_topology X I) id (\<lambda>x. restrict f I)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
homotopic_with (\<lambda>x. True) (product_topology X I) (product_topology X I) id (\<lambda>x. restrict f I)

goal (1 subgoal):
 1. contractible_space (product_topology X I)
[PROOF STEP]
by (auto simp: contractible_space_def)
[PROOF STATE]
proof (state)
this:
contractible_space (product_topology X I)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?x \<in> topspace (product_topology X I); \<forall>i\<in>I. contractible_space (X i)\<rbrakk> \<Longrightarrow> contractible_space (product_topology X I)

goal (2 subgoals):
 1. topspace (product_topology X I) = {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
 2. topspace (product_topology X I) \<noteq> {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
using False 1 2
[PROOF STATE]
proof (prove)
using this:
topspace (product_topology X I) \<noteq> {}
\<lbrakk>contractible_space (product_topology X I); ?i \<in> I\<rbrakk> \<Longrightarrow> contractible_space (X ?i)
\<lbrakk>?x \<in> topspace (product_topology X I); \<forall>i\<in>I. contractible_space (X i)\<rbrakk> \<Longrightarrow> contractible_space (product_topology X I)

goal (1 subgoal):
 1. contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))

goal (1 subgoal):
 1. topspace (product_topology X I) = {} \<Longrightarrow> contractible_space (product_topology X I) = (topspace (product_topology X I) = {} \<or> (\<forall>i\<in>I. contractible_space (X i)))
[PROOF STEP]
qed (simp add: contractible_space_empty)


[STATEMENT]
lemma card_older_seniors_monotonic:
  "x \<le> n \<Longrightarrow> card (older_seniors x n) \<ge> card (older_seniors x (n + m))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<le> n \<Longrightarrow> card (older_seniors x (n + m)) \<le> card (older_seniors x n)
[PROOF STEP]
using older_seniors_monotonic older_seniors_card_mono
[PROOF STATE]
proof (prove)
using this:
?x \<le> ?n \<Longrightarrow> older_seniors ?x (?n + ?m) \<subseteq> older_seniors ?x ?n
?A \<subseteq> older_seniors ?x ?n \<Longrightarrow> card ?A \<le> card (older_seniors ?x ?n)

goal (1 subgoal):
 1. x \<le> n \<Longrightarrow> card (older_seniors x (n + m)) \<le> card (older_seniors x n)
[PROOF STEP]
by meson


[STATEMENT]
lemma one_less_ceiling [simp]: "1 < \<lceil>x\<rceil> \<longleftrightarrow> 1 < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1 < \<lceil>x\<rceil>) = ((1::'a) < x)
[PROOF STEP]
by (simp add: less_ceiling_iff)


[STATEMENT]
lemma of_nat_mono_maybe':
  fixes Y :: "nat"
  assumes xlt: "x < 2 ^ len_of TYPE ('a)"
  assumes ylt: "y < 2 ^ len_of TYPE ('a)"
  shows   "(y < x) = (of_nat y < (of_nat x :: 'a :: len word))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y < x) = (word_of_nat y < word_of_nat x)
[PROOF STEP]
apply (subst word_less_nat_alt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y < x) = (unat (word_of_nat y) < unat (word_of_nat x))
[PROOF STEP]
apply (subst unat_of_nat)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y < x) = (y mod 2 ^ LENGTH('a) < x mod 2 ^ LENGTH('a))
[PROOF STEP]
apply (subst mod_less)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. y < 2 ^ LENGTH('a)
 2. (y < x) = (y < x mod 2 ^ LENGTH('a))
[PROOF STEP]
apply (rule ylt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y < x) = (y < x mod 2 ^ LENGTH('a))
[PROOF STEP]
apply (subst mod_less)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. x < 2 ^ LENGTH('a)
 2. (y < x) = (y < x)
[PROOF STEP]
apply (rule xlt)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (y < x) = (y < x)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eexp_suminf:
  assumes wf_f: "\<not> {-\<infinity>, \<infinity>} \<subseteq> range f" and f: "summable f"
  shows "(\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
have "(\<lambda>n. eexp (\<Sum>i<n. f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. eexp (sum f {..<n})) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
by (intro tendsto_eexp summable_LIMSEQ f)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. eexp (sum f {..<n})) \<longlonglongrightarrow> eexp (\<Sum>i. f i)

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. eexp (sum f {..<n})) \<longlonglongrightarrow> eexp (\<Sum>i. f i)

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
have "(\<lambda>n. eexp (\<Sum>i<n. f i)) = (\<lambda>n. \<Prod>i<n. eexp (f i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. eexp (sum f {..<n})) = (\<lambda>n. \<Prod>i<n. eexp (f i))
[PROOF STEP]
using wf_f
[PROOF STATE]
proof (prove)
using this:
\<not> {- \<infinity>, \<infinity>} \<subseteq> range f

goal (1 subgoal):
 1. (\<lambda>n. eexp (sum f {..<n})) = (\<lambda>n. \<Prod>i<n. eexp (f i))
[PROOF STEP]
by (auto simp: fun_eq_iff image_iff eq_commute intro!: eexp_sum)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. eexp (sum f {..<n})) = (\<lambda>n. \<Prod>i<n. eexp (f i))

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)

goal (1 subgoal):
 1. (\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Prod>i<n. eexp (f i)) \<longlonglongrightarrow> eexp (\<Sum>i. f i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma powrat_add:
  assumes "0 < x"
  shows "x pow\<^sub>\<rat> (r + s) = (x pow\<^sub>\<rat> r) * (x pow\<^sub>\<rat> s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
proof (cases "(r > 0 \<or> r \<le> 0) \<and> (s > 0 \<or> s \<le> 0)")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0) \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. \<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)) \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
(0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)

goal (2 subgoals):
 1. (0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0) \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
 2. \<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)) \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)
0 < x

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
by (auto dest: powrat_add_pos powrat_add_neg powrat_add_neg_pos
           powrat_add_pos_neg simp add: le_less)
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s

goal (1 subgoal):
 1. \<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)) \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)) \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
\<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0))

goal (1 subgoal):
 1. \<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0)) \<Longrightarrow> x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> ((0 < r \<or> r \<le> 0) \<and> (0 < s \<or> s \<le> 0))

goal (1 subgoal):
 1. x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x pow\<^sub>\<rat> (r + s) = x pow\<^sub>\<rat> r * x pow\<^sub>\<rat> s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma gcd_diff2_nat: "n \<ge> m \<Longrightarrow> gcd (n - m) n = gcd m n"
  for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> gcd (n - m) n = gcd m n
[PROOF STEP]
by (metis gcd.commute gcd_add2 gcd_diff1_nat le_add_diff_inverse2)


[STATEMENT]
lemma card_verts_dv: "card (verts G) = Suc (card (verts (del_vert u)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (verts G) = Suc (card (verts (del_vert u)))
[PROOF STEP]
by (auto simp: verts_del_vert) (rule card.remove, auto simp: u_in)


[STATEMENT]
lemma catalan_1 [simp]: "catalan (Suc 0) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. catalan (Suc 0) = 1
[PROOF STEP]
by (simp add: catalan_Suc)


[STATEMENT]
lemma bij_betw_ord_of: "bij_betw ord_of {0..<n} (hfset (ord_of n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ord_of {0..<n} (hfset (ord_of n))
[PROOF STEP]
by (simp add: bij_betw_def inj_ord_of hfset_ord_of)


[STATEMENT]
lemma DirProd_group:
  assumes "group G" and "group H"
  shows "group (G \<times>\<times> H)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (G \<times>\<times> H)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Group.group (G \<times>\<times> H)
[PROOF STEP]
interpret G: group G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group G
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Group.group (G \<times>\<times> H)
[PROOF STEP]
interpret H: group H
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group H
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Group.group (G \<times>\<times> H)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Group.group (G \<times>\<times> H)
[PROOF STEP]
by (rule groupI)
     (auto intro: G.m_assoc H.m_assoc G.l_inv H.l_inv
           simp add: DirProd_def)
[PROOF STATE]
proof (state)
this:
Group.group (G \<times>\<times> H)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma complex_split_polar:
  obtains r a::real where "z = complex_of_real r * (cos a + \<i> * sin a)" "0 \<le> r" "0 \<le> a" "a < 2*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>r a. \<lbrakk>z = complex_of_real r * (complex_of_real (cos a) + \<i> * complex_of_real (sin a)); 0 \<le> r; 0 \<le> a; a < 2 * pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Arg2pi cis.ctr cis_conv_exp
[PROOF STATE]
proof (prove)
using this:
0 \<le> Arg2pi ?z \<and> Arg2pi ?z < 2 * pi \<and> is_Arg ?z (Arg2pi ?z)
cis ?a = Complex (cos ?a) (sin ?a)
cis ?b = exp (\<i> * complex_of_real ?b)

goal (1 subgoal):
 1. (\<And>r a. \<lbrakk>z = complex_of_real r * (complex_of_real (cos a) + \<i> * complex_of_real (sin a)); 0 \<le> r; 0 \<le> a; a < 2 * pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Complex_eq is_Arg_def
[PROOF STATE]
proof (prove)
using this:
0 \<le> Arg2pi ?z \<and> Arg2pi ?z < 2 * pi \<and> ?z = complex_of_real (cmod ?z) * exp (\<i> * complex_of_real (Arg2pi ?z))
cis ?a = complex_of_real (cos ?a) + \<i> * complex_of_real (sin ?a)
cis ?b = exp (\<i> * complex_of_real ?b)

goal (1 subgoal):
 1. (\<And>r a. \<lbrakk>z = complex_of_real r * (complex_of_real (cos a) + \<i> * complex_of_real (sin a)); 0 \<le> r; 0 \<le> a; a < 2 * pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce


[STATEMENT]
lemma xor_nat_rec:
  \<open>m XOR n = of_bool (odd m \<noteq> odd n) + 2 * ((m div 2) XOR (n div 2))\<close> for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m XOR n = of_bool (odd m \<noteq> odd n) + 2 * (m div 2 XOR n div 2)
[PROOF STEP]
by (simp add: xor_nat_def xor_int_rec [of \<open>int m\<close> \<open>int n\<close>] zdiv_int nat_add_distrib nat_mult_distrib)


[STATEMENT]
lemma inorder_node42: "height l > 0 \<Longrightarrow>
  inorder (tree\<^sub>d (node42 l a m b n c r)) = inorder l @ a # inorder (tree\<^sub>d m) @ b # inorder n @ c # inorder r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < height l \<Longrightarrow> inorder (tree\<^sub>d (node42 l a m b n c r)) = inorder l @ a # inorder (tree\<^sub>d m) @ b # inorder n @ c # inorder r
[PROOF STEP]
by(induct l a m b n c r rule: node42.induct) auto


[STATEMENT]
lemma pochhammer_rec_if: "pochhammer a n = (if n = 0 then 1 else a * pochhammer (a + 1) (n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pochhammer a n = (if n = 0 then 1::'a else a * pochhammer (a + (1::'a)) (n - 1))
[PROOF STEP]
by (cases n) (simp_all add: pochhammer_rec)


[STATEMENT]
lemma Suc_mask_eq_exp:
  \<open>Suc (mask n) = 2 ^ n\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (mask n) = 2 ^ n
[PROOF STEP]
by (simp add: mask_eq_exp_minus_1)


[STATEMENT]
lemma Lambert_W'_times_exp_self:
  assumes "x \<in> {-exp (-1)..<0}"
  shows   "Lambert_W' x * exp (Lambert_W' x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Lambert_W' x * exp (Lambert_W' x) = x
[PROOF STEP]
using theI'[OF Lambert_W'_ex1[OF assms]] assms
[PROOF STATE]
proof (prove)
using this:
(THE xa. xa \<le> - 1 \<and> xa * exp xa = x) \<le> - 1 \<and> (THE xa. xa \<le> - 1 \<and> xa * exp xa = x) * exp (THE xa. xa \<le> - 1 \<and> xa * exp xa = x) = x
x \<in> {- exp (- 1)..<0}

goal (1 subgoal):
 1. Lambert_W' x * exp (Lambert_W' x) = x
[PROOF STEP]
by (auto simp: Lambert_W'_def)


[STATEMENT]
lemma not_conj_deMorgans: "(\<not> ((P::'\<alpha> predicate) \<and> Q)) = ((\<not> P) \<or> (\<not> Q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<not> (P \<and> Q)) = (\<not> P \<or> \<not> Q)
[PROOF STEP]
by (rule ext) blast


[STATEMENT]
lemma dim_vec_of_poly [simp]: "dim_vec (vec_of_poly f) = degree f + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_vec (vec_of_poly f) = degree f + 1
[PROOF STEP]
by (simp add: vec_of_poly_as[symmetric])


[STATEMENT]
lemma DERIV_pow2: "DERIV (\<lambda>x. x ^ Suc n) x :> real (Suc n) * (x ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. x ^ Suc n) has_real_derivative real (Suc n) * x ^ n) (at x)
[PROOF STEP]
by (rule DERIV_cong, rule DERIV_pow) simp


[STATEMENT]
lemma (in is_functor) cf_comp_cf_const_left'[cat_cs_simps]:
  assumes "category \<alpha> \<CC>"
    and "a \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>"
    and "f = \<CC>\<lparr>CId\<rparr>\<lparr>a\<rparr>"
  shows "dghm_const \<BB> \<CC> a f \<circ>\<^sub>C\<^sub>F \<FF> = cf_const \<AA> \<CC> a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dghm_const \<BB> \<CC> a f \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF> = dghm_const \<AA> \<CC> a (\<CC>\<lparr>CId\<rparr>\<lparr>a\<rparr>)
[PROOF STEP]
using assms(1,2)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
a \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. dghm_const \<BB> \<CC> a f \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF> = dghm_const \<AA> \<CC> a (\<CC>\<lparr>CId\<rparr>\<lparr>a\<rparr>)
[PROOF STEP]
unfolding assms(3)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<CC>
a \<in>\<^sub>\<circ> \<CC>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. dghm_const \<BB> \<CC> a (\<CC>\<lparr>CId\<rparr>\<lparr>a\<rparr>) \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF> = dghm_const \<AA> \<CC> a (\<CC>\<lparr>CId\<rparr>\<lparr>a\<rparr>)
[PROOF STEP]
by (rule cf_comp_cf_const_left)


[STATEMENT]
lemma f_Exec_Stream_Init_Pre_Post2: "
  \<lbrakk> n < length xs;
    c_n = f_Exec_Comp_Stream_Init trans_fun xs c ! n; x_n = xs ! n \<rbrakk> \<Longrightarrow>
  (P (xs ! n) (f_Exec_Comp_Stream_Init trans_fun xs c ! n) \<longrightarrow>
     Q (f_Exec_Comp_Stream_Init trans_fun xs c ! Suc n)) =
  (P x_n c_n \<longrightarrow> Q (trans_fun x_n c_n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n < length xs; c_n = f_Exec_Comp_Stream_Init trans_fun xs c ! n; x_n = xs ! n\<rbrakk> \<Longrightarrow> (P (xs ! n) (f_Exec_Comp_Stream_Init trans_fun xs c ! n) \<longrightarrow> Q (f_Exec_Comp_Stream_Init trans_fun xs c ! Suc n)) = (P x_n c_n \<longrightarrow> Q (trans_fun x_n c_n))
[PROOF STEP]
by (simp add: f_Exec_Stream_Init_nth_Suc_calc)


[STATEMENT]
lemma none: "p >0 \<Longrightarrow> p < 1 \<Longrightarrow> (set_pmf (bernoulli_pmf p \<bind>
          (\<lambda>b. if b then map_pmf Inl Da else map_pmf Inr Db))
          \<inter> {f. (\<exists>e. Inl e = f)}) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < p; p < 1\<rbrakk> \<Longrightarrow> set_pmf (bernoulli_pmf p \<bind> (\<lambda>b. if b then map_pmf Inl Da else map_pmf Inr Db)) \<inter> {f. \<exists>e. Inl e = f} \<noteq> {}
[PROOF STEP]
apply(simp add: UNIV_bool)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < p; p < 1\<rbrakk> \<Longrightarrow> (Inr ` set_pmf Db \<union> Inl ` set_pmf Da) \<inter> {f. \<exists>e. Inl e = f} \<noteq> {}
[PROOF STEP]
using set_pmf_not_empty
[PROOF STATE]
proof (prove)
using this:
set_pmf ?M \<noteq> {}

goal (1 subgoal):
 1. \<lbrakk>0 < p; p < 1\<rbrakk> \<Longrightarrow> (Inr ` set_pmf Db \<union> Inl ` set_pmf Da) \<inter> {f. \<exists>e. Inl e = f} \<noteq> {}
[PROOF STEP]
by fast


[STATEMENT]
lemma add_diff_less: "\<lbrakk> k < n; 0 < m \<rbrakk> \<Longrightarrow> m + k - n < (m::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < n; 0 < m\<rbrakk> \<Longrightarrow> m + k - n < m
[PROOF STEP]
by (case_tac "m + k < n", simp_all)


[STATEMENT]
lemma degree_coefficients: "degree p = length (coefficients p) - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Polynomial_Expression.degree p = length (coefficients p) - 1
[PROOF STEP]
by (induct p rule: degree.induct) auto


[STATEMENT]
lemma L0'': assumes "l \<ge> L0''" shows "real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
have "(\<lambda> l :: nat. (real l * log 2 (real (l\<^sup>2 ^ 4)) + 1) / real (l\<^sup>2)) \<longlonglongrightarrow> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>l. (real l * log 2 (real (l\<^sup>2 ^ 4)) + 1) / real (l\<^sup>2)) \<longlonglongrightarrow> 0
[PROOF STEP]
by real_asymp
[PROOF STATE]
proof (state)
this:
(\<lambda>l. (real l * log 2 (real (l\<^sup>2 ^ 4)) + 1) / real (l\<^sup>2)) \<longlonglongrightarrow> 0

goal (1 subgoal):
 1. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
from LIMSEQ_D[OF this, of 1]
[PROOF STATE]
proof (chain)
picking this:
0 < 1 \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm ((real n * log 2 (real (n\<^sup>2 ^ 4)) + 1) / real (n\<^sup>2) - 0) < 1
[PROOF STEP]
obtain l0
    where "\<forall>l\<ge>l0. \<bar>1 + real l * log 2 (real l ^ 8)\<bar> / (real l)\<^sup>2 < 1"
[PROOF STATE]
proof (prove)
using this:
0 < 1 \<Longrightarrow> \<exists>no. \<forall>n\<ge>no. norm ((real n * log 2 (real (n\<^sup>2 ^ 4)) + 1) / real (n\<^sup>2) - 0) < 1

goal (1 subgoal):
 1. (\<And>l0. \<forall>l\<ge>l0. \<bar>1 + real l * log 2 (real l ^ 8)\<bar> / (real l)\<^sup>2 < 1 \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>l\<ge>l0. \<bar>1 + real l * log 2 (real l ^ 8)\<bar> / (real l)\<^sup>2 < 1

goal (1 subgoal):
 1. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
hence "\<forall> l \<ge> max 1 l0. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<ge>l0. \<bar>1 + real l * log 2 (real l ^ 8)\<bar> / (real l)\<^sup>2 < 1

goal (1 subgoal):
 1. \<forall>l\<ge>max 1 l0. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
by (auto simp: field_simps)
[PROOF STATE]
proof (state)
this:
\<forall>l\<ge>max 1 l0. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)

goal (1 subgoal):
 1. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
hence "\<exists> l0. \<forall> l \<ge> l0. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
\<forall>l\<ge>max 1 l0. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)

goal (1 subgoal):
 1. \<exists>l0. \<forall>l\<ge>l0. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>l0. \<forall>l\<ge>l0. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)

goal (1 subgoal):
 1. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
from someI_ex[OF this, folded L0''_def, rule_format, OF assms]
[PROOF STATE]
proof (chain)
picking this:
real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)

goal (1 subgoal):
 1. real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
real l * log 2 (real (l\<^sup>2 ^ 4)) + 1 < real (l\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_eq_sigmaI3:
  fixes F :: "'i \<Rightarrow> 'j \<Rightarrow> 'a::topological_space set" and X :: "'a::topological_space set set"
  assumes borel_eq: "borel = sigma UNIV X"
  assumes X: "\<And>x. x \<in> X \<Longrightarrow> x \<in> sets (sigma UNIV ((\<lambda>(i, j). F i j) ` A))"
  assumes F: "\<And>i j. (i, j) \<in> A \<Longrightarrow> F i j \<in> sets borel"
  shows "borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
borel = sigma UNIV X
?x \<in> X \<Longrightarrow> ?x \<in> sets (sigma UNIV ((\<lambda>(i, j). F i j) ` A))
(?i, ?j) \<in> A \<Longrightarrow> F ?i ?j \<in> sets borel

goal (1 subgoal):
 1. borel = sigma UNIV ((\<lambda>(i, j). F i j) ` A)
[PROOF STEP]
by (intro borel_eq_sigmaI1[where X=X and F="(\<lambda>(i, j). F i j)"]) auto


[STATEMENT]
lemma mat_kernel_mult_right_gen_set: assumes A: "A \<in> carrier_mat nr nc"
  and B: "B \<in> carrier_mat nc nc"
  and C: "C \<in> carrier_mat nc nc"
  and inv: "B * C = 1\<^sub>m nc"
  and gen_set: "kernel.gen_set nc (A * B) gen" and gen: "gen \<subseteq> mat_kernel (A * B)"
  shows "kernel.gen_set nc A (((*\<^sub>v) B) ` gen)" "(*\<^sub>v) B ` gen \<subseteq> mat_kernel A" "card (((*\<^sub>v) B) ` gen) = card gen"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LinearCombinations.module.span class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) ((*\<^sub>v) B ` gen) = carrier (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) &&& (*\<^sub>v) B ` gen \<subseteq> mat_kernel A &&& card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. LinearCombinations.module.span class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) ((*\<^sub>v) B ` gen) = carrier (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
let ?AB = "A * B"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. LinearCombinations.module.span class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) ((*\<^sub>v) B ` gen) = carrier (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
let ?gen = "((*\<^sub>v) B) ` gen"
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. LinearCombinations.module.span class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) ((*\<^sub>v) B ` gen) = carrier (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from A B
[PROOF STATE]
proof (chain)
picking this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nc nc
[PROOF STEP]
have AB: "A * B \<in> carrier_mat nr nc"
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nc nc

goal (1 subgoal):
 1. A * B \<in> carrier_mat nr nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B \<in> carrier_mat nr nc

goal (3 subgoals):
 1. LinearCombinations.module.span class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) ((*\<^sub>v) B ` gen) = carrier (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from B
[PROOF STATE]
proof (chain)
picking this:
B \<in> carrier_mat nc nc
[PROOF STEP]
have dimB: "dim_row B = nc"
[PROOF STATE]
proof (prove)
using this:
B \<in> carrier_mat nc nc

goal (1 subgoal):
 1. dim_row B = nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_row B = nc

goal (3 subgoals):
 1. LinearCombinations.module.span class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) ((*\<^sub>v) B ` gen) = carrier (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from inv B C
[PROOF STATE]
proof (chain)
picking this:
B * C = 1\<^sub>m nc
B \<in> carrier_mat nc nc
C \<in> carrier_mat nc nc
[PROOF STEP]
have CB: "C * B = 1\<^sub>m nc"
[PROOF STATE]
proof (prove)
using this:
B * C = 1\<^sub>m nc
B \<in> carrier_mat nc nc
C \<in> carrier_mat nc nc

goal (1 subgoal):
 1. C * B = 1\<^sub>m nc
[PROOF STEP]
by (metis mat_mult_left_right_inverse)
[PROOF STATE]
proof (state)
this:
C * B = 1\<^sub>m nc

goal (3 subgoals):
 1. LinearCombinations.module.span class_ring (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>) ((*\<^sub>v) B ` gen) = carrier (module_vec TYPE('a) nc\<lparr>carrier := mat_kernel A\<rparr>)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
interpret AB: kernel nr nc ?AB
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Kernel.kernel nr nc (A * B)
[PROOF STEP]
by (unfold_locales, rule AB)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. LinearCombinations.module.span class_ring (AB.NC.vs (mat_kernel A)) ((*\<^sub>v) B ` gen) = carrier (AB.NC.vs (mat_kernel A))
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
interpret A: kernel nr nc A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix_Kernel.kernel nr nc A
[PROOF STEP]
by (unfold_locales, rule A)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
fix w
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
assume "w \<in> ?gen"
[PROOF STATE]
proof (state)
this:
w \<in> (*\<^sub>v) B ` gen

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
w \<in> (*\<^sub>v) B ` gen
[PROOF STEP]
obtain v where w: "w = B *\<^sub>v v" and v: "v \<in> gen"
[PROOF STATE]
proof (prove)
using this:
w \<in> (*\<^sub>v) B ` gen

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>w = B *\<^sub>v v; v \<in> gen\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w = B *\<^sub>v v
v \<in> gen

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from v
[PROOF STATE]
proof (chain)
picking this:
v \<in> gen
[PROOF STEP]
have "v \<in> mat_kernel ?AB"
[PROOF STATE]
proof (prove)
using this:
v \<in> gen

goal (1 subgoal):
 1. v \<in> mat_kernel (A * B)
[PROOF STEP]
using gen
[PROOF STATE]
proof (prove)
using this:
v \<in> gen
gen \<subseteq> mat_kernel (A * B)

goal (1 subgoal):
 1. v \<in> mat_kernel (A * B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> mat_kernel (A * B)

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
hence v: "v \<in> carrier_vec nc" and 0: "?AB *\<^sub>v v = 0\<^sub>v nr"
[PROOF STATE]
proof (prove)
using this:
v \<in> mat_kernel (A * B)

goal (1 subgoal):
 1. v \<in> carrier_vec nc &&& A * B *\<^sub>v v = 0\<^sub>v nr
[PROOF STEP]
unfolding mat_kernel[OF AB]
[PROOF STATE]
proof (prove)
using this:
v \<in> {v \<in> carrier_vec nc. A * B *\<^sub>v v = 0\<^sub>v nr}

goal (1 subgoal):
 1. v \<in> carrier_vec nc &&& A * B *\<^sub>v v = 0\<^sub>v nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec nc
A * B *\<^sub>v v = 0\<^sub>v nr

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
have "?AB *\<^sub>v v = A *\<^sub>v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B *\<^sub>v v = A *\<^sub>v w
[PROOF STEP]
unfolding w
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B *\<^sub>v v = A *\<^sub>v (B *\<^sub>v v)
[PROOF STEP]
using v A B
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec nc
A \<in> carrier_mat nr nc
B \<in> carrier_mat nc nc

goal (1 subgoal):
 1. A * B *\<^sub>v v = A *\<^sub>v (B *\<^sub>v v)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * B *\<^sub>v v = A *\<^sub>v w

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
with 0
[PROOF STATE]
proof (chain)
picking this:
A * B *\<^sub>v v = 0\<^sub>v nr
A * B *\<^sub>v v = A *\<^sub>v w
[PROOF STEP]
have 0: "A *\<^sub>v w = 0\<^sub>v nr"
[PROOF STATE]
proof (prove)
using this:
A * B *\<^sub>v v = 0\<^sub>v nr
A * B *\<^sub>v v = A *\<^sub>v w

goal (1 subgoal):
 1. A *\<^sub>v w = 0\<^sub>v nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A *\<^sub>v w = 0\<^sub>v nr

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from w B v
[PROOF STATE]
proof (chain)
picking this:
w = B *\<^sub>v v
B \<in> carrier_mat nc nc
v \<in> carrier_vec nc
[PROOF STEP]
have w: "w \<in> carrier_vec nc"
[PROOF STATE]
proof (prove)
using this:
w = B *\<^sub>v v
B \<in> carrier_mat nc nc
v \<in> carrier_vec nc

goal (1 subgoal):
 1. w \<in> carrier_vec nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<in> carrier_vec nc

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from 0 w
[PROOF STATE]
proof (chain)
picking this:
A *\<^sub>v w = 0\<^sub>v nr
w \<in> carrier_vec nc
[PROOF STEP]
have "w \<in> mat_kernel A"
[PROOF STATE]
proof (prove)
using this:
A *\<^sub>v w = 0\<^sub>v nr
w \<in> carrier_vec nc

goal (1 subgoal):
 1. w \<in> mat_kernel A
[PROOF STEP]
unfolding mat_kernel[OF A]
[PROOF STATE]
proof (prove)
using this:
A *\<^sub>v w = 0\<^sub>v nr
w \<in> carrier_vec nc

goal (1 subgoal):
 1. w \<in> {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
w \<in> mat_kernel A

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?w3 \<in> (*\<^sub>v) B ` gen \<Longrightarrow> ?w3 \<in> mat_kernel A

goal (3 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
 3. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
thus genn: "?gen \<subseteq> mat_kernel A"
[PROOF STATE]
proof (prove)
using this:
?w3 \<in> (*\<^sub>v) B ` gen \<Longrightarrow> ?w3 \<in> mat_kernel A

goal (1 subgoal):
 1. (*\<^sub>v) B ` gen \<subseteq> mat_kernel A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(*\<^sub>v) B ` gen \<subseteq> mat_kernel A

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
hence one_dir: "A.span ?gen \<subseteq> mat_kernel A"
[PROOF STATE]
proof (prove)
using this:
(*\<^sub>v) B ` gen \<subseteq> mat_kernel A

goal (1 subgoal):
 1. A.span ((*\<^sub>v) B ` gen) \<subseteq> mat_kernel A
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
A.span ((*\<^sub>v) B ` gen) \<subseteq> mat_kernel A

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
A.span ((*\<^sub>v) B ` gen) \<subseteq> mat_kernel A

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
fix v v'
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
assume v: "v \<in> gen" and v': "v' \<in> gen" and id: "B *\<^sub>v v = B *\<^sub>v v'"
[PROOF STATE]
proof (state)
this:
v \<in> gen
v' \<in> gen
B *\<^sub>v v = B *\<^sub>v v'

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from v v'
[PROOF STATE]
proof (chain)
picking this:
v \<in> gen
v' \<in> gen
[PROOF STEP]
have v: "v \<in> carrier_vec nc" and v': "v' \<in> carrier_vec nc"
[PROOF STATE]
proof (prove)
using this:
v \<in> gen
v' \<in> gen

goal (1 subgoal):
 1. v \<in> carrier_vec nc &&& v' \<in> carrier_vec nc
[PROOF STEP]
using gen
[PROOF STATE]
proof (prove)
using this:
v \<in> gen
v' \<in> gen
gen \<subseteq> mat_kernel (A * B)

goal (1 subgoal):
 1. v \<in> carrier_vec nc &&& v' \<in> carrier_vec nc
[PROOF STEP]
unfolding mat_kernel[OF AB]
[PROOF STATE]
proof (prove)
using this:
v \<in> gen
v' \<in> gen
gen \<subseteq> {v \<in> carrier_vec nc. A * B *\<^sub>v v = 0\<^sub>v nr}

goal (1 subgoal):
 1. v \<in> carrier_vec nc &&& v' \<in> carrier_vec nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec nc
v' \<in> carrier_vec nc

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
from arg_cong[OF id, of "\<lambda> v. C *\<^sub>v v"]
[PROOF STATE]
proof (chain)
picking this:
C *\<^sub>v (B *\<^sub>v v) = C *\<^sub>v (B *\<^sub>v v')
[PROOF STEP]
have "v = v'"
[PROOF STATE]
proof (prove)
using this:
C *\<^sub>v (B *\<^sub>v v) = C *\<^sub>v (B *\<^sub>v v')

goal (1 subgoal):
 1. v = v'
[PROOF STEP]
using v v'
[PROOF STATE]
proof (prove)
using this:
C *\<^sub>v (B *\<^sub>v v) = C *\<^sub>v (B *\<^sub>v v')
v \<in> carrier_vec nc
v' \<in> carrier_vec nc

goal (1 subgoal):
 1. v = v'
[PROOF STEP]
unfolding assoc_mult_mat_vec[symmetric, OF C B v]
        assoc_mult_mat_vec[symmetric, OF C B v'] CB
[PROOF STATE]
proof (prove)
using this:
1\<^sub>m nc *\<^sub>v v = 1\<^sub>m nc *\<^sub>v v'
v \<in> carrier_vec nc
v' \<in> carrier_vec nc

goal (1 subgoal):
 1. v = v'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v = v'

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>?v3 \<in> gen; ?v'3 \<in> gen; B *\<^sub>v ?v3 = B *\<^sub>v ?v'3\<rbrakk> \<Longrightarrow> ?v3 = ?v'3

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
note inj = this
[PROOF STATE]
proof (state)
this:
\<lbrakk>?v3 \<in> gen; ?v'3 \<in> gen; B *\<^sub>v ?v3 = B *\<^sub>v ?v'3\<rbrakk> \<Longrightarrow> ?v3 = ?v'3

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
hence inj_gen: "inj_on ((*\<^sub>v) B) gen"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v3 \<in> gen; ?v'3 \<in> gen; B *\<^sub>v ?v3 = B *\<^sub>v ?v'3\<rbrakk> \<Longrightarrow> ?v3 = ?v'3

goal (1 subgoal):
 1. inj_on ((*\<^sub>v) B) gen
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v3 \<in> gen; ?v'3 \<in> gen; B *\<^sub>v ?v3 = B *\<^sub>v ?v'3\<rbrakk> \<Longrightarrow> ?v3 = ?v'3

goal (1 subgoal):
 1. \<forall>x\<in>gen. \<forall>y\<in>gen. B *\<^sub>v x = B *\<^sub>v y \<longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on ((*\<^sub>v) B) gen

goal (2 subgoals):
 1. A.gen_set ((*\<^sub>v) B ` gen)
 2. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
show "card ?gen = card gen"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
using inj_gen
[PROOF STATE]
proof (prove)
using this:
inj_on ((*\<^sub>v) B) gen

goal (1 subgoal):
 1. card ((*\<^sub>v) B ` gen) = card gen
[PROOF STEP]
by (rule card_image)
[PROOF STATE]
proof (state)
this:
card ((*\<^sub>v) B ` gen) = card gen

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
card ((*\<^sub>v) B ` gen) = card gen

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
let ?Cv = "C *\<^sub>v v"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
assume "v \<in> mat_kernel A"
[PROOF STATE]
proof (state)
this:
v \<in> mat_kernel A

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
from mat_kernelD[OF A this]
[PROOF STATE]
proof (chain)
picking this:
v \<in> carrier_vec nc
A *\<^sub>v v = 0\<^sub>v nr
[PROOF STEP]
have v: "v \<in> carrier_vec nc" and 0: "A *\<^sub>v v = 0\<^sub>v nr"
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec nc
A *\<^sub>v v = 0\<^sub>v nr

goal (1 subgoal):
 1. v \<in> carrier_vec nc &&& A *\<^sub>v v = 0\<^sub>v nr
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec nc
A *\<^sub>v v = 0\<^sub>v nr

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
have "?AB *\<^sub>v ?Cv = (A * (B * C)) *\<^sub>v v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B *\<^sub>v (C *\<^sub>v v) = A * (B * C) *\<^sub>v v
[PROOF STEP]
using A B C v
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat nr nc
B \<in> carrier_mat nc nc
C \<in> carrier_mat nc nc
v \<in> carrier_vec nc

goal (1 subgoal):
 1. A * B *\<^sub>v (C *\<^sub>v v) = A * (B * C) *\<^sub>v v
[PROOF STEP]
by (subst assoc_mult_mat_vec[symmetric, OF AB C v], subst assoc_mult_mat[OF A B C], simp)
[PROOF STATE]
proof (state)
this:
A * B *\<^sub>v (C *\<^sub>v v) = A * (B * C) *\<^sub>v v

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * B *\<^sub>v (C *\<^sub>v v) = A * (B * C) *\<^sub>v v

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
have "\<dots> = 0\<^sub>v nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * (B * C) *\<^sub>v v = 0\<^sub>v nr
[PROOF STEP]
unfolding inv
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * 1\<^sub>m nc *\<^sub>v v = 0\<^sub>v nr
[PROOF STEP]
using 0 A v
[PROOF STATE]
proof (prove)
using this:
A *\<^sub>v v = 0\<^sub>v nr
A \<in> carrier_mat nr nc
v \<in> carrier_vec nc

goal (1 subgoal):
 1. A * 1\<^sub>m nc *\<^sub>v v = 0\<^sub>v nr
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A * (B * C) *\<^sub>v v = 0\<^sub>v nr

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr
[PROOF STEP]
have 0: "?AB *\<^sub>v ?Cv = 0\<^sub>v nr" and Cv: "?Cv \<in> carrier_vec nc"
[PROOF STATE]
proof (prove)
using this:
A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr

goal (1 subgoal):
 1. A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr &&& C *\<^sub>v v \<in> carrier_vec nc
[PROOF STEP]
using C v
[PROOF STATE]
proof (prove)
using this:
A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr
C \<in> carrier_mat nc nc
v \<in> carrier_vec nc

goal (1 subgoal):
 1. A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr &&& C *\<^sub>v v \<in> carrier_vec nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr
C *\<^sub>v v \<in> carrier_vec nc

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
hence "?Cv \<in> mat_kernel ?AB"
[PROOF STATE]
proof (prove)
using this:
A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr
C *\<^sub>v v \<in> carrier_vec nc

goal (1 subgoal):
 1. C *\<^sub>v v \<in> mat_kernel (A * B)
[PROOF STEP]
unfolding mat_kernel[OF AB]
[PROOF STATE]
proof (prove)
using this:
A * B *\<^sub>v (C *\<^sub>v v) = 0\<^sub>v nr
C *\<^sub>v v \<in> carrier_vec nc

goal (1 subgoal):
 1. C *\<^sub>v v \<in> {v \<in> carrier_vec nc. A * B *\<^sub>v v = 0\<^sub>v nr}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C *\<^sub>v v \<in> mat_kernel (A * B)

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
with gen_set
[PROOF STATE]
proof (chain)
picking this:
AB.gen_set gen
C *\<^sub>v v \<in> mat_kernel (A * B)
[PROOF STEP]
have "?Cv \<in> AB.span gen"
[PROOF STATE]
proof (prove)
using this:
AB.gen_set gen
C *\<^sub>v v \<in> mat_kernel (A * B)

goal (1 subgoal):
 1. C *\<^sub>v v \<in> AB.span gen
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C *\<^sub>v v \<in> AB.span gen

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
from this[unfolded AB.Ker.span_def]
[PROOF STATE]
proof (chain)
picking this:
C *\<^sub>v v \<in> {AB.lincomb a A |a A. finite A \<and> A \<subseteq> gen \<and> a \<in> A \<rightarrow> UNIV}
[PROOF STEP]
obtain a gen' where
      Cv: "?Cv = AB.lincomb a gen'" and sub: "gen' \<subseteq> gen" and fin: "finite gen'"
[PROOF STATE]
proof (prove)
using this:
C *\<^sub>v v \<in> {AB.lincomb a A |a A. finite A \<and> A \<subseteq> gen \<and> a \<in> A \<rightarrow> UNIV}

goal (1 subgoal):
 1. (\<And>a gen'. \<lbrakk>C *\<^sub>v v = AB.lincomb a gen'; gen' \<subseteq> gen; finite gen'\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
C *\<^sub>v v = AB.lincomb a gen'
gen' \<subseteq> gen
finite gen'

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
let ?gen' = "((*\<^sub>v) B) ` gen'"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
from sub gen
[PROOF STATE]
proof (chain)
picking this:
gen' \<subseteq> gen
gen \<subseteq> mat_kernel (A * B)
[PROOF STEP]
have gen': "gen' \<subseteq> mat_kernel ?AB"
[PROOF STATE]
proof (prove)
using this:
gen' \<subseteq> gen
gen \<subseteq> mat_kernel (A * B)

goal (1 subgoal):
 1. gen' \<subseteq> mat_kernel (A * B)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gen' \<subseteq> mat_kernel (A * B)

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
have lin1: "AB.lincomb a gen' \<in> carrier_vec nc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AB.lincomb a gen' \<in> carrier_vec nc
[PROOF STEP]
using AB.Ker.lincomb_closed[OF gen', of a]
[PROOF STATE]
proof (prove)
using this:
a \<in> gen' \<rightarrow> UNIV \<Longrightarrow> AB.lincomb a gen' \<in> mat_kernel (A * B)

goal (1 subgoal):
 1. AB.lincomb a gen' \<in> carrier_vec nc
[PROOF STEP]
unfolding mat_kernel[OF AB]
[PROOF STATE]
proof (prove)
using this:
a \<in> gen' \<rightarrow> UNIV \<Longrightarrow> module.lincomb (AB.NC.vs {v \<in> carrier_vec nc. A * B *\<^sub>v v = 0\<^sub>v nr}) a gen' \<in> {v \<in> carrier_vec nc. A * B *\<^sub>v v = 0\<^sub>v nr}

goal (1 subgoal):
 1. module.lincomb (AB.NC.vs {v \<in> carrier_vec nc. A * B *\<^sub>v v = 0\<^sub>v nr}) a gen' \<in> carrier_vec nc
[PROOF STEP]
by (auto simp: class_field_def)
[PROOF STATE]
proof (state)
this:
AB.lincomb a gen' \<in> carrier_vec nc

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
hence dim1: "dim_vec (AB.lincomb a gen') = nc"
[PROOF STATE]
proof (prove)
using this:
AB.lincomb a gen' \<in> carrier_vec nc

goal (1 subgoal):
 1. dim_vec (AB.lincomb a gen') = nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_vec (AB.lincomb a gen') = nc

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
hence dim1b: "dim_vec (B *\<^sub>v (AB.Ker.lincomb a gen')) = nc"
[PROOF STATE]
proof (prove)
using this:
dim_vec (AB.lincomb a gen') = nc

goal (1 subgoal):
 1. dim_vec (B *\<^sub>v AB.lincomb a gen') = nc
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
dim_vec (AB.lincomb a gen') = nc
B \<in> carrier_mat nc nc

goal (1 subgoal):
 1. dim_vec (B *\<^sub>v AB.lincomb a gen') = nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_vec (B *\<^sub>v AB.lincomb a gen') = nc

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
from genn sub
[PROOF STATE]
proof (chain)
picking this:
(*\<^sub>v) B ` gen \<subseteq> mat_kernel A
gen' \<subseteq> gen
[PROOF STEP]
have genn': "?gen' \<subseteq> mat_kernel A"
[PROOF STATE]
proof (prove)
using this:
(*\<^sub>v) B ` gen \<subseteq> mat_kernel A
gen' \<subseteq> gen

goal (1 subgoal):
 1. (*\<^sub>v) B ` gen' \<subseteq> mat_kernel A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(*\<^sub>v) B ` gen' \<subseteq> mat_kernel A

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
from gen sub
[PROOF STATE]
proof (chain)
picking this:
gen \<subseteq> mat_kernel (A * B)
gen' \<subseteq> gen
[PROOF STEP]
have gen'nc: "gen' \<subseteq> carrier_vec nc"
[PROOF STATE]
proof (prove)
using this:
gen \<subseteq> mat_kernel (A * B)
gen' \<subseteq> gen

goal (1 subgoal):
 1. gen' \<subseteq> carrier_vec nc
[PROOF STEP]
unfolding mat_kernel[OF AB]
[PROOF STATE]
proof (prove)
using this:
gen \<subseteq> {v \<in> carrier_vec nc. A * B *\<^sub>v v = 0\<^sub>v nr}
gen' \<subseteq> gen

goal (1 subgoal):
 1. gen' \<subseteq> carrier_vec nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
gen' \<subseteq> carrier_vec nc

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
define a' where "a' = (\<lambda> b. a (C *\<^sub>v b))"
[PROOF STATE]
proof (state)
this:
a' = (\<lambda>b. a (C *\<^sub>v b))

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
from A.Ker.lincomb_closed[OF genn']
[PROOF STATE]
proof (chain)
picking this:
?a \<in> (*\<^sub>v) B ` gen' \<rightarrow> UNIV \<Longrightarrow> A.lincomb ?a ((*\<^sub>v) B ` gen') \<in> mat_kernel A
[PROOF STEP]
have lin2: "A.Ker.lincomb a' ?gen' \<in> carrier_vec nc"
[PROOF STATE]
proof (prove)
using this:
?a \<in> (*\<^sub>v) B ` gen' \<rightarrow> UNIV \<Longrightarrow> A.lincomb ?a ((*\<^sub>v) B ` gen') \<in> mat_kernel A

goal (1 subgoal):
 1. A.lincomb a' ((*\<^sub>v) B ` gen') \<in> carrier_vec nc
[PROOF STEP]
unfolding mat_kernel[OF A]
[PROOF STATE]
proof (prove)
using this:
?a \<in> (*\<^sub>v) B ` gen' \<rightarrow> UNIV \<Longrightarrow> module.lincomb (AB.NC.vs {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}) ?a ((*\<^sub>v) B ` gen') \<in> {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}

goal (1 subgoal):
 1. module.lincomb (AB.NC.vs {v \<in> carrier_vec nc. A *\<^sub>v v = 0\<^sub>v nr}) a' ((*\<^sub>v) B ` gen') \<in> carrier_vec nc
[PROOF STEP]
by (auto simp: class_field_def)
[PROOF STATE]
proof (state)
this:
A.lincomb a' ((*\<^sub>v) B ` gen') \<in> carrier_vec nc

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
hence dim2: "dim_vec (A.Ker.lincomb a' ?gen') = nc"
[PROOF STATE]
proof (prove)
using this:
A.lincomb a' ((*\<^sub>v) B ` gen') \<in> carrier_vec nc

goal (1 subgoal):
 1. dim_vec (A.lincomb a' ((*\<^sub>v) B ` gen')) = nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_vec (A.lincomb a' ((*\<^sub>v) B ` gen')) = nc

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
have "v = B *\<^sub>v ?Cv"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. v = B *\<^sub>v (C *\<^sub>v v)
[PROOF STEP]
by (unfold assoc_mult_mat_vec[symmetric, OF B C v] inv, insert v, simp)
[PROOF STATE]
proof (state)
this:
v = B *\<^sub>v (C *\<^sub>v v)

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
hence "v = B *\<^sub>v AB.Ker.lincomb a gen'"
[PROOF STATE]
proof (prove)
using this:
v = B *\<^sub>v (C *\<^sub>v v)

goal (1 subgoal):
 1. v = B *\<^sub>v AB.lincomb a gen'
[PROOF STEP]
unfolding Cv
[PROOF STATE]
proof (prove)
using this:
v = B *\<^sub>v AB.lincomb a gen'

goal (1 subgoal):
 1. v = B *\<^sub>v AB.lincomb a gen'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
v = B *\<^sub>v AB.lincomb a gen'

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
v = B *\<^sub>v AB.lincomb a gen'

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
have "\<dots> = A.Ker.lincomb a' ?gen'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B *\<^sub>v AB.lincomb a gen' = A.lincomb a' ((*\<^sub>v) B ` gen')
[PROOF STEP]
proof (rule eq_vecI; unfold dim1 dim1b dim2)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
assume i: "i < nc"
[PROOF STATE]
proof (state)
this:
i < nc

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
with dimB
[PROOF STATE]
proof (chain)
picking this:
dim_row B = nc
i < nc
[PROOF STEP]
have ii: "i < dim_row B"
[PROOF STATE]
proof (prove)
using this:
dim_row B = nc
i < nc

goal (1 subgoal):
 1. i < dim_row B
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < dim_row B

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
from sub inj
[PROOF STATE]
proof (chain)
picking this:
gen' \<subseteq> gen
\<lbrakk>?v3 \<in> gen; ?v'3 \<in> gen; B *\<^sub>v ?v3 = B *\<^sub>v ?v'3\<rbrakk> \<Longrightarrow> ?v3 = ?v'3
[PROOF STEP]
have inj: "inj_on ((*\<^sub>v) B) gen'"
[PROOF STATE]
proof (prove)
using this:
gen' \<subseteq> gen
\<lbrakk>?v3 \<in> gen; ?v'3 \<in> gen; B *\<^sub>v ?v3 = B *\<^sub>v ?v'3\<rbrakk> \<Longrightarrow> ?v3 = ?v'3

goal (1 subgoal):
 1. inj_on ((*\<^sub>v) B) gen'
[PROOF STEP]
unfolding inj_on_def
[PROOF STATE]
proof (prove)
using this:
gen' \<subseteq> gen
\<lbrakk>?v3 \<in> gen; ?v'3 \<in> gen; B *\<^sub>v ?v3 = B *\<^sub>v ?v'3\<rbrakk> \<Longrightarrow> ?v3 = ?v'3

goal (1 subgoal):
 1. \<forall>x\<in>gen'. \<forall>y\<in>gen'. B *\<^sub>v x = B *\<^sub>v y \<longrightarrow> x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on ((*\<^sub>v) B) gen'

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
inj_on ((*\<^sub>v) B) gen'

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
assume "v \<in> gen'"
[PROOF STATE]
proof (state)
this:
v \<in> gen'

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
with gen'nc
[PROOF STATE]
proof (chain)
picking this:
gen' \<subseteq> carrier_vec nc
v \<in> gen'
[PROOF STEP]
have v: "v \<in> carrier_vec nc"
[PROOF STATE]
proof (prove)
using this:
gen' \<subseteq> carrier_vec nc
v \<in> gen'

goal (1 subgoal):
 1. v \<in> carrier_vec nc
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> carrier_vec nc

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
hence "a' (B *\<^sub>v v) = a v"
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec nc

goal (1 subgoal):
 1. a' (B *\<^sub>v v) = a v
[PROOF STEP]
unfolding a'_def assoc_mult_mat_vec[symmetric, OF C B v] CB
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec nc

goal (1 subgoal):
 1. a (1\<^sub>m nc *\<^sub>v v) = a v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a' (B *\<^sub>v v) = a v

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?va3 \<in> gen' \<Longrightarrow> a' (B *\<^sub>v ?va3) = a ?va3

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
note a' = this
[PROOF STATE]
proof (state)
this:
?va3 \<in> gen' \<Longrightarrow> a' (B *\<^sub>v ?va3) = a ?va3

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
have "A.Ker.lincomb a' ?gen' $ i = (\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A.lincomb a' ((*\<^sub>v) B ` gen') $ i = (\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i)
[PROOF STEP]
unfolding A.lincomb_index[OF i genn']
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>(*\<^sub>v) B ` gen'. a' x * x $ i) = (\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
A.lincomb a' ((*\<^sub>v) B ` gen') $ i = (\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A.lincomb a' ((*\<^sub>v) B ` gen') $ i = (\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>gen'. a v * ((B *\<^sub>v v) $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i) = (\<Sum>v\<in>gen'. a v * (B *\<^sub>v v) $ i)
[PROOF STEP]
by (rule sum.reindex_cong[OF inj refl], auto simp: a')
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i) = (\<Sum>v\<in>gen'. a v * (B *\<^sub>v v) $ i)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>(*\<^sub>v) B ` gen'. a' v * v $ i) = (\<Sum>v\<in>gen'. a v * (B *\<^sub>v v) $ i)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
have "\<dots> = (\<Sum>v\<in>gen'. (\<Sum>j = 0..< nc. a v * row B i $ j * v $ j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>gen'. a v * (B *\<^sub>v v) $ i) = (\<Sum>v\<in>gen'. \<Sum>j = 0..<nc. a v * row B i $ j * v $ j)
[PROOF STEP]
unfolding mult_mat_vec_def dimB scalar_prod_def index_vec[OF i]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>gen'. a v * (\<Sum>ia = 0..<dim_vec v. row B i $ ia * v $ ia)) = (\<Sum>v\<in>gen'. \<Sum>j = 0..<nc. a v * row B i $ j * v $ j)
[PROOF STEP]
by (rule sum.cong, insert gen'nc, auto simp: sum_distrib_left ac_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>gen'. a v * (B *\<^sub>v v) $ i) = (\<Sum>v\<in>gen'. \<Sum>j = 0..<nc. a v * row B i $ j * v $ j)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>gen'. a v * (B *\<^sub>v v) $ i) = (\<Sum>v\<in>gen'. \<Sum>j = 0..<nc. a v * row B i $ j * v $ j)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
have "\<dots> = (\<Sum>j = 0 ..< nc. (\<Sum>v \<in> gen'. a v * row B i $ j * v $ j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>v\<in>gen'. \<Sum>j = 0..<nc. a v * row B i $ j * v $ j) = (\<Sum>j = 0..<nc. \<Sum>v\<in>gen'. a v * row B i $ j * v $ j)
[PROOF STEP]
by (rule sum.swap)
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>gen'. \<Sum>j = 0..<nc. a v * row B i $ j * v $ j) = (\<Sum>j = 0..<nc. \<Sum>v\<in>gen'. a v * row B i $ j * v $ j)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>v\<in>gen'. \<Sum>j = 0..<nc. a v * row B i $ j * v $ j) = (\<Sum>j = 0..<nc. \<Sum>v\<in>gen'. a v * row B i $ j * v $ j)

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
have "\<dots> = (\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<nc. \<Sum>v\<in>gen'. a v * row B i $ j * v $ j) = (\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j))
[PROOF STEP]
by (rule sum.cong, auto simp: sum_distrib_left ac_simps)
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<nc. \<Sum>v\<in>gen'. a v * row B i $ j * v $ j) = (\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j))

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<nc. \<Sum>v\<in>gen'. a v * row B i $ j * v $ j) = (\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j))

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
have "\<dots> = (B *\<^sub>v AB.Ker.lincomb a gen') $ i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j)) = (B *\<^sub>v AB.lincomb a gen') $ i
[PROOF STEP]
unfolding index_mult_mat_vec[OF ii]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j)) = row B i \<bullet> AB.lincomb a gen'
[PROOF STEP]
unfolding scalar_prod_def dim1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j)) = (\<Sum>ia = 0..<nc. row B i $ ia * AB.lincomb a gen' $ ia)
[PROOF STEP]
by (rule sum.cong[OF refl], subst AB.lincomb_index[OF _ gen'], auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>j = 0..<nc. row B i $ j * (\<Sum>v\<in>gen'. a v * v $ j)) = (B *\<^sub>v AB.lincomb a gen') $ i

goal (2 subgoals):
 1. \<And>i. i < nc \<Longrightarrow> (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
 2. nc = nc
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
A.lincomb a' ((*\<^sub>v) B ` gen') $ i = (B *\<^sub>v AB.lincomb a gen') $ i
[PROOF STEP]
show "(B *\<^sub>v AB.Ker.lincomb a gen') $ i = A.Ker.lincomb a' ?gen' $ i"
[PROOF STATE]
proof (prove)
using this:
A.lincomb a' ((*\<^sub>v) B ` gen') $ i = (B *\<^sub>v AB.lincomb a gen') $ i

goal (1 subgoal):
 1. (B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
(B *\<^sub>v AB.lincomb a gen') $ i = A.lincomb a' ((*\<^sub>v) B ` gen') $ i

goal (1 subgoal):
 1. nc = nc
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
B *\<^sub>v AB.lincomb a gen' = A.lincomb a' ((*\<^sub>v) B ` gen')

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
v = A.lincomb a' ((*\<^sub>v) B ` gen')
[PROOF STEP]
have "v \<in> A.Ker.span ?gen"
[PROOF STATE]
proof (prove)
using this:
v = A.lincomb a' ((*\<^sub>v) B ` gen')

goal (1 subgoal):
 1. v \<in> A.span ((*\<^sub>v) B ` gen)
[PROOF STEP]
using sub fin
[PROOF STATE]
proof (prove)
using this:
v = A.lincomb a' ((*\<^sub>v) B ` gen')
gen' \<subseteq> gen
finite gen'

goal (1 subgoal):
 1. v \<in> A.span ((*\<^sub>v) B ` gen)
[PROOF STEP]
unfolding A.Ker.span_def
[PROOF STATE]
proof (prove)
using this:
v = A.lincomb a' ((*\<^sub>v) B ` gen')
gen' \<subseteq> gen
finite gen'

goal (1 subgoal):
 1. v \<in> {A.lincomb a A |a A. finite A \<and> A \<subseteq> (*\<^sub>v) B ` gen \<and> a \<in> A \<rightarrow> UNIV}
[PROOF STEP]
by (auto simp: class_field_def intro!: exI[of _ a'] exI[of _ ?gen'])
[PROOF STATE]
proof (state)
this:
v \<in> A.span ((*\<^sub>v) B ` gen)

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
?v3 \<in> mat_kernel A \<Longrightarrow> ?v3 \<in> A.span ((*\<^sub>v) B ` gen)

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
hence other_dir: "A.Ker.span ?gen \<supseteq> mat_kernel A"
[PROOF STATE]
proof (prove)
using this:
?v3 \<in> mat_kernel A \<Longrightarrow> ?v3 \<in> A.span ((*\<^sub>v) B ` gen)

goal (1 subgoal):
 1. mat_kernel A \<subseteq> A.span ((*\<^sub>v) B ` gen)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
mat_kernel A \<subseteq> A.span ((*\<^sub>v) B ` gen)

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
from one_dir other_dir
[PROOF STATE]
proof (chain)
picking this:
A.span ((*\<^sub>v) B ` gen) \<subseteq> mat_kernel A
mat_kernel A \<subseteq> A.span ((*\<^sub>v) B ` gen)
[PROOF STEP]
show "kernel.gen_set nc A (((*\<^sub>v) B) ` gen)"
[PROOF STATE]
proof (prove)
using this:
A.span ((*\<^sub>v) B ` gen) \<subseteq> mat_kernel A
mat_kernel A \<subseteq> A.span ((*\<^sub>v) B ` gen)

goal (1 subgoal):
 1. A.gen_set ((*\<^sub>v) B ` gen)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A.gen_set ((*\<^sub>v) B ` gen)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fsubset_singleton_iff: "A |\<subseteq>| {|x|} \<longleftrightarrow> A = {||} \<or> A = {|x|}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A |\<subseteq>| {|x|}) = (A = {||} \<or> A = {|x|})
[PROOF STEP]
by blast


[STATEMENT]
lemma f_join_append: "
  (xs @ ys) \<Join>\<^sub>f I = xs \<Join>\<^sub>f I @ ys \<Join>\<^sub>f (I \<oplus>- (length xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (xs @ ys) \<Join>\<^sub> I = xs \<Join>\<^sub> I @ ys \<Join>\<^sub> (I \<oplus>- length xs)
[PROOF STEP]
apply (induct ys rule: rev_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (xs @ []) \<Join>\<^sub> I = xs \<Join>\<^sub> I @ [] \<Join>\<^sub> (I \<oplus>- length xs)
 2. \<And>x xsa. (xs @ xsa) \<Join>\<^sub> I = xs \<Join>\<^sub> I @ xsa \<Join>\<^sub> (I \<oplus>- length xs) \<Longrightarrow> (xs @ xsa @ [x]) \<Join>\<^sub> I = xs \<Join>\<^sub> I @ (xsa @ [x]) \<Join>\<^sub> (I \<oplus>- length xs)
[PROOF STEP]
apply (simp add: f_join_Nil)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x xsa. (xs @ xsa) \<Join>\<^sub> I = xs \<Join>\<^sub> I @ xsa \<Join>\<^sub> (I \<oplus>- length xs) \<Longrightarrow> (xs @ xsa @ [x]) \<Join>\<^sub> I = xs \<Join>\<^sub> I @ (xsa @ [x]) \<Join>\<^sub> (I \<oplus>- length xs)
[PROOF STEP]
apply (simp add: append_assoc[symmetric] f_join_snoc del: append_assoc)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xsa. (xs @ xsa) \<Join>\<^sub> I = xs \<Join>\<^sub> I @ xsa \<Join>\<^sub> (I \<oplus>- length xs) \<Longrightarrow> (length xs + length xsa \<in> I \<longrightarrow> length xsa \<in> I \<oplus>- length xs) \<and> (length xs + length xsa \<notin> I \<longrightarrow> length xsa \<notin> I \<oplus>- length xs)
[PROOF STEP]
apply (simp add: iT_Plus_neg_mem_iff add.commute[of "length xs"])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lconjseq_alternating_order2_repeats':
  fixes   s t :: 'a
  defines altst: "altst \<equiv> \<lambda>n. alternating_list n s t"
  and     altts: "altts \<equiv> \<lambda>n. alternating_list n t s"
  assumes st   : "s+s=0" "t+t=0" "(s+t)+^k = 0"
  shows   "map (lconjby (sum_list (altst k)))
            (lconjseq (if even k then altst m else altts m)) = lconjseq (altst m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst m else altts m)) = lconjseq (altst m)
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst 0 else altts 0)) = lconjseq (altst 0)
 2. \<And>m. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst m else altts m)) = lconjseq (altst m) \<Longrightarrow> map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc m) else altts (Suc m))) = lconjseq (altst (Suc m))
[PROOF STEP]
case (Suc j)
[PROOF STATE]
proof (state)
this:
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst j else altts j)) = lconjseq (altst j)

goal (2 subgoals):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst 0 else altts 0)) = lconjseq (altst 0)
 2. \<And>m. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst m else altts m)) = lconjseq (altst m) \<Longrightarrow> map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc m) else altts (Suc m))) = lconjseq (altst (Suc m))
[PROOF STEP]
with altst altts
[PROOF STATE]
proof (chain)
picking this:
altst \<equiv> \<lambda>n. alternating_list n s t
altts \<equiv> \<lambda>n. alternating_list n t s
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst j else altts j)) = lconjseq (altst j)
[PROOF STEP]
have  "map (lconjby (sum_list (altst k)))
            (lconjseq (if even k then altst (Suc j) else altts (Suc j))) =
            lconjseq (altst j) @
            [lconjby (sum_list (altst k @ (if even k then altst j else altts j)))
            (if even k then (if even j then s else t) else (if even j then t else s))]"
[PROOF STATE]
proof (prove)
using this:
altst \<equiv> \<lambda>n. alternating_list n s t
altts \<equiv> \<lambda>n. alternating_list n t s
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst j else altts j)) = lconjseq (altst j)

goal (1 subgoal):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst j) @ [lconjby (sum_list (altst k @ (if even k then altst j else altts j))) (if even k then if even j then s else t else if even j then t else s)]
[PROOF STEP]
by    (auto simp add: lconjseq_snoc lconjby_add)
[PROOF STATE]
proof (state)
this:
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst j) @ [lconjby (sum_list (altst k @ (if even k then altst j else altts j))) (if even k then if even j then s else t else if even j then t else s)]

goal (2 subgoals):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst 0 else altts 0)) = lconjseq (altst 0)
 2. \<And>m. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst m else altts m)) = lconjseq (altst m) \<Longrightarrow> map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc m) else altts (Suc m))) = lconjseq (altst (Suc m))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst j) @ [lconjby (sum_list (altst k @ (if even k then altst j else altts j))) (if even k then if even j then s else t else if even j then t else s)]

goal (2 subgoals):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst 0 else altts 0)) = lconjseq (altst 0)
 2. \<And>m. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst m else altts m)) = lconjseq (altst m) \<Longrightarrow> map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc m) else altts (Suc m))) = lconjseq (altst (Suc m))
[PROOF STEP]
from altst altts st(1,2)
[PROOF STATE]
proof (chain)
picking this:
altst \<equiv> \<lambda>n. alternating_list n s t
altts \<equiv> \<lambda>n. alternating_list n t s
s + s = (0::'a)
t + t = (0::'a)
[PROOF STEP]
have  "\<dots> = lconjseq (altst j) @ [sum_list (altst (Suc (2*(k+j))))]"
[PROOF STATE]
proof (prove)
using this:
altst \<equiv> \<lambda>n. alternating_list n s t
altts \<equiv> \<lambda>n. alternating_list n t s
s + s = (0::'a)
t + t = (0::'a)

goal (1 subgoal):
 1. lconjseq (altst j) @ [lconjby (sum_list (altst k @ (if even k then altst j else altts j))) (if even k then if even j then s else t else if even j then t else s)] = lconjseq (altst j) @ [sum_list (altst (Suc (2 * (k + j))))]
[PROOF STEP]
using lconjby_alternating_list_order2[of s t "k+j"]
[PROOF STATE]
proof (prove)
using this:
altst \<equiv> \<lambda>n. alternating_list n s t
altts \<equiv> \<lambda>n. alternating_list n t s
s + s = (0::'a)
t + t = (0::'a)
\<lbrakk>s + s = (0::'a); t + t = (0::'a)\<rbrakk> \<Longrightarrow> lconjby (sum_list (alternating_list (k + j) s t)) (if even (k + j) then s else t) = sum_list (alternating_list (Suc (2 * (k + j))) s t)

goal (1 subgoal):
 1. lconjseq (altst j) @ [lconjby (sum_list (altst k @ (if even k then altst j else altts j))) (if even k then if even j then s else t else if even j then t else s)] = lconjseq (altst j) @ [sum_list (altst (Suc (2 * (k + j))))]
[PROOF STEP]
by    (cases "even k")
          (auto simp add: alternating_list_append[of k])
[PROOF STATE]
proof (state)
this:
lconjseq (altst j) @ [lconjby (sum_list (altst k @ (if even k then altst j else altts j))) (if even k then if even j then s else t else if even j then t else s)] = lconjseq (altst j) @ [sum_list (altst (Suc (2 * (k + j))))]

goal (2 subgoals):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst 0 else altts 0)) = lconjseq (altst 0)
 2. \<And>m. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst m else altts m)) = lconjseq (altst m) \<Longrightarrow> map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc m) else altts (Suc m))) = lconjseq (altst (Suc m))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst j) @ [sum_list (altst (Suc (2 * (k + j))))]
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst j) @ [sum_list (altst (Suc (2 * (k + j))))]

goal (1 subgoal):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst (Suc j))
[PROOF STEP]
using altst st
[PROOF STATE]
proof (prove)
using this:
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst j) @ [sum_list (altst (Suc (2 * (k + j))))]
altst \<equiv> \<lambda>n. alternating_list n s t
s + s = (0::'a)
t + t = (0::'a)
(s + t) +^ k = (0::'a)

goal (1 subgoal):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst (Suc j))
[PROOF STEP]
by    (auto simp add:
            alternating_list_append(1)[THEN sym]
            alternating_sum_list_conv_nataction
            lconjby_alternating_list_order2 lconjseq_snoc
          )
[PROOF STATE]
proof (state)
this:
map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst (Suc j) else altts (Suc j))) = lconjseq (altst (Suc j))

goal (1 subgoal):
 1. map (lconjby (sum_list (altst k))) (lconjseq (if even k then altst 0 else altts 0)) = lconjseq (altst 0)
[PROOF STEP]
qed (simp add: altst altts)


[STATEMENT]
theorem IFbd_card_order: "card_order IFbd"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_order IFbd
[PROOF STEP]
apply (rule card_order_csum)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. card_order bd_F1
 2. card_order bd_F2
[PROOF STEP]
apply (rule F1.bd_card_order)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_order bd_F2
[PROOF STEP]
apply (rule F2.bd_card_order)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma filt_simp: "([b] = filter p [0..<n]) =
   (p b \<and> b < n \<and> (\<forall>y < n. p y \<longrightarrow> b = y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ([b] = filter p [0..<n]) = (p b \<and> b < n \<and> (\<forall>y<n. p y \<longrightarrow> b = y))
[PROOF STEP]
apply (induction n, simp, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. ([b] = filter p [0..<n]) = (p b \<and> b < n \<and> (\<forall>y<n. p y \<longrightarrow> b = y)) \<Longrightarrow> (p n \<longrightarrow> ([] = filter p [0..<n] \<and> b = n) = (p b \<and> b < Suc n \<and> (\<forall>y<Suc n. p y \<longrightarrow> b = y))) \<and> (\<not> p n \<longrightarrow> (p b \<and> b < n \<and> (\<forall>y<n. p y \<longrightarrow> b = y)) = (p b \<and> b < Suc n \<and> (\<forall>y<Suc n. p y \<longrightarrow> b = y)))
[PROOF STEP]
by (metis atLeast_upt cancel_comm_monoid_add_class.diff_cancel
      filter_empty_conv lessThan_iff less_Suc_eq neq0_conv zero_less_diff)