[STATEMENT]
lemma "\<not>regular_lang {w. length (filter id w) = length (filter Not w)}" (is "\<not>regular_lang ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<nexists>r. lang r = {w. length (filter id w) = length (filter Not w)}
[PROOF STEP]
proof (rule not_regular_langI')
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. infinite ?B
 2. \<And>x y. \<lbrakk>x \<in> ?B; y \<in> ?B; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>w. (?f x @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (?f y @ w \<in> {w. length (filter id w) = length (filter Not w)})
[PROOF STEP]
show "infinite (UNIV :: nat set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
infinite UNIV

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>w. (?f x @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (?f y @ w \<in> {w. length (filter id w) = length (filter Not w)})
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>w. (?f x @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (?f y @ w \<in> {w. length (filter id w) = length (filter Not w)})
[PROOF STEP]
fix m n :: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>w. (?f x @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (?f y @ w \<in> {w. length (filter id w) = length (filter Not w)})
[PROOF STEP]
assume "m \<noteq> n"
[PROOF STATE]
proof (state)
this:
m \<noteq> n

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>w. (?f x @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (?f y @ w \<in> {w. length (filter id w) = length (filter Not w)})
[PROOF STEP]
hence "replicate m True @ replicate m False \<in> ?A" and
        "replicate n True @ replicate m False \<notin> ?A"
[PROOF STATE]
proof (prove)
using this:
m \<noteq> n

goal (1 subgoal):
 1. replicate m True @ replicate m False \<in> {w. length (filter id w) = length (filter Not w)} &&& replicate n True @ replicate m False \<notin> {w. length (filter id w) = length (filter Not w)}
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
replicate m True @ replicate m False \<in> {w. length (filter id w) = length (filter Not w)}
replicate n True @ replicate m False \<notin> {w. length (filter id w) = length (filter Not w)}

goal (1 subgoal):
 1. \<And>x y. \<lbrakk>x \<in> UNIV; y \<in> UNIV; x \<noteq> y\<rbrakk> \<Longrightarrow> \<exists>w. (?f x @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (?f y @ w \<in> {w. length (filter id w) = length (filter Not w)})
[PROOF STEP]
thus "\<exists>w. \<not>(replicate m True @ w \<in> ?A \<longleftrightarrow> replicate n True @ w \<in> ?A)"
[PROOF STATE]
proof (prove)
using this:
replicate m True @ replicate m False \<in> {w. length (filter id w) = length (filter Not w)}
replicate n True @ replicate m False \<notin> {w. length (filter id w) = length (filter Not w)}

goal (1 subgoal):
 1. \<exists>w. (replicate m True @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (replicate n True @ w \<in> {w. length (filter id w) = length (filter Not w)})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>w. (replicate m True @ w \<in> {w. length (filter id w) = length (filter Not w)}) \<noteq> (replicate n True @ w \<in> {w. length (filter id w) = length (filter Not w)})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma compact_Int_closedin:
  assumes "compactin X S" "closedin X T" shows "compactin X (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compactin X (S \<inter> T)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. compactin X (S \<inter> T)
[PROOF STEP]
have "compactin (subtopology X S) (S \<inter> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compactin (subtopology X S) (S \<inter> T)
[PROOF STEP]
by (metis assms closedin_compact_space closedin_subtopology compactin_subspace inf_commute)
[PROOF STATE]
proof (state)
this:
compactin (subtopology X S) (S \<inter> T)

goal (1 subgoal):
 1. compactin X (S \<inter> T)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compactin (subtopology X S) (S \<inter> T)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
compactin (subtopology X S) (S \<inter> T)

goal (1 subgoal):
 1. compactin X (S \<inter> T)
[PROOF STEP]
by (simp add: compactin_subtopology)
[PROOF STATE]
proof (state)
this:
compactin X (S \<inter> T)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_convex_compact_sets_eq:
  assumes "convex S" "compact S" "convex T" "compact T"
  shows "S homeomorphic T \<longleftrightarrow> aff_dim S = aff_dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T = (aff_dim S = aff_dim T)
[PROOF STEP]
by (meson assms homeomorphic_convex_compact_sets homeomorphic_convex_sets)


[STATEMENT]
lemma span_mat_mul_subset:
  assumes "A \<in> carrier_mat n d"
  assumes "B \<in> carrier_mat d nc"
  shows "span (set (cols (A * B))) \<subseteq> span (set (cols A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (cols (A * B))) \<subseteq> local.span (set (cols A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.span (set (cols (A * B))) \<subseteq> local.span (set (cols A))
[PROOF STEP]
have *: "\<And>v. \<exists>ca. lincomb_list v (cols (A * B)) =
              lincomb_list ca  (cols A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
fix v
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
have "lincomb_list v (cols (A * B)) = (A * B) *\<^sub>v vec nc v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lincomb_list v (cols (A * B)) = A * B *\<^sub>v vec nc v
[PROOF STEP]
apply (subst lincomb_list_as_mat_mult)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>w\<in>set (cols (A * B)). dim_vec w = n
 2. mat_of_cols n (cols (A * B)) *\<^sub>v vec (length (cols (A * B))) v = A * B *\<^sub>v vec nc v
[PROOF STEP]
apply (metis assms(1) carrier_dim_vec carrier_matD(1) cols_dim index_mult_mat(2) subset_code(1))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_of_cols n (cols (A * B)) *\<^sub>v vec (length (cols (A * B))) v = A * B *\<^sub>v vec nc v
[PROOF STEP]
by (metis assms(1) assms(2) carrier_matD(1) carrier_matD(2) cols_length index_mult_mat(2) index_mult_mat(3) mat_of_cols_cols)
[PROOF STATE]
proof (state)
this:
lincomb_list v (cols (A * B)) = A * B *\<^sub>v vec nc v

goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
lincomb_list v (cols (A * B)) = A * B *\<^sub>v vec nc v

goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
have "... = A *\<^sub>v (B *\<^sub>v vec nc v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A * B *\<^sub>v vec nc v = A *\<^sub>v (B *\<^sub>v vec nc v)
[PROOF STEP]
using assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n d
B \<in> carrier_mat d nc

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

goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
A * B *\<^sub>v vec nc v = A *\<^sub>v (B *\<^sub>v vec nc v)

goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
have "... = lincomb_list (\<lambda>i. (B *\<^sub>v vec nc v) $ i) (cols A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v (B *\<^sub>v vec nc v) = lincomb_list (($) (B *\<^sub>v vec nc v)) (cols A)
[PROOF STEP]
apply (subst lincomb_list_as_mat_mult)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>w\<in>set (cols A). dim_vec w = n
 2. A *\<^sub>v (B *\<^sub>v vec nc v) = mat_of_cols n (cols A) *\<^sub>v vec (length (cols A)) (($) (B *\<^sub>v vec nc v))
[PROOF STEP]
using assms(1) carrier_dim_vec cols_dim
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n d
(?v \<in> carrier_vec ?n) = (dim_vec ?v = ?n)
set (cols ?A) \<subseteq> carrier_vec (dim_row ?A)

goal (2 subgoals):
 1. \<forall>w\<in>set (cols A). dim_vec w = n
 2. A *\<^sub>v (B *\<^sub>v vec nc v) = mat_of_cols n (cols A) *\<^sub>v vec (length (cols A)) (($) (B *\<^sub>v vec nc v))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A *\<^sub>v (B *\<^sub>v vec nc v) = mat_of_cols n (cols A) *\<^sub>v vec (length (cols A)) (($) (B *\<^sub>v vec nc v))
[PROOF STEP]
by (metis assms(1) assms(2) carrier_matD(1) carrier_matD(2) cols_length dim_mult_mat_vec dim_vec eq_vecI index_vec mat_of_cols_cols)
[PROOF STATE]
proof (state)
this:
A *\<^sub>v (B *\<^sub>v vec nc v) = lincomb_list (($) (B *\<^sub>v vec nc v)) (cols A)

goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
lincomb_list v (cols (A * B)) = A *\<^sub>v (B *\<^sub>v vec nc v)
A *\<^sub>v (B *\<^sub>v vec nc v) = lincomb_list (($) (B *\<^sub>v vec nc v)) (cols A)
[PROOF STEP]
have "lincomb_list v (cols (A * B)) =
              lincomb_list (\<lambda>i. (B *\<^sub>v vec nc v) $ i) (cols A)"
[PROOF STATE]
proof (prove)
using this:
lincomb_list v (cols (A * B)) = A *\<^sub>v (B *\<^sub>v vec nc v)
A *\<^sub>v (B *\<^sub>v vec nc v) = lincomb_list (($) (B *\<^sub>v vec nc v)) (cols A)

goal (1 subgoal):
 1. lincomb_list v (cols (A * B)) = lincomb_list (($) (B *\<^sub>v vec nc v)) (cols A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lincomb_list v (cols (A * B)) = lincomb_list (($) (B *\<^sub>v vec nc v)) (cols A)

goal (1 subgoal):
 1. \<And>v. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
thus "\<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)"
[PROOF STATE]
proof (prove)
using this:
lincomb_list v (cols (A * B)) = lincomb_list (($) (B *\<^sub>v vec nc v)) (cols A)

goal (1 subgoal):
 1. \<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>ca. lincomb_list v (cols (A * B)) = lincomb_list ca (cols A)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<exists>ca. lincomb_list ?v1 (cols (A * B)) = lincomb_list ca (cols A)

goal (1 subgoal):
 1. local.span (set (cols (A * B))) \<subseteq> local.span (set (cols A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.span (set (cols (A * B))) \<subseteq> local.span (set (cols A))
[PROOF STEP]
apply (subst span_list_as_span[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set (cols (A * B)) \<subseteq> carrier_vec n
 2. span_list (cols (A * B)) \<subseteq> local.span (set (cols A))
[PROOF STEP]
apply (metis assms(1) carrier_matD(1) cols_dim index_mult_mat(2))
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span_list (cols (A * B)) \<subseteq> local.span (set (cols A))
[PROOF STEP]
apply (subst span_list_as_span[symmetric])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. set (cols A) \<subseteq> carrier_vec n
 2. span_list (cols (A * B)) \<subseteq> span_list (cols A)
[PROOF STEP]
using assms(1) cols_dim
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat n d
set (cols ?A) \<subseteq> carrier_vec (dim_row ?A)

goal (2 subgoals):
 1. set (cols A) \<subseteq> carrier_vec n
 2. span_list (cols (A * B)) \<subseteq> span_list (cols A)
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span_list (cols (A * B)) \<subseteq> span_list (cols A)
[PROOF STEP]
by (auto simp add:span_list_def *)
[PROOF STATE]
proof (state)
this:
local.span (set (cols (A * B))) \<subseteq> local.span (set (cols A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rtos_hom2:"\<lbrakk>(0::nat) < r; (0::nat) < s; l \<le> (r * s - Suc 0)\<rbrakk> \<Longrightarrow>
 rtos r s l \<le> (r * s - Suc 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; l \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> rtos r s l \<le> r * s - Suc 0
[PROOF STEP]
apply (insert  rtos_hom1 [of "r" "s"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; l \<le> r * s - Suc 0; \<And>l. \<lbrakk>0 < r; 0 < s; l \<le> r * s - Suc 0\<rbrakk> \<Longrightarrow> rtos r s l \<le> s * r - Suc 0\<rbrakk> \<Longrightarrow> rtos r s l \<le> r * s - Suc 0
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; l \<le> r * s - Suc 0; \<And>l. l \<le> r * s - Suc 0 \<Longrightarrow> rtos r s l \<le> s * r - Suc 0\<rbrakk> \<Longrightarrow> rtos r s l \<le> r * s - Suc 0
[PROOF STEP]
apply (simp add:mult.commute)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma has_integral_diff:
  "(f has_integral k) S \<Longrightarrow> (g has_integral l) S \<Longrightarrow>
    ((\<lambda>x. f x - g x) has_integral (k - l)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_integral k) S; (g has_integral l) S\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) has_integral k - l) S
[PROOF STEP]
using has_integral_add[OF _ has_integral_neg, of f k S g l]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(f has_integral k) S; (g has_integral l) S\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x + - g x) has_integral k + - l) S

goal (1 subgoal):
 1. \<lbrakk>(f has_integral k) S; (g has_integral l) S\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x - g x) has_integral k - l) S
[PROOF STEP]
by (auto simp: algebra_simps)


[STATEMENT]
lemma closed_sum_right_subset: \<open>0 \<in> A \<Longrightarrow> B \<subseteq> A +\<^sub>M B\<close> for A B :: "_::monoid_add"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'c) \<in> A \<Longrightarrow> B \<subseteq> A +\<^sub>M B
[PROOF STEP]
by (metis add.left_neutral closed_sum_def closure_subset set_plus_intro subset_iff)


[STATEMENT]
lemma prop_abs_subst_comm: assumes "f o f \<equiv> id" and "g o g \<equiv> id" and "f o g \<equiv> g o f"
  shows "(\<lambda>x. F (f (g x))) oo (f o g) \<equiv> (\<lambda>x. F x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. PROP F (f (g x))) oo (f \<circ> g) \<equiv> \<lambda>x. PROP F x
[PROOF STEP]
unfolding \<open>f o g \<equiv> g o f\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. PROP F (f (g x))) oo (g \<circ> f) \<equiv> \<lambda>x. PROP F x
[PROOF STEP]
unfolding COMP_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. PROP F (f (g x))) oo g oo f \<equiv> \<lambda>x. PROP F x
[PROOF STEP]
unfolding prop_abs_subst[OF \<open>g o g \<equiv> id\<close>, of "\<lambda>x. F (f x)"] prop_abs_subst[OF \<open>f o f \<equiv> id\<close>]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lambda>x. PROP F x \<equiv> \<lambda>x. PROP F x
[PROOF STEP]
.


[STATEMENT]
lemma alw_snth:
  assumes "alw (\<lambda>xs. P (shd (stl xs)) (shd xs)) xs"
  shows "P (xs!!(Suc n)) (xs!! n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P (xs !! Suc n) (xs !! n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
alw (\<lambda>xs. P (shd (stl xs)) (shd xs)) xs

goal (1 subgoal):
 1. P (xs !! Suc n) (xs !! n)
[PROOF STEP]
by (induction n, auto, metis (mono_tags) alw.cases alw_iff_sdrop sdrop_simps(1) sdrop_stl)


[STATEMENT]
lemma rotater1_map: "rotater1 (map f xs) = map f (rotater1 xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rotater1 (map f xs) = map f (rotater1 xs)
[PROOF STEP]
by (cases xs) (auto simp: rotater1_def last_map butlast_map)


[STATEMENT]
lemma powhr_as_starfun: "\<And>a x. x powhr a = (if x = 0 then 0 else ( *f* exp) (a * ( *f* real_ln) x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a x. x powhr a = (if x = 0 then 0 else (*f* exp) (a * (*f* real_ln) x))
[PROOF STEP]
by transfer (simp add: powr_def)


[STATEMENT]
lemma limit_mat_mult:
  fixes X :: "nat \<Rightarrow> complex mat" and Y :: "nat \<Rightarrow> complex mat" and A :: "complex mat"
    and m :: nat and B :: "complex mat"
  assumes limX: "limit_mat X A m" and limY: "limit_mat Y B m"
  shows "limit_mat (\<lambda>k. X k * Y k) (A * B) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
have dimA: "A \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<in> carrier_mat m m
[PROOF STEP]
using limX limit_mat_def
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))

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

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
have dimB: "B \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<in> carrier_mat m m
[PROOF STEP]
using limY limit_mat_def
[PROOF STATE]
proof (prove)
using this:
limit_mat Y B m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))

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

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
have dimX: "\<And>n. X n \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. X n \<in> carrier_mat m m
[PROOF STEP]
using limX
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m

goal (1 subgoal):
 1. \<And>n. X n \<in> carrier_mat m m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. X n \<in> carrier_mat m m \<and> A \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. X n $$ (i, j)) \<longlonglongrightarrow> A $$ (i, j))

goal (1 subgoal):
 1. \<And>n. X n \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
X ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
have dimY: "\<And>n. Y n \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. Y n \<in> carrier_mat m m
[PROOF STEP]
using limY
[PROOF STATE]
proof (prove)
using this:
limit_mat Y B m

goal (1 subgoal):
 1. \<And>n. Y n \<in> carrier_mat m m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>n. Y n \<in> carrier_mat m m \<and> B \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. Y n $$ (i, j)) \<longlonglongrightarrow> B $$ (i, j))

goal (1 subgoal):
 1. \<And>n. Y n \<in> carrier_mat m m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Y ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Y ?n \<in> carrier_mat m m
[PROOF STEP]
have dimXAB: "\<forall>n. X n * Y n \<in> carrier_mat m m \<and> A * B \<in> carrier_mat m m"
[PROOF STATE]
proof (prove)
using this:
Y ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. \<forall>n. X n * Y n \<in> carrier_mat m m \<and> A * B \<in> carrier_mat m m
[PROOF STEP]
using dimA dimB dimX dimY
[PROOF STATE]
proof (prove)
using this:
Y ?n \<in> carrier_mat m m
A \<in> carrier_mat m m
B \<in> carrier_mat m m
X ?n \<in> carrier_mat m m
Y ?n \<in> carrier_mat m m

goal (1 subgoal):
 1. \<forall>n. X n * Y n \<in> carrier_mat m m \<and> A * B \<in> carrier_mat m m
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<forall>n. X n * Y n \<in> carrier_mat m m \<and> A * B \<in> carrier_mat m m

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
have "(\<And>i j. i < m \<Longrightarrow> j < m \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
fix i j
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
assume i: "i < m" and j: "j < m"
[PROOF STATE]
proof (state)
this:
i < m
j < m

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
have eqn: "(X n * Y n) $$ (i, j) = (\<Sum>k=0..<m. (X n)$$(i, k) * (Y n)$$(k, j))" for n
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (X n * Y n) $$ (i, j) = (\<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j))
[PROOF STEP]
using i j dimX[of n] dimY[of n]
[PROOF STATE]
proof (prove)
using this:
i < m
j < m
X n \<in> carrier_mat m m
Y n \<in> carrier_mat m m

goal (1 subgoal):
 1. (X n * Y n) $$ (i, j) = (\<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j))
[PROOF STEP]
by (auto simp add: scalar_prod_def)
[PROOF STATE]
proof (state)
this:
(X ?n * Y ?n) $$ (i, j) = (\<Sum>k = 0..<m. X ?n $$ (i, k) * Y ?n $$ (k, j))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
have eq: "(A * B) $$ (i, j) = (\<Sum>k=0..<m. A$$(i,k) * B$$(k,j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * B) $$ (i, j) = (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))
[PROOF STEP]
using i j dimB dimA
[PROOF STATE]
proof (prove)
using this:
i < m
j < m
B \<in> carrier_mat m m
A \<in> carrier_mat m m

goal (1 subgoal):
 1. (A * B) $$ (i, j) = (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))
[PROOF STEP]
by (auto simp add: scalar_prod_def)
[PROOF STATE]
proof (state)
this:
(A * B) $$ (i, j) = (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
have "(\<lambda>n. (X n) $$ (i, k)) \<longlonglongrightarrow> A$$(i, k)" if "k < m" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, k)) \<longlonglongrightarrow> A $$ (i, k)
[PROOF STEP]
using limX limit_mat_def that i
[PROOF STATE]
proof (prove)
using this:
limit_mat X A m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))
k < m
i < m

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, k)) \<longlonglongrightarrow> A $$ (i, k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k)) \<longlonglongrightarrow> A $$ (i, ?k)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k)) \<longlonglongrightarrow> A $$ (i, ?k)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
have "(\<lambda>n. (Y n) $$ (k, j)) \<longlonglongrightarrow> B$$(k, j)" if "k < m" for k
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. Y n $$ (k, j)) \<longlonglongrightarrow> B $$ (k, j)
[PROOF STEP]
using limY limit_mat_def that j
[PROOF STATE]
proof (prove)
using this:
limit_mat Y B m
limit_mat ?X ?A ?m = (\<forall>n. ?X n \<in> carrier_mat ?m ?m \<and> ?A \<in> carrier_mat ?m ?m \<and> (\<forall>i<?m. \<forall>j<?m. (\<lambda>n. ?X n $$ (i, j)) \<longlonglongrightarrow> ?A $$ (i, j)))
k < m
j < m

goal (1 subgoal):
 1. (\<lambda>n. Y n $$ (k, j)) \<longlonglongrightarrow> B $$ (k, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < m \<Longrightarrow> (\<lambda>n. Y n $$ (?k, j)) \<longlonglongrightarrow> B $$ (?k, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k)) \<longlonglongrightarrow> A $$ (i, ?k)
?k < m \<Longrightarrow> (\<lambda>n. Y n $$ (?k, j)) \<longlonglongrightarrow> B $$ (?k, j)
[PROOF STEP]
have "(\<lambda>n. (X n)$$(i, k) * (Y n)$$(k,j)) \<longlonglongrightarrow> A$$(i, k) * B$$(k, j)" if "k < m" for k
[PROOF STATE]
proof (prove)
using this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k)) \<longlonglongrightarrow> A $$ (i, ?k)
?k < m \<Longrightarrow> (\<lambda>n. Y n $$ (?k, j)) \<longlonglongrightarrow> B $$ (?k, j)

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> A $$ (i, k) * B $$ (k, j)
[PROOF STEP]
using tendsto_mult[of "\<lambda>n. (X n) $$ (i, k)" "A$$(i, k)" _ "\<lambda>n. (Y n)$$(k, j)" "B$$(k, j)"] that
[PROOF STATE]
proof (prove)
using this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k)) \<longlonglongrightarrow> A $$ (i, ?k)
?k < m \<Longrightarrow> (\<lambda>n. Y n $$ (?k, j)) \<longlonglongrightarrow> B $$ (?k, j)
\<lbrakk>((\<lambda>n. X n $$ (i, k)) \<longlongrightarrow> A $$ (i, k)) ?F; ((\<lambda>n. Y n $$ (k, j)) \<longlongrightarrow> B $$ (k, j)) ?F\<rbrakk> \<Longrightarrow> ((\<lambda>x. X x $$ (i, k) * Y x $$ (k, j)) \<longlongrightarrow> A $$ (i, k) * B $$ (k, j)) ?F
k < m

goal (1 subgoal):
 1. (\<lambda>n. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> A $$ (i, k) * B $$ (k, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k) * Y n $$ (?k, j)) \<longlonglongrightarrow> A $$ (i, ?k) * B $$ (?k, j)

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k) * Y n $$ (?k, j)) \<longlonglongrightarrow> A $$ (i, ?k) * B $$ (?k, j)
[PROOF STEP]
have "(\<lambda>n. (\<Sum>k=0..<m. (X n)$$(i,k) * (Y n)$$(k,j))) \<longlonglongrightarrow> (\<Sum>k=0..<m. A$$(i,k) * B$$(k,j))"
[PROOF STATE]
proof (prove)
using this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k) * Y n $$ (?k, j)) \<longlonglongrightarrow> A $$ (i, ?k) * B $$ (?k, j)

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))
[PROOF STEP]
using tendsto_sum[of "{0..<m}" "\<lambda>k n. (X n)$$(i,k) * (Y n)$$(k,j)" "\<lambda>k. A$$(i, k) * B$$(k, j)"]
[PROOF STATE]
proof (prove)
using this:
?k < m \<Longrightarrow> (\<lambda>n. X n $$ (i, ?k) * Y n $$ (?k, j)) \<longlonglongrightarrow> A $$ (i, ?k) * B $$ (?k, j)
(\<And>ia. ia \<in> {0..<m} \<Longrightarrow> ((\<lambda>n. X n $$ (i, ia) * Y n $$ (ia, j)) \<longlongrightarrow> A $$ (i, ia) * B $$ (ia, j)) ?F) \<Longrightarrow> ((\<lambda>x. \<Sum>ia = 0..<m. X x $$ (i, ia) * Y x $$ (ia, j)) \<longlongrightarrow> (\<Sum>ia = 0..<m. A $$ (i, ia) * B $$ (ia, j))) ?F

goal (1 subgoal):
 1. (\<lambda>n. \<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. \<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < m; j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. \<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))
[PROOF STEP]
show "(\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))

goal (1 subgoal):
 1. (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
using eqn eq
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. \<Sum>k = 0..<m. X n $$ (i, k) * Y n $$ (k, j)) \<longlonglongrightarrow> (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))
(X ?n * Y ?n) $$ (i, j) = (\<Sum>k = 0..<m. X ?n $$ (i, k) * Y ?n $$ (k, j))
(A * B) $$ (i, j) = (\<Sum>k = 0..<m. A $$ (i, k) * B $$ (k, j))

goal (1 subgoal):
 1. (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A * B) $$ (?i, ?j)

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A * B) $$ (?i, ?j)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A * B) $$ (?i, ?j)

goal (1 subgoal):
 1. limit_mat (\<lambda>k. X k * Y k) (A * B) m
[PROOF STEP]
unfolding limit_mat_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A * B) $$ (?i, ?j)

goal (1 subgoal):
 1. \<forall>n. X n * Y n \<in> carrier_mat m m \<and> A * B \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j))
[PROOF STEP]
using dimXAB
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?i < m; ?j < m\<rbrakk> \<Longrightarrow> (\<lambda>n. (X n * Y n) $$ (?i, ?j)) \<longlonglongrightarrow> (A * B) $$ (?i, ?j)
\<forall>n. X n * Y n \<in> carrier_mat m m \<and> A * B \<in> carrier_mat m m

goal (1 subgoal):
 1. \<forall>n. X n * Y n \<in> carrier_mat m m \<and> A * B \<in> carrier_mat m m \<and> (\<forall>i<m. \<forall>j<m. (\<lambda>n. (X n * Y n) $$ (i, j)) \<longlonglongrightarrow> (A * B) $$ (i, j))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
limit_mat (\<lambda>k. X k * Y k) (A * B) m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sum_distr:
  assumes "finite X"
  shows "(\<Sum>X) \<cdot> (y :: 'a::dioid_one_zero) = \<Sum>{x \<cdot> y|x. x \<in> X}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> X \<cdot> y = \<Sum> {x \<cdot> y |x. x \<in> X}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sum> X \<cdot> y = \<Sum> {x \<cdot> y |x. x \<in> X}
[PROOF STEP]
have "(\<Sum> X) \<cdot> y = \<Sum> ((\<lambda>x. x \<cdot> y) ` X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> X \<cdot> y = \<Sum> ((\<lambda>x. x \<cdot> y) ` X)
[PROOF STEP]
by (rule sum_fun_add, metis assms, rule annil, rule distrib_right)
[PROOF STATE]
proof (state)
this:
\<Sum> X \<cdot> y = \<Sum> ((\<lambda>x. x \<cdot> y) ` X)

goal (1 subgoal):
 1. \<Sum> X \<cdot> y = \<Sum> {x \<cdot> y |x. x \<in> X}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<Sum> X \<cdot> y = \<Sum> ((\<lambda>x. x \<cdot> y) ` X)

goal (1 subgoal):
 1. \<Sum> X \<cdot> y = \<Sum> {x \<cdot> y |x. x \<in> X}
[PROOF STEP]
by (metis Collect_mem_eq fun_im)
[PROOF STATE]
proof (state)
this:
\<Sum> X \<cdot> y = \<Sum> {x \<cdot> y |x. x \<in> X}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma to_poly_add:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier R"
  shows "to_poly (a \<oplus> b) = to_poly a \<oplus>\<^bsub>P\<^esub> to_poly b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_polynomial R (a \<oplus> b) = to_polynomial R a \<oplus>\<^bsub>P\<^esub> to_polynomial R b
[PROOF STEP]
by (simp add: assms(1) assms(2) ring_hom_add to_poly_is_ring_hom)


[STATEMENT]
lemma poly_shift_times_monom_ge:
  "n \<ge> m \<Longrightarrow> poly_shift n (monom c m * p) = smult c (poly_shift (n - m) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> poly_shift n (monom c m * p) = smult c (poly_shift (n - m) p)
[PROOF STEP]
by (intro poly_eqI) (auto simp: coeff_monom_mult coeff_poly_shift)


[STATEMENT]
lemma power_inject_exp_strong [simp]:
  "\<lbrakk>0 < a; (a::'a::{linordered_field}) \<noteq> 1 \<rbrakk>
   \<Longrightarrow> a ^ m = a ^ n \<longleftrightarrow> m = n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) < a; a \<noteq> (1::'a)\<rbrakk> \<Longrightarrow> (a ^ m = a ^ n) = (m = n)
[PROOF STEP]
by (case_tac "a < 1") (auto simp add: not_less)


[STATEMENT]
lemma root_main'_upper:
  "x ^ p \<ge> n \<Longrightarrow> x \<ge> 0 \<Longrightarrow> n \<ge> 0 \<Longrightarrow> root_main' x n = (y,b) \<Longrightarrow> n < (y + 1) ^ p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>n \<le> x ^ p; 0 \<le> x; 0 \<le> n; root_main' x n = (y, b)\<rbrakk> \<Longrightarrow> n < (y + 1) ^ p
[PROOF STEP]
using root_newton_int_main_upper[of n x y b] root_main'[of x n]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n \<le> x ^ p; 0 \<le> x; 0 \<le> n; root_newton_int_main x n = (y, b)\<rbrakk> \<Longrightarrow> n < (y + 1) ^ p
\<lbrakk>0 \<le> x; 0 \<le> n\<rbrakk> \<Longrightarrow> root_main' x n = root_newton_int_main x n

goal (1 subgoal):
 1. \<lbrakk>n \<le> x ^ p; 0 \<le> x; 0 \<le> n; root_main' x n = (y, b)\<rbrakk> \<Longrightarrow> n < (y + 1) ^ p
[PROOF STEP]
by auto


[STATEMENT]
lemma lemVecPlusCommute:
  shows "u \<oplus> v = v \<oplus> u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. u \<oplus> v = v \<oplus> u
[PROOF STEP]
by (simp add: add.commute)


[STATEMENT]
lemma inner_sum_Basis[simp]: "i \<in> Basis \<Longrightarrow> (\<Sum>Basis) \<bullet> i = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<in> Basis \<Longrightarrow> \<Sum> Basis \<bullet> i = 1
[PROOF STEP]
by (simp add: inner_sum_left sum.If_cases inner_Basis)


[STATEMENT]
lemma coprime_diff_one_left_nat [simp]:
  "coprime (n - 1) n" if "n > 0" for n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coprime (n - 1) n
[PROOF STEP]
using that coprime_Suc_right_nat [of "n - 1"]
[PROOF STATE]
proof (prove)
using this:
0 < n
coprime (n - 1) (Suc (n - 1))

goal (1 subgoal):
 1. coprime (n - 1) n
[PROOF STEP]
by simp


[STATEMENT]
lemma range_subsetI:
  fixes x :: "'a :: order"
  assumes xX: "X \<le> x"
  and     yY: "y \<le> Y"
  shows   "{x .. y} \<subseteq> {X .. Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x..y} \<subseteq> {X..Y}
[PROOF STEP]
using xX yY
[PROOF STATE]
proof (prove)
using this:
X \<le> x
y \<le> Y

goal (1 subgoal):
 1. {x..y} \<subseteq> {X..Y}
[PROOF STEP]
by auto


[STATEMENT]
lemma trace_transpose[simp]: "trace (transpose A) = trace A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Square_Matrix.trace (Square_Matrix.transpose A) = Square_Matrix.trace A
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma LIM_imp_LIM:
  fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector"
  fixes g :: "'a::topological_space \<Rightarrow> 'c::real_normed_vector"
  assumes f: "f \<midarrow>a\<rightarrow> l"
    and le: "\<And>x. x \<noteq> a \<Longrightarrow> norm (g x - m) \<le> norm (f x - l)"
  shows "g \<midarrow>a\<rightarrow> m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g \<midarrow>a\<rightarrow> m
[PROOF STEP]
by (rule metric_LIM_imp_LIM [OF f]) (simp add: dist_norm le)


[STATEMENT]
lemma homeomorphic_simply_connected:
    "\<lbrakk>S homeomorphic T; simply_connected S\<rbrakk> \<Longrightarrow> simply_connected T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>S homeomorphic T; simply_connected S\<rbrakk> \<Longrightarrow> simply_connected T
[PROOF STEP]
by (auto simp: homeomorphic_def homeomorphism_def intro: simply_connected_retraction_gen)


[STATEMENT]
lemma powa_indep_incseq_of':
      "\<lbrakk> 1 \<le> a; incseq r;
         (\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x;
         (\<lambda>n. a pow\<^sub>\<rat> (r n)) \<longlonglongrightarrow> y \<rbrakk>
       \<Longrightarrow> (\<lambda>n. a pow\<^sub>\<rat> (incseq_of x n)) \<longlonglongrightarrow> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>1 \<le> a; incseq r; (\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x; (\<lambda>n. a pow\<^sub>\<rat> r n) \<longlonglongrightarrow> y\<rbrakk> \<Longrightarrow> (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y
[PROOF STEP]
using powa_indep_incseq_of [of a r "incseq_of x"] LIMSEQ_powa
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<le> a; incseq r; incseq (incseq_of x); (\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> ?x; (\<lambda>n. real_of_rat (incseq_of x n)) \<longlonglongrightarrow> ?x; (\<lambda>n. a pow\<^sub>\<rat> r n) \<longlonglongrightarrow> ?y; (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> ?z\<rbrakk> \<Longrightarrow> ?y = ?z
1 \<le> ?a \<Longrightarrow> (\<lambda>n. ?a pow\<^sub>\<rat> incseq_of ?x n) \<longlonglongrightarrow> ?a powa ?x

goal (1 subgoal):
 1. \<lbrakk>1 \<le> a; incseq r; (\<lambda>n. real_of_rat (r n)) \<longlonglongrightarrow> x; (\<lambda>n. a pow\<^sub>\<rat> r n) \<longlonglongrightarrow> y\<rbrakk> \<Longrightarrow> (\<lambda>n. a pow\<^sub>\<rat> incseq_of x n) \<longlonglongrightarrow> y
[PROOF STEP]
by fastforce


[STATEMENT]
lemma add_tan_eq: "cos x \<noteq> 0 \<Longrightarrow> cos y \<noteq> 0 \<Longrightarrow> tan x + tan y = sin(x + y)/(cos x * cos y)"
  for x :: "'a::{real_normed_field,banach}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>cos x \<noteq> (0::'a); cos y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> tan x + tan y = sin (x + y) / (cos x * cos y)
[PROOF STEP]
by (simp add: tan_def sin_add field_simps)


[STATEMENT]
lemma (in domain) field_long_division_theorem_shell:
  assumes "subfield K R" "p \<in> carrier (K[X])" and "b \<in> carrier (K[X])" "b \<noteq> \<zero>\<^bsub>K[X]\<^esub>"
  shows "\<exists>q r. q \<in> carrier (K[X]) \<and> r \<in> carrier (K[X]) \<and>
               p = (b \<otimes>\<^bsub>K[X]\<^esub> q) \<oplus>\<^bsub>K[X]\<^esub> r \<and> (r = \<zero>\<^bsub>K[X]\<^esub> \<or> degree r < degree b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q r. q \<in> carrier (K [X]) \<and> r \<in> carrier (K [X]) \<and> p = b \<otimes>\<^bsub>K [X]\<^esub> q \<oplus>\<^bsub>K [X]\<^esub> r \<and> (r = \<zero>\<^bsub>K [X]\<^esub> \<or> degree r < degree b)
[PROOF STEP]
using field_long_division_theorem assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>subfield ?K R; polynomial ?K ?p; polynomial ?K ?b; ?b \<noteq> []\<rbrakk> \<Longrightarrow> \<exists>q r. polynomial ?K q \<and> polynomial ?K r \<and> ?p = ?b \<otimes>\<^bsub>?K [X]\<^esub> q \<oplus>\<^bsub>?K [X]\<^esub> r \<and> (r = [] \<or> degree r < degree ?b)
subfield K R
p \<in> carrier (K [X])
b \<in> carrier (K [X])
b \<noteq> \<zero>\<^bsub>K [X]\<^esub>

goal (1 subgoal):
 1. \<exists>q r. q \<in> carrier (K [X]) \<and> r \<in> carrier (K [X]) \<and> p = b \<otimes>\<^bsub>K [X]\<^esub> q \<oplus>\<^bsub>K [X]\<^esub> r \<and> (r = \<zero>\<^bsub>K [X]\<^esub> \<or> degree r < degree b)
[PROOF STEP]
by (auto simp add: univ_poly_def)


[STATEMENT]
lemma integrable_spike_set:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes f: "f integrable_on S" and neg: "negligible {x \<in> S - T. f x \<noteq> 0}" "negligible {x \<in> T - S. f x \<noteq> 0}"
  shows "f integrable_on T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f integrable_on T
[PROOF STEP]
using has_integral_spike_set_eq [OF neg] f
[PROOF STATE]
proof (prove)
using this:
(f has_integral ?y) S = (f has_integral ?y) T
f integrable_on S

goal (1 subgoal):
 1. f integrable_on T
[PROOF STEP]
by blast


[STATEMENT]
lemma (in product_prob_space) PiM_eq:
  assumes M': "sets M' = sets (PiM I M)"
  assumes eq: "\<And>J F. finite J \<Longrightarrow> J \<subseteq> I \<Longrightarrow> (\<And>j. j \<in> J \<Longrightarrow> F j \<in> sets (M j)) \<Longrightarrow>
    emeasure M' (prod_emb I M J (\<Pi>\<^sub>E j\<in>J. F j)) = (\<Prod>j\<in>J. emeasure (M j) (F j))"
  shows "M' = (PiM I M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M' = Pi\<^sub>M I M
[PROOF STEP]
proof (rule measure_eqI_PiM_infinite[symmetric, OF refl M'])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A J. \<lbrakk>finite J; J \<subseteq> I; \<And>i. i \<in> J \<Longrightarrow> A i \<in> M.events i\<rbrakk> \<Longrightarrow> emeasure (Pi\<^sub>M I M) (emb I J (Pi\<^sub>E J A)) = emeasure M' (emb I J (Pi\<^sub>E J A))
 2. finite_measure (Pi\<^sub>M I M)
[PROOF STEP]
show "finite_measure (Pi\<^sub>M I M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite_measure (Pi\<^sub>M I M)
[PROOF STEP]
by standard (simp add: P.emeasure_space_1)
[PROOF STATE]
proof (state)
this:
finite_measure (Pi\<^sub>M I M)

goal (1 subgoal):
 1. \<And>A J. \<lbrakk>finite J; J \<subseteq> I; \<And>i. i \<in> J \<Longrightarrow> A i \<in> M.events i\<rbrakk> \<Longrightarrow> emeasure (Pi\<^sub>M I M) (emb I J (Pi\<^sub>E J A)) = emeasure M' (emb I J (Pi\<^sub>E J A))
[PROOF STEP]
qed (simp add: eq emeasure_PiM_emb)


[STATEMENT]
lemma pp_surjective_linorder_matrix:
  fixes f :: "('a::finite,'b::non_trivial_linorder_stone_relation_algebra_expansion) square"
  shows "matrix_bounded_idempotent_semiring.surjective (\<ominus>\<ominus>f) \<longleftrightarrow> (\<forall>j . \<exists>i . f (i,j) \<noteq> bot)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_bounded_idempotent_semiring.surjective (\<ominus> \<ominus> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
using matrix_stone_relation_algebra.pp_surjective pp_surjective_linorder_matrix_1
[PROOF STATE]
proof (prove)
using this:
matrix_bounded_idempotent_semiring.surjective (\<ominus> \<ominus> ?x) = matrix_p_algebra.dense (mtop \<odot> ?x)
matrix_p_algebra.dense (mtop \<odot> ?f) = (\<forall>j. \<exists>i. ?f (i, j) \<noteq> bot)

goal (1 subgoal):
 1. matrix_bounded_idempotent_semiring.surjective (\<ominus> \<ominus> f) = (\<forall>j. \<exists>i. f (i, j) \<noteq> bot)
[PROOF STEP]
by auto


[STATEMENT]
lemma mod_homo: "((of_int_mod_ring x)::(('a::prime_card) mod_ring)) = of_int_mod_ring (x mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_int_mod_ring x = of_int_mod_ring (x mod int p)
[PROOF STEP]
using p_def
[PROOF STATE]
proof (prove)
using this:
p = CARD('a)

goal (1 subgoal):
 1. of_int_mod_ring x = of_int_mod_ring (x mod int p)
[PROOF STEP]
unfolding of_int_mod_ring_def
[PROOF STATE]
proof (prove)
using this:
p = CARD('a)

goal (1 subgoal):
 1. (id ---> Abs_mod_ring) (\<lambda>x. x mod int CARD('a)) x = (id ---> Abs_mod_ring) (\<lambda>x. x mod int CARD('a)) (x mod int p)
[PROOF STEP]
by simp


[STATEMENT]
lemma ivl_closure_diff_del:
  assumes "finite s" "a < b"  "(x::real) \<in> {a..b} - s"
  shows "x \<in> closure (({a..b} - s) - {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> closure ({a..b} - s - {x})
[PROOF STEP]
using ivl_limpt_diff islimpt_in_closure assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?s; ?a < ?b; ?x \<in> {?a..?b} - ?s\<rbrakk> \<Longrightarrow> ?x islimpt {?a..?b} - ?s
?x islimpt ?S = (?x \<in> closure (?S - {?x}))
finite s
a < b
x \<in> {a..b} - s

goal (1 subgoal):
 1. x \<in> closure ({a..b} - s - {x})
[PROOF STEP]
by blast


[STATEMENT]
lemma mult_eSuc_right: "m * eSuc n = m + m * n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * eSuc n = m + m * n
[PROOF STEP]
unfolding eSuc_plus_1
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m * (n + 1) = m + m * n
[PROOF STEP]
by (simp add: algebra_simps)


[STATEMENT]
lemma (in infinite_coin_toss_space) nat_filtration_sets:
  shows "sets (nat_filtration n) =
    sigma_sets (space (bernoulli_stream p))
            {pseudo_proj_True n -` B \<inter> space M |B. B \<in> sets (bernoulli_stream p)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sets (nat_filtration n) = sigma_sets (space (bernoulli_stream p)) {pseudo_proj_True n -` B \<inter> space M |B. B \<in> sets (bernoulli_stream p)}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sets (nat_filtration n) = sigma_sets (space (bernoulli_stream p)) {pseudo_proj_True n -` B \<inter> space M |B. B \<in> sets (bernoulli_stream p)}
[PROOF STEP]
have "sigma_sets (space M) {pseudo_proj_True n -` S \<inter> space M |S. S \<in> sets (bernoulli_stream p)} =
    sets (fct_gen_subalgebra M M (pseudo_proj_True n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_sets (space M) {pseudo_proj_True n -` S \<inter> space M |S. S \<in> sets (bernoulli_stream p)} = sets (fct_gen_subalgebra M M (pseudo_proj_True n))
[PROOF STEP]
using bernoulli fct_gen_subalgebra_sets pseudo_proj_True_measurable
[PROOF STATE]
proof (prove)
using this:
M = bernoulli_stream p
sets (fct_gen_subalgebra ?M ?N ?X) = sigma_sets (space ?M) {?X -` B \<inter> space ?M |B. B \<in> sets ?N}
pseudo_proj_True ?n \<in> bernoulli_stream p \<rightarrow>\<^sub>M bernoulli_stream p

goal (1 subgoal):
 1. sigma_sets (space M) {pseudo_proj_True n -` S \<inter> space M |S. S \<in> sets (bernoulli_stream p)} = sets (fct_gen_subalgebra M M (pseudo_proj_True n))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sigma_sets (space M) {pseudo_proj_True n -` S \<inter> space M |S. S \<in> sets (bernoulli_stream p)} = sets (fct_gen_subalgebra M M (pseudo_proj_True n))

goal (1 subgoal):
 1. sets (nat_filtration n) = sigma_sets (space (bernoulli_stream p)) {pseudo_proj_True n -` B \<inter> space M |B. B \<in> sets (bernoulli_stream p)}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
sigma_sets (space M) {pseudo_proj_True n -` S \<inter> space M |S. S \<in> sets (bernoulli_stream p)} = sets (fct_gen_subalgebra M M (pseudo_proj_True n))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sigma_sets (space M) {pseudo_proj_True n -` S \<inter> space M |S. S \<in> sets (bernoulli_stream p)} = sets (fct_gen_subalgebra M M (pseudo_proj_True n))

goal (1 subgoal):
 1. sets (nat_filtration n) = sigma_sets (space (bernoulli_stream p)) {pseudo_proj_True n -` B \<inter> space M |B. B \<in> sets (bernoulli_stream p)}
[PROOF STEP]
using bernoulli nat_filtration_def
[PROOF STATE]
proof (prove)
using this:
sigma_sets (space M) {pseudo_proj_True n -` S \<inter> space M |S. S \<in> sets (bernoulli_stream p)} = sets (fct_gen_subalgebra M M (pseudo_proj_True n))
M = bernoulli_stream p
nat_filtration ?n = fct_gen_subalgebra M M (pseudo_proj_True ?n)

goal (1 subgoal):
 1. sets (nat_filtration n) = sigma_sets (space (bernoulli_stream p)) {pseudo_proj_True n -` B \<inter> space M |B. B \<in> sets (bernoulli_stream p)}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
sets (nat_filtration n) = sigma_sets (space (bernoulli_stream p)) {pseudo_proj_True n -` B \<inter> space M |B. B \<in> sets (bernoulli_stream p)}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma subset_le_dim:
  "S \<subseteq> span T \<Longrightarrow> dim S \<le> dim T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<subseteq> span T \<Longrightarrow> dim S \<le> dim T
[PROOF STEP]
by (metis dim_span dim_subset)


[STATEMENT]
lemma Conf_ChiPlus:
   "\<lbrakk> (T,S) \<in> ChiPlus (HA ST) \<rbrakk> \<Longrightarrow>  S \<in> Conf ST \<longrightarrow> T \<in> Conf ST"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T, S) \<in> ChiPlus (HA ST) \<Longrightarrow> S \<in> Conf ST \<longrightarrow> T \<in> Conf ST
[PROOF STEP]
apply (unfold ChiPlus_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (T, S) \<in> (ChiRel (HA ST))\<^sup>+ \<Longrightarrow> S \<in> Conf ST \<longrightarrow> T \<in> Conf ST
[PROOF STEP]
apply (rule_tac a="T" and b="S" and r="(ChiRel (HA ST))" in trancl_induct)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (T, S) \<in> (ChiRel (HA ST))\<^sup>+ \<Longrightarrow> (T, S) \<in> (ChiRel (HA ST))\<^sup>+
 2. \<And>y. \<lbrakk>(T, S) \<in> (ChiRel (HA ST))\<^sup>+; (T, y) \<in> ChiRel (HA ST)\<rbrakk> \<Longrightarrow> y \<in> Conf ST \<longrightarrow> T \<in> Conf ST
 3. \<And>y z. \<lbrakk>(T, S) \<in> (ChiRel (HA ST))\<^sup>+; (T, y) \<in> (ChiRel (HA ST))\<^sup>+; (y, z) \<in> ChiRel (HA ST); y \<in> Conf ST \<longrightarrow> T \<in> Conf ST\<rbrakk> \<Longrightarrow> z \<in> Conf ST \<longrightarrow> T \<in> Conf ST
[PROOF STEP]
apply (fast intro: Conf_ChiRel)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma enn2ereal_mono [mono_intros]:
  assumes "x \<le> y"
  shows "enn2ereal x \<le> enn2ereal y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. enn2ereal x \<le> enn2ereal y
[PROOF STEP]
using assms less_eq_ennreal.rep_eq
[PROOF STATE]
proof (prove)
using this:
x \<le> y
(?x \<le> ?xa) = (enn2ereal ?x \<le> enn2ereal ?xa)

goal (1 subgoal):
 1. enn2ereal x \<le> enn2ereal y
[PROOF STEP]
by auto


[STATEMENT]
lemma theorem3_restricted_12_part2:
  assumes 1: "\<forall>(A::'a::comm_ring_1 mat) \<in> carrier_mat 1 2. admits_triangular_reduction A"
  shows "\<forall>a b::'a. \<exists> a1 b1 d. a = a1*d \<and> b = b1*d \<and> ideal_generated {a1,b1} = ideal_generated {1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
proof (rule allI)+
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
fix a b::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
let ?A = "Matrix.mat 1 2 (\<lambda>(i,j). if i = 0 \<and> j = 0 then a else b)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
obtain Q where AQ: "lower_triangular (?A*Q)" and inv_Q: "invertible_mat Q"
    and Q: "Q \<in> carrier_mat 2 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>lower_triangular (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q); invertible_mat Q; Q \<in> carrier_mat 2 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using 1
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat 1 2. admits_triangular_reduction A

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>lower_triangular (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q); invertible_mat Q; Q \<in> carrier_mat 2 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding admits_triangular_reduction_def
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>carrier_mat 1 2. \<exists>U. U \<in> carrier_mat (dim_col A) (dim_col A) \<and> invertible_mat U \<and> lower_triangular (A * U)

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>lower_triangular (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q); invertible_mat Q; Q \<in> carrier_mat 2 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
lower_triangular (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q)
invertible_mat Q
Q \<in> carrier_mat 2 2

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
hence [simp]: "dim_col Q = 2" and [simp]: "dim_row Q = 2"
[PROOF STATE]
proof (prove)
using this:
lower_triangular (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q)
invertible_mat Q
Q \<in> carrier_mat 2 2

goal (1 subgoal):
 1. dim_col Q = 2 &&& dim_row Q = 2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
dim_col Q = 2
dim_row Q = 2

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
let ?s = "Q $$ (0,0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
let ?t = "Q $$ (1,0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
let ?a1 = "Q $$ (1,1)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
let ?b1 = "-(Q $$ (0,1))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
let ?d = "(?A*Q) $$ (0,0)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have ab1_ba1: "a*?b1 = b*?a1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
have  "(?A*Q) $$ (0,1) =  (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0))
[PROOF STEP]
unfolding times_mat_def col_def scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (dim_row (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b))) (dim_col Q) (\<lambda>(i, j). \<Sum>ia = 0..<dim_vec (Matrix.vec (dim_row Q) (\<lambda>i. Q $$ (i, j))). Matrix.row (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b)) i $v ia * Matrix.vec (dim_row Q) (\<lambda>i. Q $$ (i, j)) $v ia) $$ (0, 1) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0))

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0))

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
have "... = (\<Sum>i \<in> {0,1}. (if i = 0 then a else b) * Q $$ (i, Suc 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0)) = (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, Suc 0))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0)) = (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, Suc 0))

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, Suc 0)) = (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, Suc 0))

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
have "... = - a*?b1 + b*?a1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, Suc 0)) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, Suc 0)) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)
[PROOF STEP]
have "(?A*Q) $$ (0,1) = - a*?b1 + b*?a1"
[PROOF STATE]
proof (prove)
using this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)

goal (1 subgoal):
 1. (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
have "(?A*Q) $$ (0,1) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (0::'a)
[PROOF STEP]
using AQ
[PROOF STATE]
proof (prove)
using this:
lower_triangular (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q)

goal (1 subgoal):
 1. (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (0::'a)
[PROOF STEP]
unfolding lower_triangular_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i j. i < j \<and> i < dim_row (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) \<and> j < dim_col (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) \<longrightarrow> (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (i, j) = (0::'a)

goal (1 subgoal):
 1. (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (0::'a)

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = - a * - Q $$ (0, 1) + b * Q $$ (1, 1)
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 1) = (0::'a)

goal (1 subgoal):
 1. a * - Q $$ (0, 1) = b * Q $$ (1, 1)
[PROOF STEP]
by (metis add_left_cancel more_arith_simps(3) more_arith_simps(7))
[PROOF STATE]
proof (state)
this:
a * - Q $$ (0, 1) = b * Q $$ (1, 1)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
a * - Q $$ (0, 1) = b * Q $$ (1, 1)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have sa_tb_d: "?s*a+?t*b = ?d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
have "?d = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0))
[PROOF STEP]
unfolding times_mat_def col_def scalar_prod_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Matrix.mat (dim_row (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b))) (dim_col Q) (\<lambda>(i, j). \<Sum>ia = 0..<dim_vec (Matrix.vec (dim_row Q) (\<lambda>i. Q $$ (i, j))). Matrix.row (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b)) i $v ia * Matrix.vec (dim_row Q) (\<lambda>i. Q $$ (i, j)) $v ia) $$ (0, 0) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0))

goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0))

goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
have "... = (\<Sum>i \<in> {0,1}. (if i = 0 then a else b) * Q $$ (i, 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0)) = (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, 0))
[PROOF STEP]
by (rule sum.cong, auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0)) = (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, 0))

goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i = 0..<2. (if i = 0 then a else b) * Q $$ (i, 0)) = (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, 0))

goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
have "... = ?s*a+?t*b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, 0)) = Q $$ (0, 0) * a + Q $$ (1, 0) * b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>{0, 1}. (if i = 0 then a else b) * Q $$ (i, 0)) = Q $$ (0, 0) * a + Q $$ (1, 0) * b

goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = Q $$ (0, 0) * a + Q $$ (1, 0) * b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = Q $$ (0, 0) * a + Q $$ (1, 0) * b

goal (1 subgoal):
 1. Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Q $$ (0, 0) * a + Q $$ (1, 0) * b = (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have det_Q_dvd_1: "(Determinant.det Q dvd 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det Q dvd (1::'a)
[PROOF STEP]
using invertible_iff_is_unit_JNF[OF Q] inv_Q
[PROOF STATE]
proof (prove)
using this:
invertible_mat Q = (Determinant.det Q dvd (1::'a))
invertible_mat Q

goal (1 subgoal):
 1. Determinant.det Q dvd (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Determinant.det Q dvd (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
Determinant.det Q dvd (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have det_Q_eq: "Determinant.det Q = ?s*?a1 + ?t*?b1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Determinant.det Q = Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1)
[PROOF STEP]
unfolding det_2[OF Q]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Q $$ (0, 0) * Q $$ (1, 1) - Q $$ (0, 1) * Q $$ (1, 0) = Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Determinant.det Q = Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
Determinant.det Q dvd (1::'a)
Determinant.det Q = Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1)
[PROOF STEP]
have "?s*?a1 + ?t*?b1 dvd 1"
[PROOF STATE]
proof (prove)
using this:
Determinant.det Q dvd (1::'a)
Determinant.det Q = Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1)

goal (1 subgoal):
 1. Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1) dvd (1::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1) dvd (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1) dvd (1::'a)
[PROOF STEP]
obtain u where u_eq: "?s*?a1 + ?t*?b1 = u" and u: "u dvd 1"
[PROOF STATE]
proof (prove)
using this:
Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1) dvd (1::'a)

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1) = u; u dvd (1::'a)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1) = u
u dvd (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
hence eq1: "?s*?a1*a + ?t*?b1*a = u*a"
[PROOF STATE]
proof (prove)
using this:
Q $$ (0, 0) * Q $$ (1, 1) + Q $$ (1, 0) * - Q $$ (0, 1) = u
u dvd (1::'a)

goal (1 subgoal):
 1. Q $$ (0, 0) * Q $$ (1, 1) * a + Q $$ (1, 0) * - Q $$ (0, 1) * a = u * a
[PROOF STEP]
by (metis ring_class.ring_distribs(2))
[PROOF STATE]
proof (state)
this:
Q $$ (0, 0) * Q $$ (1, 1) * a + Q $$ (1, 0) * - Q $$ (0, 1) * a = u * a

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
hence "?s*?a1*a + ?t*?a1*b = u*a"
[PROOF STATE]
proof (prove)
using this:
Q $$ (0, 0) * Q $$ (1, 1) * a + Q $$ (1, 0) * - Q $$ (0, 1) * a = u * a

goal (1 subgoal):
 1. Q $$ (0, 0) * Q $$ (1, 1) * a + Q $$ (1, 0) * Q $$ (1, 1) * b = u * a
[PROOF STEP]
by (metis (no_types, lifting) ab1_ba1 mult.assoc mult.commute)
[PROOF STATE]
proof (state)
this:
Q $$ (0, 0) * Q $$ (1, 1) * a + Q $$ (1, 0) * Q $$ (1, 1) * b = u * a

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
hence a1d_ua:"?a1*?d=u*a"
[PROOF STATE]
proof (prove)
using this:
Q $$ (0, 0) * Q $$ (1, 1) * a + Q $$ (1, 0) * Q $$ (1, 1) * b = u * a

goal (1 subgoal):
 1. Q $$ (1, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = u * a
[PROOF STEP]
by (smt Groups.mult_ac(2) distrib_left more_arith_simps(11) sa_tb_d)
[PROOF STATE]
proof (state)
this:
Q $$ (1, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = u * a

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
hence b1d_ub: "?b1*?d=u*b"
[PROOF STATE]
proof (prove)
using this:
Q $$ (1, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = u * a

goal (1 subgoal):
 1. - Q $$ (0, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = u * b
[PROOF STEP]
by (smt Groups.mult_ac(2) Groups.mult_ac(3) ab1_ba1 distrib_right sa_tb_d u_eq)
[PROOF STATE]
proof (state)
this:
- Q $$ (0, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = u * b

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
obtain inv_u where inv_u: "inv_u * u = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>inv_u. inv_u * u = (1::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using u
[PROOF STATE]
proof (prove)
using this:
u dvd (1::'a)

goal (1 subgoal):
 1. (\<And>inv_u. inv_u * u = (1::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
\<exists>k. (1::'a) = u * k

goal (1 subgoal):
 1. (\<And>inv_u. inv_u * u = (1::'a) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis mult.commute)
[PROOF STATE]
proof (state)
this:
inv_u * u = (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
hence inv_u_dvd_1: "inv_u dvd 1"
[PROOF STATE]
proof (prove)
using this:
inv_u * u = (1::'a)

goal (1 subgoal):
 1. inv_u dvd (1::'a)
[PROOF STEP]
unfolding dvd_def
[PROOF STATE]
proof (prove)
using this:
inv_u * u = (1::'a)

goal (1 subgoal):
 1. \<exists>k. (1::'a) = inv_u * k
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inv_u dvd (1::'a)

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have cond1: "(inv_u*?b1)*?d = b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_u * - Q $$ (0, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = b
[PROOF STEP]
using b1d_ub inv_u
[PROOF STATE]
proof (prove)
using this:
- Q $$ (0, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = u * b
inv_u * u = (1::'a)

goal (1 subgoal):
 1. inv_u * - Q $$ (0, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = b
[PROOF STEP]
by (metis (no_types, lifting) Groups.mult_ac(3) more_arith_simps(11) more_arith_simps(6))
[PROOF STATE]
proof (state)
this:
inv_u * - Q $$ (0, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = b

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have cond2: "(inv_u*?a1)*?d = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_u * Q $$ (1, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = a
[PROOF STEP]
using a1d_ua inv_u
[PROOF STATE]
proof (prove)
using this:
Q $$ (1, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = u * a
inv_u * u = (1::'a)

goal (1 subgoal):
 1. inv_u * Q $$ (1, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = a
[PROOF STEP]
by (metis (no_types, lifting) Groups.mult_ac(3) more_arith_simps(11) more_arith_simps(6))
[PROOF STATE]
proof (state)
this:
inv_u * Q $$ (1, 1) * (Matrix.mat 1 2 (\<lambda>(i, j). if i = 0 \<and> j = 0 then a else b) * Q) $$ (0, 0) = a

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have "ideal_generated {inv_u*?a1, inv_u*?b1} = ideal_generated {?a1,?b1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal_generated {inv_u * Q $$ (1, 1), inv_u * - Q $$ (0, 1)} = ideal_generated {Q $$ (1, 1), - Q $$ (0, 1)}
[PROOF STEP]
by (rule ideal_generated_mult_unit2[OF inv_u_dvd_1])
[PROOF STATE]
proof (state)
this:
ideal_generated {inv_u * Q $$ (1, 1), inv_u * - Q $$ (0, 1)} = ideal_generated {Q $$ (1, 1), - Q $$ (0, 1)}

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ideal_generated {inv_u * Q $$ (1, 1), inv_u * - Q $$ (0, 1)} = ideal_generated {Q $$ (1, 1), - Q $$ (0, 1)}

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
have "... = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ideal_generated {Q $$ (1, 1), - Q $$ (0, 1)} = UNIV
[PROOF STEP]
using ideal_generated_pair_UNIV[OF u_eq u]
[PROOF STATE]
proof (prove)
using this:
ideal_generated {Q $$ (1, 1), - Q $$ (0, 1)} = UNIV

goal (1 subgoal):
 1. ideal_generated {Q $$ (1, 1), - Q $$ (0, 1)} = UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ideal_generated {Q $$ (1, 1), - Q $$ (0, 1)} = UNIV

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
ideal_generated {inv_u * Q $$ (1, 1), inv_u * - Q $$ (0, 1)} = UNIV
[PROOF STEP]
have cond3: "ideal_generated {inv_u*?a1, inv_u*?b1} = ideal_generated {1}"
[PROOF STATE]
proof (prove)
using this:
ideal_generated {inv_u * Q $$ (1, 1), inv_u * - Q $$ (0, 1)} = UNIV

goal (1 subgoal):
 1. ideal_generated {inv_u * Q $$ (1, 1), inv_u * - Q $$ (0, 1)} = ideal_generated {1::'a}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ideal_generated {inv_u * Q $$ (1, 1), inv_u * - Q $$ (0, 1)} = ideal_generated {1::'a}

goal (1 subgoal):
 1. \<And>a b. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
show "\<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}
[PROOF STEP]
by (rule exI[of _ "inv_u*?a1"], rule exI[of _ "inv_u*?b1"], rule exI[of _ ?d],
        insert cond1 cond2 cond3, auto)
[PROOF STATE]
proof (state)
this:
\<exists>a1 b1 d. a = a1 * d \<and> b = b1 * d \<and> ideal_generated {a1, b1} = ideal_generated {1::'a}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_less_omega [simp]: "0 < \<omega>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < \<omega>
[PROOF STEP]
by (cut_tac n=0 in nat_less_omega, simp)


[STATEMENT]
lemma nasc_seq_mem:"\<lbrakk>(a::nat) \<in> A; \<not> (\<exists>m. m\<in>A \<and> (\<forall>x\<in>A. x \<le> m))\<rbrakk> \<Longrightarrow>
                        (nasc_seq A a n) \<in> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m)\<rbrakk> \<Longrightarrow> nasc_seq A a n \<in> A
[PROOF STEP]
apply (induct n)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m)\<rbrakk> \<Longrightarrow> nasc_seq A a 0 \<in> A
 2. \<And>n. \<lbrakk>\<lbrakk>a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m)\<rbrakk> \<Longrightarrow> nasc_seq A a n \<in> A; a \<in> A; \<nexists>m. m \<in> A \<and> (\<forall>x\<in>A. x \<le> m)\<rbrakk> \<Longrightarrow> nasc_seq A a (Suc n) \<in> A
[PROOF STEP]
apply (simp_all add: not_le)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>nasc_seq A a n \<in> A; a \<in> A; \<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x)\<rbrakk> \<Longrightarrow> (SOME b. b \<in> A \<and> nasc_seq A a n < b) \<in> A
[PROOF STEP]
apply (subgoal_tac "\<exists>x\<in>A. (nasc_seq A a n) < x")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>nasc_seq A a n \<in> A; a \<in> A; \<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x); \<exists>x\<in>A. nasc_seq A a n < x\<rbrakk> \<Longrightarrow> (SOME b. b \<in> A \<and> nasc_seq A a n < b) \<in> A
 2. \<And>n. \<lbrakk>nasc_seq A a n \<in> A; a \<in> A; \<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x)\<rbrakk> \<Longrightarrow> \<exists>x\<in>A. nasc_seq A a n < x
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>nasc_seq A a n \<in> A; a \<in> A; \<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x)\<rbrakk> \<Longrightarrow> \<exists>x\<in>A. nasc_seq A a n < x
 2. \<And>n. \<lbrakk>nasc_seq A a n \<in> A; a \<in> A; \<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x); \<exists>x\<in>A. nasc_seq A a n < x\<rbrakk> \<Longrightarrow> (SOME b. b \<in> A \<and> nasc_seq A a n < b) \<in> A
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>nasc_seq A a n \<in> A; a \<in> A; \<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x); \<exists>x\<in>A. nasc_seq A a n < x\<rbrakk> \<Longrightarrow> (SOME b. b \<in> A \<and> nasc_seq A a n < b) \<in> A
[PROOF STEP]
apply (thin_tac "\<forall>m. m \<in> A \<longrightarrow> (\<exists>x\<in>A. m < x)",
        rule someI2_ex, blast, simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma to_int_mod_ring_times: "to_int_mod_ring ((x :: 'a mod_ring) * y) = (to_int_mod_ring x * to_int_mod_ring y) mod m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. to_int_mod_ring (x * y) = to_int_mod_ring x * to_int_mod_ring y mod m
[PROOF STEP]
using m
[PROOF STATE]
proof (prove)
using this:
m = int CARD('a)

goal (1 subgoal):
 1. to_int_mod_ring (x * y) = to_int_mod_ring x * to_int_mod_ring y mod m
[PROOF STEP]
by (transfer, auto)


[STATEMENT]
lemma carrier_reduced_homology_group:
   "carrier (reduced_homology_group p X) =
    kernel (homology_group p X) (homology_group p (discrete_topology {()}))
           (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))"
    (is "_ = kernel ?G ?H ?h")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (reduced_homology_group p X) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier (reduced_homology_group p X) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))
[PROOF STEP]
interpret subgroup "kernel ?G ?H ?h" ?G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup (kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))) (homology_group p X)
[PROOF STEP]
by (simp add: hom_induced_empty_hom group_hom_axioms_def group_hom_def group_hom.subgroup_kernel)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. carrier (reduced_homology_group p X) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (reduced_homology_group p X) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))
[PROOF STEP]
unfolding reduced_homology_group_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. carrier (subgroup_generated (homology_group p X) (kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ())))) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))
[PROOF STEP]
using carrier_subgroup_generated_subgroup
[PROOF STATE]
proof (prove)
using this:
carrier (subgroup_generated (homology_group p X) (kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ())))) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))

goal (1 subgoal):
 1. carrier (subgroup_generated (homology_group p X) (kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ())))) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
carrier (reduced_homology_group p X) = kernel (homology_group p X) (homology_group p (discrete_topology {()})) (hom_induced p X {} (discrete_topology {()}) {} (\<lambda>x. ()))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma numeral_mult_ennreal: "0 \<le> x \<Longrightarrow> numeral b * ennreal x = ennreal (numeral b * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> x \<Longrightarrow> numeral b * ennreal x = ennreal (numeral b * x)
[PROOF STEP]
by (simp add: ennreal_mult)


[STATEMENT]
lemma collinear_closed_segment [simp]: "collinear (closed_segment a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. collinear (closed_segment a b)
[PROOF STEP]
by (metis affine_hull_convex_hull collinear_affine_hull hull_subset segment_convex_hull)


[STATEMENT]
lemma coprime_bezout_strong:
  fixes a::nat assumes "coprime a b"  "b \<noteq> 1"
  shows "\<exists>x y. a * x = b * y + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x y. a * x = b * y + 1
[PROOF STEP]
by (metis add.commute add.right_neutral assms(1) assms(2) chinese_remainder coprime_1_left coprime_1_right coprime_crossproduct_nat mult.commute mult.right_neutral mult_cancel_left)


[STATEMENT]
lemma snd_quot_of_fract_Fract_whole:
  assumes "y dvd x"
  shows   "snd (quot_of_fract (Fract x y)) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (quot_of_fract (Fract x y)) = (1::'a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
y dvd x

goal (1 subgoal):
 1. snd (quot_of_fract (Fract x y)) = (1::'a)
[PROOF STEP]
by transfer (auto simp: normalize_quot_def Let_def gcd_proj2_if_dvd)


[STATEMENT]
lemma power_sub_int:
  "\<lbrakk> m \<le> n; 0 < b \<rbrakk> \<Longrightarrow> b ^ n div b ^ m = (b ^ (n - m) :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; 0 < b\<rbrakk> \<Longrightarrow> b ^ n div b ^ m = b ^ (n - m)
[PROOF STEP]
apply (subgoal_tac "\<exists>n'. n = m + n'")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>m \<le> n; 0 < b; \<exists>n'. n = m + n'\<rbrakk> \<Longrightarrow> b ^ n div b ^ m = b ^ (n - m)
 2. \<lbrakk>m \<le> n; 0 < b\<rbrakk> \<Longrightarrow> \<exists>n'. n = m + n'
[PROOF STEP]
apply (clarsimp simp: power_add)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; 0 < b\<rbrakk> \<Longrightarrow> \<exists>n'. n = m + n'
[PROOF STEP]
apply (rule exI[where x="n - m"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>m \<le> n; 0 < b\<rbrakk> \<Longrightarrow> n = m + (n - m)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma scaleR_le_cancel_left_pos: "0 < c \<Longrightarrow> c *\<^sub>R a \<le> c *\<^sub>R b \<longleftrightarrow> a \<le> b"
  for b :: "'a::ordered_real_vector"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < c \<Longrightarrow> (c *\<^sub>R a \<le> c *\<^sub>R b) = (a \<le> b)
[PROOF STEP]
by (auto simp: scaleR_le_cancel_left)


[STATEMENT]
lemma [code]:
  \<open>k XOR l = (if k = - 1 then NOT l else if l = - 1 then NOT k else if k = 0 then l else if l = 0 then k
    else \<bar>k mod 2 - l mod 2\<bar> + 2 * ((k div 2) XOR (l div 2)))\<close> for k l :: integer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k XOR l = (if k = - 1 then NOT l else if l = - 1 then NOT k else if k = 0 then l else if l = 0 then k else \<bar>k mod 2 - l mod 2\<bar> + 2 * (k div 2 XOR l div 2))
[PROOF STEP]
by transfer (fact xor_int_unfold)


[STATEMENT]
lemma divide_mk_dimvec [code, si_def]:
  "(mk_dimvec xs / mk_dimvec ys :: ('n::ring_1, 'a::enum) dimvec) =
  (if (length xs = CARD('a) \<and> length ys = CARD('a))
    then mk_dimvec (map (\<lambda> (x, y). x - y) (zip xs ys))
    else if length ys = CARD('a) then mk_dimvec (map uminus ys) else mk_dimvec xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_dimvec xs / mk_dimvec ys = (if length xs = CARD('a) \<and> length ys = CARD('a) then mk_dimvec (map2 (-) xs ys) else if length ys = CARD('a) then mk_dimvec (map uminus ys) else mk_dimvec xs)
[PROOF STEP]
by (auto simp add: divide_dimvec_def inverse_mk_dimvec times_mk_dimvec zip_map_map[where f="id", simplified] comp_def split_beta')


[STATEMENT]
lemma in_Basis_prod_iff:
  fixes i::"'a::euclidean_space*'b::euclidean_space"
  shows "i \<in> Basis \<longleftrightarrow> fst i = 0 \<and> snd i \<in> Basis \<or> snd i = 0 \<and> fst i \<in> Basis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (i \<in> Basis) = (fst i = (0::'a) \<and> snd i \<in> Basis \<or> snd i = (0::'b) \<and> fst i \<in> Basis)
[PROOF STEP]
by (cases i) (auto simp: Basis_prod_def)


[STATEMENT]
lemma lattice_of_append_zero_rows:
  assumes H': "H' \<in> carrier_mat m n"
  and H: "H = H' @\<^sub>r (0\<^sub>m m n)"
shows "lattice_of (Matrix.rows H) = lattice_of (Matrix.rows H')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of (rows H) = lattice_of (rows H')
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lattice_of (rows H) = lattice_of (rows H')
[PROOF STEP]
have "Matrix.rows H = Matrix.rows H' @ Matrix.rows (0\<^sub>m m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rows H = rows H' @ rows (0\<^sub>m m n)
[PROOF STEP]
by (unfold H, rule rows_append_rows[OF H'], auto)
[PROOF STATE]
proof (state)
this:
rows H = rows H' @ rows (0\<^sub>m m n)

goal (1 subgoal):
 1. lattice_of (rows H) = lattice_of (rows H')
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
rows H = rows H' @ rows (0\<^sub>m m n)

goal (1 subgoal):
 1. lattice_of (rows H) = lattice_of (rows H')
[PROOF STEP]
have "lattice_of ... = lattice_of (Matrix.rows H')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of (rows H' @ rows (0\<^sub>m m n)) = lattice_of (rows H')
[PROOF STEP]
proof (rule already_in_lattice_append[symmetric])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. set (rows H') \<subseteq> carrier_vec n
 2. lattice_of (rows (0\<^sub>m m n)) \<subseteq> lattice_of (rows H')
 3. set (rows (0\<^sub>m m n)) \<subseteq> carrier_vec n
[PROOF STEP]
show "lattice_of (Matrix.rows (0\<^sub>m m n)) \<subseteq> lattice_of (Matrix.rows H')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lattice_of (rows (0\<^sub>m m n)) \<subseteq> lattice_of (rows H')
[PROOF STEP]
by (rule lattice_zero_rows_subset[OF H'])
[PROOF STATE]
proof (state)
this:
lattice_of (rows (0\<^sub>m m n)) \<subseteq> lattice_of (rows H')

goal (2 subgoals):
 1. set (rows H') \<subseteq> carrier_vec n
 2. set (rows (0\<^sub>m m n)) \<subseteq> carrier_vec n
[PROOF STEP]
qed (insert H', auto simp add: Matrix.rows_def)
[PROOF STATE]
proof (state)
this:
lattice_of (rows H' @ rows (0\<^sub>m m n)) = lattice_of (rows H')

goal (1 subgoal):
 1. lattice_of (rows H) = lattice_of (rows H')
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
lattice_of (rows H) = lattice_of (rows H')
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lattice_of (rows H) = lattice_of (rows H')

goal (1 subgoal):
 1. lattice_of (rows H) = lattice_of (rows H')
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
lattice_of (rows H) = lattice_of (rows H')

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nonpos_Reals_pow_I: "\<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; odd n\<rbrakk> \<Longrightarrow> a^n \<in> \<real>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; odd n\<rbrakk> \<Longrightarrow> a ^ n \<in> \<real>\<^sub>\<le>\<^sub>0
[PROOF STEP]
by (metis nonneg_Reals_pow_I power_minus_odd uminus_nonneg_Reals_iff)


[STATEMENT]
lemma coeff_poly_times_one_minus_x:
  fixes g :: "'a :: linordered_idom poly"
  shows "coeff g n = (\<Sum>i\<le>n. coeff (g * [:1, -1:]) i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff g n = sum (coeff (g * [:1::'a, - (1::'a):])) {..n}
[PROOF STEP]
by (induction n) simp_all


[STATEMENT]
lemma rbt_sorted_entries_right_unique:
  "\<lbrakk> (k, v) \<in> set (entries t); (k, v') \<in> set (entries t);
     rbt_sorted t \<rbrakk> \<Longrightarrow> v = v'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(k, v) \<in> set (entries t); (k, v') \<in> set (entries t); rbt_sorted t\<rbrakk> \<Longrightarrow> v = v'
[PROOF STEP]
by(auto dest!: distinct_entries inj_onD[where x="(k, v)" and y="(k, v')"] simp add: distinct_map)


[STATEMENT]
lemma powsum_split_var2 [simp]: "x\<^bsup>m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsup>m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup>
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x\<^bsup>0\<^esup> + x\<^bsub>0\<^esub>\<^bsup>0\<^esup> = x\<^bsub>0\<^esub>\<^bsup>0\<^esup>
 2. \<And>m. x\<^bsup>m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<Longrightarrow> x\<^bsup>Suc m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup>
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. x\<^bsup>0\<^esup> + x\<^bsub>0\<^esub>\<^bsup>0\<^esup> = x\<^bsub>0\<^esub>\<^bsup>0\<^esup>
 2. \<And>m. x\<^bsup>m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<Longrightarrow> x\<^bsup>Suc m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsup>0\<^esup> + x\<^bsub>0\<^esub>\<^bsup>0\<^esup> = x\<^bsub>0\<^esub>\<^bsup>0\<^esup>
[PROOF STEP]
by (metis add_idem' power_0 powsum_00)
[PROOF STATE]
proof (state)
this:
x\<^bsup>0\<^esup> + x\<^bsub>0\<^esub>\<^bsup>0\<^esup> = x\<^bsub>0\<^esub>\<^bsup>0\<^esup>

goal (1 subgoal):
 1. \<And>m. x\<^bsup>m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<Longrightarrow> x\<^bsup>Suc m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup>
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
x\<^bsup>n\<^esup> + x\<^bsub>0\<^esub>\<^bsup>n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>n\<^esup>

goal (1 subgoal):
 1. \<And>m. x\<^bsup>m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>m\<^esup> \<Longrightarrow> x\<^bsup>Suc m\<^esup> + x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc m\<^esup>
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^bsup>Suc n\<^esup> + x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>
[PROOF STEP]
by (simp add: add_commute powsum2)
[PROOF STATE]
proof (state)
this:
x\<^bsup>Suc n\<^esup> + x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup> = x\<^bsub>0\<^esub>\<^bsup>Suc n\<^esup>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inits_append [simp]: "inits (xs @ ys) = inits xs @ map ((@) xs) (inits ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inits (xs @ ys) = inits xs @ map ((@) xs) (inits ys)
[PROOF STEP]
by(induction xs) (simp_all)


[STATEMENT]
lemma complex_div_cnj: "a / b = (a * cnj b) / (norm b)\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a / b = a * cnj b / complex_of_real ((cmod b)\<^sup>2)
[PROOF STEP]
using complex_norm_square
[PROOF STATE]
proof (prove)
using this:
complex_of_real ((cmod ?z)\<^sup>2) = ?z * cnj ?z

goal (1 subgoal):
 1. a / b = a * cnj b / complex_of_real ((cmod b)\<^sup>2)
[PROOF STEP]
by auto


[STATEMENT]
lemma one_strongly_connected_iff_4_eq:
  "one_strongly_connected x \<longleftrightarrow> x\<^sup>T;1;x = x\<^sup>+"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_strongly_connected x = (x\<^sup>T ; 1 ; x = x\<^sup>+)
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. one_strongly_connected x \<Longrightarrow> x\<^sup>T ; 1 ; x = x\<^sup>+
 2. x\<^sup>T ; 1 ; x = x\<^sup>+ \<Longrightarrow> one_strongly_connected x
[PROOF STEP]
apply (metis comp_assoc top_plus many_strongly_connected_iff_7 one_strongly_connected_iff
              one_strongly_connected_iff_1_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x\<^sup>T ; 1 ; x = x\<^sup>+ \<Longrightarrow> one_strongly_connected x
[PROOF STEP]
by (metis comp_assoc conv_contrav conv_invol conv_one plus_conv top_plus
          one_strongly_connected_iff_1_eq)


[STATEMENT]
lemma ball_in_set_subarray_conv: "(\<forall>j \<in> set (subarray l r a h). P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < Array.length h a \<longrightarrow> P (Array.get h a ! k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<in>set (subarray l r a h). P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < Array.length h a \<longrightarrow> P (Array.get h a ! k))
[PROOF STEP]
unfolding subarray_def Array.length_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>j\<in>set (nths' l r (Array.get h a)). P j) = (\<forall>k. l \<le> k \<and> k < r \<and> k < length (Array.get h a) \<longrightarrow> P (Array.get h a ! k))
[PROOF STEP]
by (rule ball_in_set_nths'_conv)


[STATEMENT]
lemma tendsto_complex_of_real_iff: "((\<lambda>x. complex_of_real (f x)) \<longlongrightarrow> of_real c) F = (f \<longlongrightarrow> c) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. complex_of_real (f x)) \<longlongrightarrow> complex_of_real c) F = (f \<longlongrightarrow> c) F
[PROOF STEP]
by (rule tendsto_of_real_iff)


[STATEMENT]
lemma list_rel_pred_zip: "list_all2 P xs ys \<longleftrightarrow> length xs = length ys \<and> list_all (case_prod P) (xs || ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 P xs ys = (length xs = length ys \<and> list_all (\<lambda>(x, y). P x y) (xs || ys))
[PROOF STEP]
unfolding list_all2_conv_all_nth list_all_length
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (length xs = length ys \<and> (\<forall>i<length xs. P (xs ! i) (ys ! i))) = (length xs = length ys \<and> (\<forall>n<length (xs || ys). case (xs || ys) ! n of (x, xa) \<Rightarrow> P x xa))
[PROOF STEP]
by auto


[STATEMENT]
lemma pvar_poly_function_tuple_comp_is_semialg:
  assumes "n > 0"
  assumes "is_semialg_function_tuple n fs"
  assumes "i < length fs"
  shows "is_semialg_function n (poly_function_tuple_comp Q\<^sub>p n fs (pvar Q\<^sub>p i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_semialg_function n (poly_function_tuple_comp Q\<^sub>p n fs (pvar Q\<^sub>p i))
[PROOF STEP]
apply(rule semialg_function_on_carrier[of n "fs!i"])
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. is_semialg_function n (fs ! i)
 2. restrict (fs ! i) (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) = restrict (poly_function_tuple_comp Q\<^sub>p n fs (pvar Q\<^sub>p i)) (carrier (Q\<^sub>p\<^bsup>n\<^esup>))
[PROOF STEP]
using assms(2) assms(3) is_semialg_function_tupleE
[PROOF STATE]
proof (prove)
using this:
is_semialg_function_tuple n fs
i < length fs
\<lbrakk>is_semialg_function_tuple ?n ?fs; ?i < length ?fs\<rbrakk> \<Longrightarrow> is_semialg_function ?n (?fs ! ?i)

goal (2 subgoals):
 1. is_semialg_function n (fs ! i)
 2. restrict (fs ! i) (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) = restrict (poly_function_tuple_comp Q\<^sub>p n fs (pvar Q\<^sub>p i)) (carrier (Q\<^sub>p\<^bsup>n\<^esup>))
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. restrict (fs ! i) (carrier (Q\<^sub>p\<^bsup>n\<^esup>)) = restrict (poly_function_tuple_comp Q\<^sub>p n fs (pvar Q\<^sub>p i)) (carrier (Q\<^sub>p\<^bsup>n\<^esup>))
[PROOF STEP]
by (metis assms(2) assms(3) poly_function_tuple_comp_pvar
      restrict_ext semialg_function_tuple_is_function_tuple)


[STATEMENT]
lemma ereal_add_strict_mono2:
  fixes a b c d :: ereal
  assumes "a < b" and "c < d"
  shows "a + c < b + d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a + c < b + d
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a < b
c < d

goal (1 subgoal):
 1. a + c < b + d
[PROOF STEP]
by (cases a; force simp add: elim: less_ereal.elims)