[STATEMENT]
lemma UINF_upto_expand_first:
  "m < n \<Longrightarrow> (\<Sqinter> i \<in> {m..<n} \<bullet> P(i)) = ((P(m) :: '\<alpha> upred) \<or> (\<Sqinter> i \<in> {Suc m..<n} \<bullet> P(i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m < n \<Longrightarrow> (\<Sqinter> i \<in> {m..<n} \<bullet> P i) = (P m \<or> (\<Sqinter> i \<in> {Suc m..<n} \<bullet> P i))
[PROOF STEP]
apply (rel_auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>b x. \<lbrakk>\<lbrakk>P x\<rbrakk>\<^sub>e b; m \<le> x; x < n; \<forall>x\<ge>Suc m. \<lbrakk>P x\<rbrakk>\<^sub>e b \<longrightarrow> \<not> x < n\<rbrakk> \<Longrightarrow> \<lbrakk>P m\<rbrakk>\<^sub>e b
[PROOF STEP]
using Suc_leI le_eq_less_or_eq
[PROOF STATE]
proof (prove)
using this:
?m < ?n \<Longrightarrow> Suc ?m \<le> ?n
(?m \<le> ?n) = (?m < ?n \<or> ?m = ?n)

goal (1 subgoal):
 1. \<And>b x. \<lbrakk>\<lbrakk>P x\<rbrakk>\<^sub>e b; m \<le> x; x < n; \<forall>x\<ge>Suc m. \<lbrakk>P x\<rbrakk>\<^sub>e b \<longrightarrow> \<not> x < n\<rbrakk> \<Longrightarrow> \<lbrakk>P m\<rbrakk>\<^sub>e b
[PROOF STEP]
by auto


[STATEMENT]
lemma lm021:
  assumes "finite X" "mx \<in> X" "\<forall>x \<in> X-{mx}. f x < f mx"
  shows "argmax f X \<subseteq> {mx}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. argmax f X \<subseteq> {mx}
[PROOF STEP]
using assms mk_disjoint_insert
[PROOF STATE]
proof (prove)
using this:
finite X
mx \<in> X
\<forall>x\<in>X - {mx}. f x < f mx
?a \<in> ?A \<Longrightarrow> \<exists>B. ?A = insert ?a B \<and> ?a \<notin> B

goal (1 subgoal):
 1. argmax f X \<subseteq> {mx}
[PROOF STEP]
by force


[STATEMENT]
theorem sorted_ghc_sort:
  "sorted (ghc_sort xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (ghc_sort xs)
[PROOF STEP]
unfolding ghc_sort_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (merge_list [] (map (\<lambda>ys. if decr ys then rev ys else ys) (cuts xs)))
[PROOF STEP]
using reverse_phase_sorted
[PROOF STATE]
proof (prove)
using this:
Ball (set (map (\<lambda>ys. if decr ys then rev ys else ys) (cuts ?xs))) sorted

goal (1 subgoal):
 1. sorted (merge_list [] (map (\<lambda>ys. if decr ys then rev ys else ys) (cuts xs)))
[PROOF STEP]
by (intro merge_list_correct[THEN conjunct1]) auto


[STATEMENT]
lemma weak_ranking_of_weak_ranking:
  assumes "is_finite_weak_ranking xs"
  shows   "weak_ranking (of_weak_ranking xs) = xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. weak_ranking (of_weak_ranking xs) = xs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_ranking (of_weak_ranking xs) = xs
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_finite_weak_ranking xs
[PROOF STEP]
interpret finite_total_preorder_on "\<Union>(set xs)" "of_weak_ranking xs"
[PROOF STATE]
proof (prove)
using this:
is_finite_weak_ranking xs

goal (1 subgoal):
 1. finite_total_preorder_on (\<Union> (set xs)) (of_weak_ranking xs)
[PROOF STEP]
by (intro finite_total_preorder_of_weak_ranking) simp_all
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. weak_ranking (of_weak_ranking xs) = xs
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
is_finite_weak_ranking xs
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
is_finite_weak_ranking xs

goal (1 subgoal):
 1. weak_ranking (of_weak_ranking xs) = xs
[PROOF STEP]
by (intro sym[OF weak_ranking_unique]) (simp_all add: is_finite_weak_ranking_def)
[PROOF STATE]
proof (state)
this:
weak_ranking (of_weak_ranking xs) = xs

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in ordered_comm_monoid_add) positive_sum:
  assumes X : "finite X"
      and "f : X \<rightarrow> { y :: 'a. y \<ge> 0 }"
  shows "sum f X \<ge> 0 \<and> (sum f X = 0 \<longrightarrow> f ` X \<subseteq> {0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> sum f X \<and> (sum f X = (0::'a) \<longrightarrow> f ` X \<subseteq> {0::'a})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite X
f \<in> X \<rightarrow> {y. (0::'a) \<le> y}

goal (1 subgoal):
 1. (0::'a) \<le> sum f X \<and> (sum f X = (0::'a) \<longrightarrow> f ` X \<subseteq> {0::'a})
[PROOF STEP]
proof (induct set:finite)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
case (insert x X)
[PROOF STATE]
proof (state)
this:
finite X
x \<notin> X
f \<in> X \<rightarrow> {a. (0::'a) \<le> a} \<Longrightarrow> (0::'a) \<le> sum f X \<and> (sum f X = (0::'a) \<longrightarrow> f ` X \<subseteq> {0::'a})
f \<in> insert x X \<rightarrow> {a. (0::'a) \<le> a}

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
hence x0: "f x \<ge> 0" and sum0: "sum f X \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
finite X
x \<notin> X
f \<in> X \<rightarrow> {a. (0::'a) \<le> a} \<Longrightarrow> (0::'a) \<le> sum f X \<and> (sum f X = (0::'a) \<longrightarrow> f ` X \<subseteq> {0::'a})
f \<in> insert x X \<rightarrow> {a. (0::'a) \<le> a}

goal (1 subgoal):
 1. (0::'a) \<le> f x &&& (0::'a) \<le> sum f X
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> f x
(0::'a) \<le> sum f X

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
hence "sum f (insert x X) \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> f x
(0::'a) \<le> sum f X

goal (1 subgoal):
 1. (0::'a) \<le> sum f (insert x X)
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> f x
(0::'a) \<le> sum f X
finite X
x \<notin> X
f \<in> X \<rightarrow> {a. (0::'a) \<le> a} \<Longrightarrow> (0::'a) \<le> sum f X \<and> (sum f X = (0::'a) \<longrightarrow> f ` X \<subseteq> {0::'a})
f \<in> insert x X \<rightarrow> {a. (0::'a) \<le> a}

goal (1 subgoal):
 1. (0::'a) \<le> sum f (insert x X)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum f (insert x X)

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum f (insert x X)

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum f (insert x X)

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
assume "sum f (insert x X) = 0"
[PROOF STATE]
proof (state)
this:
sum f (insert x X) = (0::'a)

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
hence "f x = 0" "sum f X = 0"
[PROOF STATE]
proof (prove)
using this:
sum f (insert x X) = (0::'a)

goal (1 subgoal):
 1. f x = (0::'a) &&& sum f X = (0::'a)
[PROOF STEP]
using sum0 x0 insert add_nonneg_eq_0_iff
[PROOF STATE]
proof (prove)
using this:
sum f (insert x X) = (0::'a)
(0::'a) \<le> sum f X
(0::'a) \<le> f x
finite X
x \<notin> X
f \<in> X \<rightarrow> {a. (0::'a) \<le> a} \<Longrightarrow> (0::'a) \<le> sum f X \<and> (sum f X = (0::'a) \<longrightarrow> f ` X \<subseteq> {0::'a})
f \<in> insert x X \<rightarrow> {a. (0::'a) \<le> a}
\<lbrakk>(0::'a) \<le> ?x; (0::'a) \<le> ?y\<rbrakk> \<Longrightarrow> (?x + ?y = (0::'a)) = (?x = (0::'a) \<and> ?y = (0::'a))

goal (1 subgoal):
 1. f x = (0::'a) &&& sum f X = (0::'a)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f x = (0::'a)
sum f X = (0::'a)

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
sum f (insert x X) = (0::'a) \<Longrightarrow> f x = (0::'a)
sum f (insert x X) = (0::'a) \<Longrightarrow> sum f X = (0::'a)

goal (2 subgoals):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; f \<in> F \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f F \<and> (sum f F = (0::'a) \<longrightarrow> f ` F \<subseteq> {0::'a}); f \<in> insert x F \<rightarrow> Collect ((\<le>) (0::'a))\<rbrakk> \<Longrightarrow> (0::'a) \<le> sum f (insert x F) \<and> (sum f (insert x F) = (0::'a) \<longrightarrow> f ` insert x F \<subseteq> {0::'a})
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(0::'a) \<le> sum f (insert x X)
sum f (insert x X) = (0::'a) \<Longrightarrow> f x = (0::'a)
sum f (insert x X) = (0::'a) \<Longrightarrow> sum f X = (0::'a)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> sum f (insert x X)
sum f (insert x X) = (0::'a) \<Longrightarrow> f x = (0::'a)
sum f (insert x X) = (0::'a) \<Longrightarrow> sum f X = (0::'a)

goal (1 subgoal):
 1. (0::'a) \<le> sum f (insert x X) \<and> (sum f (insert x X) = (0::'a) \<longrightarrow> f ` insert x X \<subseteq> {0::'a})
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
(0::'a) \<le> sum f (insert x X)
sum f (insert x X) = (0::'a) \<Longrightarrow> f x = (0::'a)
sum f (insert x X) = (0::'a) \<Longrightarrow> sum f X = (0::'a)
finite X
x \<notin> X
f \<in> X \<rightarrow> {a. (0::'a) \<le> a} \<Longrightarrow> (0::'a) \<le> sum f X \<and> (sum f X = (0::'a) \<longrightarrow> f ` X \<subseteq> {0::'a})
f \<in> insert x X \<rightarrow> {a. (0::'a) \<le> a}

goal (1 subgoal):
 1. (0::'a) \<le> sum f (insert x X) \<and> (sum f (insert x X) = (0::'a) \<longrightarrow> f ` insert x X \<subseteq> {0::'a})
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(0::'a) \<le> sum f (insert x X) \<and> (sum f (insert x X) = (0::'a) \<longrightarrow> f ` insert x X \<subseteq> {0::'a})

goal (1 subgoal):
 1. f \<in> {} \<rightarrow> Collect ((\<le>) (0::'a)) \<Longrightarrow> (0::'a) \<le> sum f {} \<and> (sum f {} = (0::'a) \<longrightarrow> f ` {} \<subseteq> {0::'a})
[PROOF STEP]
qed auto


[STATEMENT]
lemma cat_obj_prod_2_ex_is_iso_arr:
  assumes "\<pi> : P <\<^sub>C\<^sub>F\<^sub>.\<^sub>\<times> {a,b} : 2\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "\<pi>' : P' <\<^sub>C\<^sub>F\<^sub>.\<^sub>\<times> {a,b} : 2\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  obtains f where "f : P' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> P" and "\<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : P' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> P; \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : P' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> P; \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret \<pi>: is_cat_obj_prod_2 \<alpha> a b \<CC> P \<pi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi> : P <\<^sub>C\<^sub>F\<^sub>.\<^sub>\<times> {a,b} : 2\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : P' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> P; \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret \<pi>': is_cat_obj_prod_2 \<alpha> a b \<CC> P' \<pi>'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<pi>' : P' <\<^sub>C\<^sub>F\<^sub>.\<^sub>\<times> {a,b} : 2\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : P' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> P; \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?f : P' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> P; \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> ?f\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f : P' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> P; \<pi>' = \<pi> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (:\<^sub>C (2\<^sub>\<nat>)) \<CC> ?f\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by
      (
        elim cat_obj_prod_ex_is_iso_arr[
          OF \<pi>.is_cat_obj_prod_axioms \<pi>'.is_cat_obj_prod_axioms
          ]
      )
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma det_Gauss_Jordan_det_P:
fixes A::"'a::{field}^'n::{mod_type}^'n::{mod_type}"
shows "(fst (Gauss_Jordan_det_P A)) * det A = det (snd (Gauss_Jordan_det_P A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fst (Gauss_Jordan_det_P A) * det A = det (snd (Gauss_Jordan_det_P A))
[PROOF STEP]
using det_Gauss_Jordan_upt_k_det_P
[PROOF STATE]
proof (prove)
using this:
fst (Gauss_Jordan_upt_k_det_P ?A ?k) * det ?A = det (snd (Gauss_Jordan_upt_k_det_P ?A ?k))

goal (1 subgoal):
 1. fst (Gauss_Jordan_det_P A) * det A = det (snd (Gauss_Jordan_det_P A))
[PROOF STEP]
unfolding Gauss_Jordan_det_P_def
[PROOF STATE]
proof (prove)
using this:
fst (Gauss_Jordan_upt_k_det_P ?A ?k) * det ?A = det (snd (Gauss_Jordan_upt_k_det_P ?A ?k))

goal (1 subgoal):
 1. fst (Gauss_Jordan_upt_k_det_P A (ncols A - 1)) * det A = det (snd (Gauss_Jordan_upt_k_det_P A (ncols A - 1)))
[PROOF STEP]
by simp


[STATEMENT]
theorem well_defined_vec_mat_Tensor:
"(mat (row_length M) (length M) M) \<Longrightarrow>
                  (mat
                    ((row_length M)*(length v))
                    (length M)
                           (vec_mat_Tensor v M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
[PROOF STEP]
proof(induct M)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
mat (row_length []) (length []) []

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have "(vec_mat_Tensor v []) = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_mat_Tensor v [] = []
[PROOF STEP]
using vec_mat_Tensor.simps(1) Nil
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor ?xs [] = []
mat (row_length []) (length []) []

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

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
vec_mat_Tensor v [] = []

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have "(row_length [] = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_length [] = 0
[PROOF STEP]
using row_length_def Nil
[PROOF STATE]
proof (prove)
using this:
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
mat (row_length []) (length []) []

goal (1 subgoal):
 1. row_length [] = 0
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
row_length [] = 0

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
row_length [] = 0

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have "(length []) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length [] = 0
[PROOF STEP]
using Nil
[PROOF STATE]
proof (prove)
using this:
mat (row_length []) (length []) []

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

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
vec_mat_Tensor v [] = []
row_length [] = 0
length [] = 0
[PROOF STEP]
have
       "mat ((row_length [])*(length v)) (length []) (vec_mat_Tensor v [])"
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor v [] = []
row_length [] = 0
length [] = 0

goal (1 subgoal):
 1. mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
[PROOF STEP]
using zero_matrix
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor v [] = []
row_length [] = 0
length [] = 0
mat 0 0 []

goal (1 subgoal):
 1. mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
[PROOF STEP]
by (metis mult_zero_left)
[PROOF STATE]
proof (state)
this:
mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])

goal (2 subgoals):
 1. mat (row_length []) (length []) [] \<Longrightarrow> mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
 2. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])

goal (1 subgoal):
 1. mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mat (row_length [] * length v) (length []) (vec_mat_Tensor v [])

goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
fix a M
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
assume hyp :
   "(mat (row_length M) (length M) M
           \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M))"
   "mat (row_length (a#M)) (length (a#M)) (a#M)"
[PROOF STATE]
proof (state)
this:
mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
mat (row_length (a # M)) (length (a # M)) (a # M)

goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
let ?case =
   "mat (row_length (a#M) * length v) (length (a#M)) (vec_mat_Tensor v (a#M))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have step1: "mat (row_length M) (length M) M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M) (length M) M
[PROOF STEP]
using hyp(2) reduct_matrix
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M)) (length (a # M)) (a # M)
mat (row_length (?a # ?M)) (length (?a # ?M)) (?a # ?M) \<Longrightarrow> mat (row_length ?M) (length ?M) ?M

goal (1 subgoal):
 1. mat (row_length M) (length M) M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length M) (length M) M

goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length M) (length M) M
[PROOF STEP]
have step2:
    "mat (row_length M * length v) (length M) (vec_mat_Tensor v M)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length M) (length M) M

goal (1 subgoal):
 1. mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
[PROOF STEP]
using hyp(1)
[PROOF STATE]
proof (prove)
using this:
mat (row_length M) (length M) M
mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M)

goal (1 subgoal):
 1. mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length M * length v) (length M) (vec_mat_Tensor v M)

goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have
   "mat
        (row_length (a#M) * length v)
        (length (a#M))
             (vec_mat_Tensor v (a#M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
proof (cases M)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
M = []

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have 1:"(vec_mat_Tensor v (a#M)) = [vec_vec_Tensor v a]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_mat_Tensor v (a # M) = [vec_vec_Tensor v a]
[PROOF STEP]
using vec_mat_Tensor.simps Nil
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor ?xs [] = []
vec_mat_Tensor ?xs (?ys # ?yss) = vec_vec_Tensor ?xs ?ys # vec_mat_Tensor ?xs ?yss
M = []

goal (1 subgoal):
 1. vec_mat_Tensor v (a # M) = [vec_vec_Tensor v a]
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_mat_Tensor v (a # M) = [vec_vec_Tensor v a]

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have   "(x \<in> (set [vec_vec_Tensor v a])) \<longrightarrow>  x = (vec_vec_Tensor v a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set [vec_vec_Tensor v a] \<longrightarrow> x = vec_vec_Tensor v a
[PROOF STEP]
using set_def
[PROOF STATE]
proof (prove)
using this:
set \<equiv> ctor_fold_list (\<lambda>z. set1_pre_list z \<union> \<Union> (set2_pre_list z))

goal (1 subgoal):
 1. x \<in> set [vec_vec_Tensor v a] \<longrightarrow> x = vec_vec_Tensor v a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set [vec_vec_Tensor v a] \<longrightarrow> x = vec_vec_Tensor v a

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set [vec_vec_Tensor v a] \<longrightarrow> x = vec_vec_Tensor v a
[PROOF STEP]
have 2:
        "(x \<in> (set [vec_vec_Tensor v a]))
                    \<longrightarrow> (vec (length (vec_vec_Tensor v a)) x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set [vec_vec_Tensor v a] \<longrightarrow> x = vec_vec_Tensor v a

goal (1 subgoal):
 1. x \<in> set [vec_vec_Tensor v a] \<longrightarrow> vec (length (vec_vec_Tensor v a)) x
[PROOF STEP]
using vec_def
[PROOF STATE]
proof (prove)
using this:
x \<in> set [vec_vec_Tensor v a] \<longrightarrow> x = vec_vec_Tensor v a
vec ?n ?x = (length ?x = ?n)

goal (1 subgoal):
 1. x \<in> set [vec_vec_Tensor v a] \<longrightarrow> vec (length (vec_vec_Tensor v a)) x
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
x \<in> set [vec_vec_Tensor v a] \<longrightarrow> vec (length (vec_vec_Tensor v a)) x

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have 3:"length (vec_vec_Tensor v a) = (length v)*(length a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (vec_vec_Tensor v a) = length v * length a
[PROOF STEP]
using vec_vec_Tensor_length
[PROOF STATE]
proof (prove)
using this:
length (vec_vec_Tensor ?x ?y) = length ?x * length ?y

goal (1 subgoal):
 1. length (vec_vec_Tensor v a) = length v * length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (vec_vec_Tensor v a) = length v * length a

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (vec_vec_Tensor v a) = length v * length a
[PROOF STEP]
have 4:
        "length (vec_vec_Tensor v a) = (length v)*(row_length (a#M))"
[PROOF STATE]
proof (prove)
using this:
length (vec_vec_Tensor v a) = length v * length a

goal (1 subgoal):
 1. length (vec_vec_Tensor v a) = length v * row_length (a # M)
[PROOF STEP]
using row_length_def  list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
length (vec_vec_Tensor v a) = length v * length a
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. length (vec_vec_Tensor v a) = length v * row_length (a # M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (vec_vec_Tensor v a) = length v * row_length (a # M)

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have 6: "length (vec_mat_Tensor v (a#M)) = (length (a#M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (vec_mat_Tensor v (a # M)) = length (a # M)
[PROOF STEP]
using vec_mat_Tensor_length
[PROOF STATE]
proof (prove)
using this:
length (vec_mat_Tensor ?xs ?ys) = length ?ys

goal (1 subgoal):
 1. length (vec_mat_Tensor v (a # M)) = length (a # M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (vec_mat_Tensor v (a # M)) = length (a # M)

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
hence "mat (length (vec_vec_Tensor v a)) (length (a # M)) [vec_vec_Tensor v a]"
[PROOF STATE]
proof (prove)
using this:
length (vec_mat_Tensor v (a # M)) = length (a # M)

goal (1 subgoal):
 1. mat (length (vec_vec_Tensor v a)) (length (a # M)) [vec_vec_Tensor v a]
[PROOF STEP]
by (simp add: Nil mat_def vec_def)
[PROOF STATE]
proof (state)
this:
mat (length (vec_vec_Tensor v a)) (length (a # M)) [vec_vec_Tensor v a]

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
hence
        "mat (row_length (a#M) * length v)
             (length (vec_mat_Tensor v (a#M)))
             (vec_mat_Tensor v (a#M))"
[PROOF STATE]
proof (prove)
using this:
mat (length (vec_vec_Tensor v a)) (length (a # M)) [vec_vec_Tensor v a]

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (vec_mat_Tensor v (a # M))) (vec_mat_Tensor v (a # M))
[PROOF STEP]
using 1 4 6
[PROOF STATE]
proof (prove)
using this:
mat (length (vec_vec_Tensor v a)) (length (a # M)) [vec_vec_Tensor v a]
vec_mat_Tensor v (a # M) = [vec_vec_Tensor v a]
length (vec_vec_Tensor v a) = length v * row_length (a # M)
length (vec_mat_Tensor v (a # M)) = length (a # M)

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (vec_mat_Tensor v (a # M))) (vec_mat_Tensor v (a # M))
[PROOF STEP]
by (simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M) * length v) (length (vec_mat_Tensor v (a # M))) (vec_mat_Tensor v (a # M))

goal (2 subgoals):
 1. M = [] \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
 2. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (a # M) * length v) (length (vec_mat_Tensor v (a # M))) (vec_mat_Tensor v (a # M))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M) * length v) (length (vec_mat_Tensor v (a # M))) (vec_mat_Tensor v (a # M))

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
using 6
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M) * length v) (length (vec_mat_Tensor v (a # M))) (vec_mat_Tensor v (a # M))
length (vec_mat_Tensor v (a # M)) = length (a # M)

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
case (Cons b L)
[PROOF STATE]
proof (state)
this:
M = b # L

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have 1:"x \<in> (set (a#M)) \<longrightarrow> ((x=a) \<or> (x \<in> (set M)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> set (a # M) \<longrightarrow> x = a \<or> x \<in> set M
[PROOF STEP]
using hd_set
[PROOF STATE]
proof (prove)
using this:
?x \<in> set (?a # ?M) \<Longrightarrow> ?x = ?a \<or> ?x \<in> set ?M

goal (1 subgoal):
 1. x \<in> set (a # M) \<longrightarrow> x = a \<or> x \<in> set M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (a # M) \<longrightarrow> x = a \<or> x \<in> set M

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have "mat (row_length (a#M)) (length (a#M)) (a#M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length (a # M)) (length (a # M)) (a # M)
[PROOF STEP]
using hyp
[PROOF STATE]
proof (prove)
using this:
mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
mat (row_length (a # M)) (length (a # M)) (a # M)

goal (1 subgoal):
 1. mat (row_length (a # M)) (length (a # M)) (a # M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M)) (length (a # M)) (a # M)

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (a # M)) (length (a # M)) (a # M)
[PROOF STEP]
have "x\<in> (set (a#M)) \<longrightarrow> (vec (row_length (a#M)) x)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M)) (length (a # M)) (a # M)

goal (1 subgoal):
 1. x \<in> set (a # M) \<longrightarrow> vec (row_length (a # M)) x
[PROOF STEP]
using mat_def Ball_def
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M)) (length (a # M)) (a # M)
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))
Ball ?A ?P = (\<forall>x. x \<in> ?A \<longrightarrow> ?P x)

goal (1 subgoal):
 1. x \<in> set (a # M) \<longrightarrow> vec (row_length (a # M)) x
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
x \<in> set (a # M) \<longrightarrow> vec (row_length (a # M)) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (a # M) \<longrightarrow> vec (row_length (a # M)) x
[PROOF STEP]
have "x\<in> (set (a#M))\<longrightarrow> (vec (length a) x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (a # M) \<longrightarrow> vec (row_length (a # M)) x

goal (1 subgoal):
 1. x \<in> set (a # M) \<longrightarrow> vec (length a) x
[PROOF STEP]
using row_length_def  list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
x \<in> set (a # M) \<longrightarrow> vec (row_length (a # M)) x
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. x \<in> set (a # M) \<longrightarrow> vec (length a) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (a # M) \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (a # M) \<longrightarrow> x = a \<or> x \<in> set M
x \<in> set (a # M) \<longrightarrow> vec (length a) x
[PROOF STEP]
have "x\<in> (set M)\<longrightarrow> (vec (length a) x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (a # M) \<longrightarrow> x = a \<or> x \<in> set M
x \<in> set (a # M) \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. x \<in> set M \<longrightarrow> vec (length a) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set M \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> set M \<longrightarrow> vec (length a) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have " b \<in> (set M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> set M
[PROOF STEP]
using Cons
[PROOF STATE]
proof (prove)
using this:
M = b # L

goal (1 subgoal):
 1. b \<in> set M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
b \<in> set M

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> set M \<longrightarrow> vec (length a) x
b \<in> set M
[PROOF STEP]
have "vec (length a) b"
[PROOF STATE]
proof (prove)
using this:
x \<in> set M \<longrightarrow> vec (length a) x
b \<in> set M

goal (1 subgoal):
 1. vec (length a) b
[PROOF STEP]
using  hyp(2) in_set_member mat_def member_rec(1) vec_def
[PROOF STATE]
proof (prove)
using this:
x \<in> set M \<longrightarrow> vec (length a) x
b \<in> set M
mat (row_length (a # M)) (length (a # M)) (a # M)
(?x \<in> set ?xs) = List.member ?xs ?x
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))
List.member (?x # ?xs) ?y = (?x = ?y \<or> List.member ?xs ?y)
vec ?n ?x = (length ?x = ?n)

goal (1 subgoal):
 1. vec (length a) b
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
vec (length a) b

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vec (length a) b
[PROOF STEP]
have "(length b) = (length a)"
[PROOF STATE]
proof (prove)
using this:
vec (length a) b

goal (1 subgoal):
 1. length b = length a
[PROOF STEP]
using vec_def vec_uniqueness
[PROOF STATE]
proof (prove)
using this:
vec (length a) b
vec ?n ?x = (length ?x = ?n)
\<lbrakk>vec ?m ?v; vec ?n ?v\<rbrakk> \<Longrightarrow> ?m = ?n

goal (1 subgoal):
 1. length b = length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length b = length a

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length b = length a
[PROOF STEP]
have 2:"row_length M = (length a)"
[PROOF STATE]
proof (prove)
using this:
length b = length a

goal (1 subgoal):
 1. row_length M = length a
[PROOF STEP]
using row_length_def   Cons list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
length b = length a
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
M = b # L
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. row_length M = length a
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
row_length M = length a

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have "mat (row_length M * length v) (length M) (vec_mat_Tensor v M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
[PROOF STEP]
using step2
[PROOF STATE]
proof (prove)
using this:
mat (row_length M * length v) (length M) (vec_mat_Tensor v M)

goal (1 subgoal):
 1. mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length M * length v) (length M) (vec_mat_Tensor v M)

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
[PROOF STEP]
have 3:
          "Ball (set (vec_mat_Tensor v M)) (vec ((row_length M)*(length v)))"
[PROOF STATE]
proof (prove)
using this:
mat (row_length M * length v) (length M) (vec_mat_Tensor v M)

goal (1 subgoal):
 1. Ball (set (vec_mat_Tensor v M)) (vec (row_length M * length v))
[PROOF STEP]
using mat_def
[PROOF STATE]
proof (prove)
using this:
mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))

goal (1 subgoal):
 1. Ball (set (vec_mat_Tensor v M)) (vec (row_length M * length v))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ball (set (vec_mat_Tensor v M)) (vec (row_length M * length v))

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Ball (set (vec_mat_Tensor v M)) (vec (row_length M * length v))
[PROOF STEP]
have "(x \<in> set (vec_mat_Tensor v M))
                        \<longrightarrow> (vec ((row_length M)*(length v)) x)"
[PROOF STATE]
proof (prove)
using this:
Ball (set (vec_mat_Tensor v M)) (vec (row_length M * length v))

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (row_length M * length v) x
[PROOF STEP]
using mat_def Ball_def
[PROOF STATE]
proof (prove)
using this:
Ball (set (vec_mat_Tensor v M)) (vec (row_length M * length v))
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))
Ball ?A ?P = (\<forall>x. x \<in> ?A \<longrightarrow> ?P x)

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (row_length M * length v) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (row_length M * length v) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (row_length M * length v) x
[PROOF STEP]
have 4:"(x \<in> set (vec_mat_Tensor v M))
                          \<longrightarrow> (vec ((length a)*(length v)) x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (row_length M * length v) x

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (length a * length v) x
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (row_length M * length v) x
row_length M = length a

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (length a * length v) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (length a * length v) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have 5:"length (vec_vec_Tensor v a) = (length a)*(length v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (vec_vec_Tensor v a) = length a * length v
[PROOF STEP]
using   vec_vec_Tensor_length
[PROOF STATE]
proof (prove)
using this:
length (vec_vec_Tensor ?x ?y) = length ?x * length ?y

goal (1 subgoal):
 1. length (vec_vec_Tensor v a) = length a * length v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (vec_vec_Tensor v a) = length a * length v

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (vec_vec_Tensor v a) = length a * length v
[PROOF STEP]
have 6:" vec ((length a)*(length v)) (vec_vec_Tensor v a)"
[PROOF STATE]
proof (prove)
using this:
length (vec_vec_Tensor v a) = length a * length v

goal (1 subgoal):
 1. vec (length a * length v) (vec_vec_Tensor v a)
[PROOF STEP]
using vec_vec_Tensor_length vec_def
[PROOF STATE]
proof (prove)
using this:
length (vec_vec_Tensor v a) = length a * length v
length (vec_vec_Tensor ?x ?y) = length ?x * length ?y
vec ?n ?x = (length ?x = ?n)

goal (1 subgoal):
 1. vec (length a * length v) (vec_vec_Tensor v a)
[PROOF STEP]
by (metis (full_types))
[PROOF STATE]
proof (state)
this:
vec (length a * length v) (vec_vec_Tensor v a)

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have 7:"(length a) = (row_length (a#M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length a = row_length (a # M)
[PROOF STEP]
using row_length_def   list.distinct(1)
[PROOF STATE]
proof (prove)
using this:
row_length ?xs \<equiv> if ?xs = [] then 0 else length (hd ?xs)
[] \<noteq> ?x21.0 # ?x22.0

goal (1 subgoal):
 1. length a = row_length (a # M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length a = row_length (a # M)

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have "vec_mat_Tensor v (a#M)
                   = (vec_vec_Tensor v a)#(vec_mat_Tensor v M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_mat_Tensor v (a # M) = vec_vec_Tensor v a # vec_mat_Tensor v M
[PROOF STEP]
using vec_mat_Tensor.simps(2)
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor ?xs (?ys # ?yss) = vec_vec_Tensor ?xs ?ys # vec_mat_Tensor ?xs ?yss

goal (1 subgoal):
 1. vec_mat_Tensor v (a # M) = vec_vec_Tensor v a # vec_mat_Tensor v M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
vec_mat_Tensor v (a # M) = vec_vec_Tensor v a # vec_mat_Tensor v M

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
vec_mat_Tensor v (a # M) = vec_vec_Tensor v a # vec_mat_Tensor v M
[PROOF STEP]
have "(x \<in> set (vec_mat_Tensor v (a#M)))
                      \<longrightarrow> ((x = (vec_vec_Tensor v a))
                           \<or> (x \<in> (set (vec_mat_Tensor v M))))"
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor v (a # M) = vec_vec_Tensor v a # vec_mat_Tensor v M

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> x = vec_vec_Tensor v a \<or> x \<in> set (vec_mat_Tensor v M)
[PROOF STEP]
using  hd_set
[PROOF STATE]
proof (prove)
using this:
vec_mat_Tensor v (a # M) = vec_vec_Tensor v a # vec_mat_Tensor v M
?x \<in> set (?a # ?M) \<Longrightarrow> ?x = ?a \<or> ?x \<in> set ?M

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> x = vec_vec_Tensor v a \<or> x \<in> set (vec_mat_Tensor v M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> x = vec_vec_Tensor v a \<or> x \<in> set (vec_mat_Tensor v M)

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
with 4 6
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (length a * length v) x
vec (length a * length v) (vec_vec_Tensor v a)
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> x = vec_vec_Tensor v a \<or> x \<in> set (vec_mat_Tensor v M)
[PROOF STEP]
have "(x \<in> set (vec_mat_Tensor v (a#M)))
                             \<longrightarrow>  vec ((length a)*(length v)) x"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vec_mat_Tensor v M) \<longrightarrow> vec (length a * length v) x
vec (length a * length v) (vec_vec_Tensor v a)
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> x = vec_vec_Tensor v a \<or> x \<in> set (vec_mat_Tensor v M)

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (length a * length v) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (length a * length v) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
with 7
[PROOF STATE]
proof (chain)
picking this:
length a = row_length (a # M)
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (length a * length v) x
[PROOF STEP]
have "(x \<in> set (vec_mat_Tensor v (a#M)))
                                \<longrightarrow>  vec ((row_length (a#M))*(length v)) x"
[PROOF STATE]
proof (prove)
using this:
length a = row_length (a # M)
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (length a * length v) x

goal (1 subgoal):
 1. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x
[PROOF STEP]
have "\<forall>x.((x \<in> set (vec_mat_Tensor v (a#M)))
                                \<longrightarrow>  vec ((row_length (a#M))*(length v)) x)"
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x

goal (1 subgoal):
 1. \<forall>x. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x
[PROOF STEP]
using "2" "3" "6" "7" hd_set vec_mat_Tensor.simps(2)
[PROOF STATE]
proof (prove)
using this:
x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x
row_length M = length a
Ball (set (vec_mat_Tensor v M)) (vec (row_length M * length v))
vec (length a * length v) (vec_vec_Tensor v a)
length a = row_length (a # M)
?x \<in> set (?a # ?M) \<Longrightarrow> ?x = ?a \<or> ?x \<in> set ?M
vec_mat_Tensor ?xs (?ys # ?yss) = vec_vec_Tensor ?xs ?ys # vec_mat_Tensor ?xs ?yss

goal (1 subgoal):
 1. \<forall>x. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>x. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x
[PROOF STEP]
have 7:
      "Ball
            (set (vec_mat_Tensor v (a#M)))
            (vec ((row_length (a#M))*(length v)))"
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x

goal (1 subgoal):
 1. Ball (set (vec_mat_Tensor v (a # M))) (vec (row_length (a # M) * length v))
[PROOF STEP]
using Ball_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x \<in> set (vec_mat_Tensor v (a # M)) \<longrightarrow> vec (row_length (a # M) * length v) x
Ball ?A ?P = (\<forall>x. x \<in> ?A \<longrightarrow> ?P x)

goal (1 subgoal):
 1. Ball (set (vec_mat_Tensor v (a # M))) (vec (row_length (a # M) * length v))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ball (set (vec_mat_Tensor v (a # M))) (vec (row_length (a # M) * length v))

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
have 8: "length (vec_mat_Tensor v (a#M)) = length (a#M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (vec_mat_Tensor v (a # M)) = length (a # M)
[PROOF STEP]
using vec_mat_Tensor_length
[PROOF STATE]
proof (prove)
using this:
length (vec_mat_Tensor ?xs ?ys) = length ?ys

goal (1 subgoal):
 1. length (vec_mat_Tensor v (a # M)) = length (a # M)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
length (vec_mat_Tensor v (a # M)) = length (a # M)

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
with 6  7
[PROOF STATE]
proof (chain)
picking this:
vec (length a * length v) (vec_vec_Tensor v a)
Ball (set (vec_mat_Tensor v (a # M))) (vec (row_length (a # M) * length v))
length (vec_mat_Tensor v (a # M)) = length (a # M)
[PROOF STEP]
have
               "mat
                 ((row_length (a#M))*(length v))
                 (length (a#M))
                           (vec_mat_Tensor v (a#M))"
[PROOF STATE]
proof (prove)
using this:
vec (length a * length v) (vec_vec_Tensor v a)
Ball (set (vec_mat_Tensor v (a # M))) (vec (row_length (a # M) * length v))
length (vec_mat_Tensor v (a # M)) = length (a # M)

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
using mat_def  "5" length_code
[PROOF STATE]
proof (prove)
using this:
vec (length a * length v) (vec_vec_Tensor v a)
Ball (set (vec_mat_Tensor v (a # M))) (vec (row_length (a # M) * length v))
length (vec_mat_Tensor v (a # M)) = length (a # M)
mat ?nr ?nc ?m = (length ?m = ?nc \<and> Ball (set ?m) (vec ?nr))
length (vec_vec_Tensor v a) = length a * length v
length = List.gen_length 0

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
by (metis (opaque_lifting, no_types))
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))

goal (1 subgoal):
 1. \<And>aa list. M = aa # list \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))

goal (1 subgoal):
 1. \<And>a M. \<lbrakk>mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M); mat (row_length (a # M)) (length (a # M)) (a # M)\<rbrakk> \<Longrightarrow> mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
with  hyp
[PROOF STATE]
proof (chain)
picking this:
mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
mat (row_length (a # M)) (length (a # M)) (a # M)
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
mat (row_length M) (length M) M \<Longrightarrow> mat (row_length M * length v) (length M) (vec_mat_Tensor v M)
mat (row_length (a # M)) (length (a # M)) (a # M)
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))

goal (1 subgoal):
 1. mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length (a # M) * length v) (length (a # M)) (vec_mat_Tensor v (a # M))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prob_single:
  assumes "x \<in> carrier R" "y \<in> carrier R"
  shows "prob {\<omega>. hash x \<omega> = y} = 1/(real field_size)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prob {\<omega>. hash x \<omega> = y} = 1 / real field_size
[PROOF STEP]
using hash_prob[where K="{x}"] assms finite_carrier k_ge_0
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>{x} \<subseteq> carrier R; card {x} \<le> k; ?y ` {x} \<subseteq> carrier R\<rbrakk> \<Longrightarrow> prob {\<omega>. \<forall>x\<in>{x}. hash x \<omega> = ?y x} = 1 / real field_size ^ card {x}
x \<in> carrier R
y \<in> carrier R
finite (carrier R)
0 < k

goal (1 subgoal):
 1. prob {\<omega>. hash x \<omega> = y} = 1 / real field_size
[PROOF STEP]
by simp


[STATEMENT]
lemma (in Ring) bilinear_l_lin:"\<lbrakk>R module M1; R module M2; R module N;
      m1 \<in> carrier M1; m2 \<in> carrier M2; r \<in> carrier R;
      bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow> f (r \<cdot>\<^sub>s\<^bsub>M1\<^esub> m1, m2) = r \<cdot>\<^sub>s\<^bsub>N\<^esub> (f (m1, m2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>R module M1; R module M2; R module N; m1 \<in> carrier M1; m2 \<in> carrier M2; r \<in> carrier R; bilinear_map f R M1 M2 N\<rbrakk> \<Longrightarrow> f (r \<cdot>\<^sub>s\<^bsub>M1\<^esub> m1, m2) = r \<cdot>\<^sub>s\<^bsub>N\<^esub> f (m1, m2)
[PROOF STEP]
by (simp add:bilinear_map_def)


[STATEMENT]
lemma reduced_letter_set_0: "reduced_letter_set A 0 = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_letter_set A (0::'a) = {}
[PROOF STEP]
using reduced_word_for_0_imp_nil
[PROOF STATE]
proof (prove)
using this:
reduced_word_for ?A (0::'a) ?as \<Longrightarrow> ?as = []

goal (1 subgoal):
 1. reduced_letter_set A (0::'a) = {}
[PROOF STEP]
by simp


[STATEMENT]
lemma beukers_integral1_swap: "beukers_integral1 r s = beukers_integral1 s r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. beukers_integral1 r s = beukers_integral1 s r
[PROOF STEP]
by (simp add: beukers_integral1_conv_nn_integral beukers_nn_integral1_swap)


[STATEMENT]
lemma l_neq_1_exp_neq_0:
  assumes "l \<in> carrier G"
    and "l \<noteq> \<one>"
    and "l = \<^bold>g [^] (t::nat)"
  shows "t \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<noteq> 0
[PROOF STEP]
proof(rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
assume "\<not> (t \<noteq> 0)"
[PROOF STATE]
proof (state)
this:
\<not> t \<noteq> 0

goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence "t = 0"
[PROOF STATE]
proof (prove)
using this:
\<not> t \<noteq> 0

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

goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
hence "\<^bold>g [^] t = \<one>"
[PROOF STATE]
proof (prove)
using this:
t = 0

goal (1 subgoal):
 1. \<^bold>g [^] t = \<one>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<^bold>g [^] t = \<one>

goal (1 subgoal):
 1. \<not> t \<noteq> 0 \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<^bold>g [^] t = \<one>
[PROOF STEP]
show "False"
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] t = \<one>

goal (1 subgoal):
 1. False
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<^bold>g [^] t = \<one>
l \<in> carrier G
l \<noteq> \<one>
l = \<^bold>g [^] t

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_wrt_insort [intro]:
  assumes "linorder_on A R" "set xs \<subseteq> A"
  shows   "sorted_wrt R (insort_wrt R xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
linorder_on A R
set xs \<subseteq> A
[PROOF STEP]
have "set (insort_wrt R xs) = set xs \<and> sorted_wrt R (insort_wrt R xs)"
[PROOF STATE]
proof (prove)
using this:
linorder_on A R
set xs \<subseteq> A

goal (1 subgoal):
 1. set (insort_wrt R xs) = set xs \<and> Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
by (induction xs) (auto simp: insort_wrt_def intro!: sorted_wrt_insert_wrt)
[PROOF STATE]
proof (state)
this:
set (insort_wrt R xs) = set xs \<and> Linorder_Relations.sorted_wrt R (insort_wrt R xs)

goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set (insort_wrt R xs) = set xs \<and> Linorder_Relations.sorted_wrt R (insort_wrt R xs)

goal (1 subgoal):
 1. Linorder_Relations.sorted_wrt R (insort_wrt R xs)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Linorder_Relations.sorted_wrt R (insort_wrt R xs)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fresh_variable_type_scheme_lists:
  "\<exists>n. new_tv n (A::type_scheme list)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>n. new_tv n A
[PROOF STEP]
apply (induction A)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<exists>n. new_tv n []
 2. \<And>a A. \<exists>n. new_tv n A \<Longrightarrow> \<exists>n. new_tv n (a # A)
[PROOF STEP]
apply (simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a A. \<exists>n. new_tv n A \<Longrightarrow> \<exists>n. new_tv n (a # A)
[PROOF STEP]
by (metis fresh_variable_type_schemes le_cases new_tv_Cons new_tv_le)


[STATEMENT]
lemma ChainsD: "\<lbrakk> x \<in> C; C \<in> Chains r; y \<in> C \<rbrakk> \<Longrightarrow> (x, y) \<in> r \<or> (y, x) \<in> r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> C; C \<in> Chains r; y \<in> C\<rbrakk> \<Longrightarrow> (x, y) \<in> r \<or> (y, x) \<in> r
[PROOF STEP]
by(simp add: Chains_def)


[STATEMENT]
lemma UP_l_neg_ex:
  assumes R: "p \<in> carrier P"
  shows "\<exists>q \<in> carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q\<in>carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>q\<in>carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
let ?q = "\<lambda>i. \<ominus> (p i)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>q\<in>carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
from R
[PROOF STATE]
proof (chain)
picking this:
p \<in> carrier P
[PROOF STEP]
have closed: "?q \<in> carrier P"
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P

goal (1 subgoal):
 1. (\<lambda>i. \<ominus> p i) \<in> carrier P
[PROOF STEP]
by (simp add: UP_def P_def up_a_inv_closed)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. \<ominus> p i) \<in> carrier P

goal (1 subgoal):
 1. \<exists>q\<in>carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
from R
[PROOF STATE]
proof (chain)
picking this:
p \<in> carrier P
[PROOF STEP]
have coeff: "!!n. coeff P ?q n = \<ominus> (coeff P p n)"
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier P

goal (1 subgoal):
 1. \<And>n. coeff P (\<lambda>i. \<ominus> p i) n = \<ominus> coeff P p n
[PROOF STEP]
by (simp add: UP_def P_def up_a_inv_closed)
[PROOF STATE]
proof (state)
this:
coeff P (\<lambda>i. \<ominus> p i) ?n = \<ominus> coeff P p ?n

goal (1 subgoal):
 1. \<exists>q\<in>carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>q\<in>carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
 2. ?q \<in> carrier P
[PROOF STEP]
show "?q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. \<ominus> p i) \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>
[PROOF STEP]
by (auto intro!: up_eqI simp add: R closed coeff R.l_neg)
[PROOF STATE]
proof (state)
this:
(\<lambda>i. \<ominus> p i) \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>

goal (1 subgoal):
 1. (\<lambda>i. \<ominus> p i) \<in> carrier P
[PROOF STEP]
qed (rule closed)
[PROOF STATE]
proof (state)
this:
\<exists>q\<in>carrier P. q \<oplus>\<^bsub>P\<^esub> p = \<zero>\<^bsub>P\<^esub>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma takeWhile_take_has_property:
  "n \<le> length (takeWhile P xs) \<Longrightarrow> \<forall>x \<in> set (take n xs). P x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n \<le> length (takeWhile P xs) \<Longrightarrow> \<forall>x\<in>set (take n xs). P x
[PROOF STEP]
by (induct xs arbitrary: n; simp split: if_split_asm) (case_tac n, simp_all)


[STATEMENT]
lemma ennreal_approx_unit:
  "(\<And>a::ennreal. 0 < a \<Longrightarrow> a < 1 \<Longrightarrow> a * z \<le> y) \<Longrightarrow> z \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>0 < a; a < 1\<rbrakk> \<Longrightarrow> a * z \<le> y) \<Longrightarrow> z \<le> y
[PROOF STEP]
apply (subst SUP_mult_right_ennreal[of "\<lambda>x. x" "{0 <..< 1}" z, simplified])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>a. \<lbrakk>0 < a; a < 1\<rbrakk> \<Longrightarrow> a * z \<le> y) \<Longrightarrow> (SUP i\<in>{0<..<1}. i * z) \<le> y
[PROOF STEP]
apply (auto intro: SUP_least)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma Restrict_eq_mono:
     "[| A \<subseteq> B;  Restrict B r = Restrict B s |]
      ==> Restrict A r = Restrict A s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>A \<subseteq> B; Restrict B r = Restrict B s\<rbrakk> \<Longrightarrow> Restrict A r = Restrict A s
[PROOF STEP]
by (unfold Restrict_def, blast)


[STATEMENT]
lemma karatsuba_single_sided: fixes f :: "'a :: comm_ring_1 poly"
  assumes "f = monom_mult n f1 + f0"
  shows "monom_mult n (f1 * g) + f0 * g = f * g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_mult n (f1 * g) + f0 * g = f * g
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monom_mult n (f1 * g) + f0 * g = (monom_mult n f1 + f0) * g
[PROOF STEP]
by (auto simp: field_simps mult_monom monom_mult_def)


[STATEMENT]
lemma borel_measurable_ereal_iff:
  shows "(\<lambda>x. ereal (f x)) \<in> borel_measurable M \<longleftrightarrow> f \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ereal (f x)) \<in> borel_measurable M) = (f \<in> borel_measurable M)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. ereal (f x)) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M
 2. f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. ereal (f x)) \<in> borel_measurable M
[PROOF STEP]
assume "(\<lambda>x. ereal (f x)) \<in> borel_measurable M"
[PROOF STATE]
proof (state)
this:
(\<lambda>x. ereal (f x)) \<in> borel_measurable M

goal (2 subgoals):
 1. (\<lambda>x. ereal (f x)) \<in> borel_measurable M \<Longrightarrow> f \<in> borel_measurable M
 2. f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. ereal (f x)) \<in> borel_measurable M
[PROOF STEP]
from borel_measurable_real_of_ereal[OF this]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. real_of_ereal (ereal (f x))) \<in> borel_measurable M
[PROOF STEP]
show "f \<in> borel_measurable M"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. real_of_ereal (ereal (f x))) \<in> borel_measurable M

goal (1 subgoal):
 1. f \<in> borel_measurable M
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
f \<in> borel_measurable M

goal (1 subgoal):
 1. f \<in> borel_measurable M \<Longrightarrow> (\<lambda>x. ereal (f x)) \<in> borel_measurable M
[PROOF STEP]
qed auto


[STATEMENT]
lemma exp_2dist_positive:
  assumes "a \<in> hyp2" and "b \<in> hyp2"
  shows "exp_2dist a b > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < exp_2dist a b
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < exp_2dist a b
 2. \<not> ?P \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
assume "a = b"
[PROOF STATE]
proof (state)
this:
a = b

goal (2 subgoals):
 1. ?P \<Longrightarrow> 0 < exp_2dist a b
 2. \<not> ?P \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
thus "exp_2dist a b > 0"
[PROOF STATE]
proof (prove)
using this:
a = b

goal (1 subgoal):
 1. 0 < exp_2dist a b
[PROOF STEP]
by (unfold exp_2dist_def) simp
[PROOF STATE]
proof (state)
this:
0 < exp_2dist a b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
assume "a \<noteq> b"
[PROOF STATE]
proof (state)
this:
a \<noteq> b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
let ?p = "endpoint_in_S a b"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
let ?q = "endpoint_in_S b a"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
from \<open>a \<noteq> b\<close> and \<open>a \<in> hyp2\<close> and \<open>b \<in> hyp2\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
a \<in> hyp2
b \<in> hyp2
[PROOF STEP]
have "are_endpoints_in_S ?p ?q a b"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b
a \<in> hyp2
b \<in> hyp2

goal (1 subgoal):
 1. are_endpoints_in_S (endpoint_in_S a b) (endpoint_in_S b a) a b
[PROOF STEP]
by (rule endpoints_in_S_are_endpoints_in_S)
[PROOF STATE]
proof (state)
this:
are_endpoints_in_S (endpoint_in_S a b) (endpoint_in_S b a) a b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
hence "cross_ratio ?p ?q a b > 0"
[PROOF STATE]
proof (prove)
using this:
are_endpoints_in_S (endpoint_in_S a b) (endpoint_in_S b a) a b

goal (1 subgoal):
 1. 0 < cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b
[PROOF STEP]
by (rule cross_ratio_S_S_hyp2_hyp2_positive)
[PROOF STATE]
proof (state)
this:
0 < cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b

goal (1 subgoal):
 1. a \<noteq> b \<Longrightarrow> 0 < exp_2dist a b
[PROOF STEP]
with \<open>a \<noteq> b\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<noteq> b
0 < cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b
[PROOF STEP]
show "exp_2dist a b > 0"
[PROOF STATE]
proof (prove)
using this:
a \<noteq> b
0 < cross_ratio (endpoint_in_S a b) (endpoint_in_S b a) a b

goal (1 subgoal):
 1. 0 < exp_2dist a b
[PROOF STEP]
by (unfold exp_2dist_def) simp
[PROOF STATE]
proof (state)
this:
0 < exp_2dist a b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mem_is_interval_1_I:
  fixes a b c::real
  assumes "is_interval S"
  assumes "a \<in> S" "c \<in> S"
  assumes "a \<le> b" "b \<le> c"
  shows "b \<in> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<in> S
[PROOF STEP]
using assms is_interval_1
[PROOF STATE]
proof (prove)
using this:
is_interval S
a \<in> S
c \<in> S
a \<le> b
b \<le> c
is_interval ?s = (\<forall>a\<in>?s. \<forall>b\<in>?s. \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> x \<in> ?s)

goal (1 subgoal):
 1. b \<in> S
[PROOF STEP]
by blast


[STATEMENT]
lemma field_poly_irreducible_imp_prime:
  "prime_elem p" if "irreducible p" for p :: "'a :: field poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime_elem p
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
irreducible p

goal (1 subgoal):
 1. prime_elem p
[PROOF STEP]
by (fact field_poly.irreducible_imp_prime_elem)


[STATEMENT]
lemma reduce_below_abs_preserves_dimensions:
 shows [simp]: "dim_row (reduce_below_abs a xs D A) = dim_row A"
    and [simp]: "dim_col (reduce_below_abs a xs D A) = dim_col A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (reduce_below_abs a xs D A) = dim_row A &&& dim_col (reduce_below_abs a xs D A) = dim_col A
[PROOF STEP]
using reduce_below_abs[of A "dim_row A" "dim_col A"]
[PROOF STATE]
proof (prove)
using this:
A \<in> carrier_mat (dim_row A) (dim_col A) \<Longrightarrow> reduce_below_abs ?a ?xs ?D A \<in> carrier_mat (dim_row A) (dim_col A)

goal (1 subgoal):
 1. dim_row (reduce_below_abs a xs D A) = dim_row A &&& dim_col (reduce_below_abs a xs D A) = dim_col A
[PROOF STEP]
by auto


[STATEMENT]
lemma card_of_Fpow[simp]: "|A| \<le>o |Fpow A|"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. |A| \<le>o |Fpow A|
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A| \<le>o |Fpow A|
[PROOF STEP]
let ?h = "\<lambda> a. {a}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. |A| \<le>o |Fpow A|
[PROOF STEP]
have "inj_on ?h A \<and> ?h ` A \<le> Fpow A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>a. {a}) A \<and> (\<lambda>a. {a}) ` A \<subseteq> Fpow A
[PROOF STEP]
unfolding inj_on_def Fpow_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>A. \<forall>y\<in>A. {x} = {y} \<longrightarrow> x = y) \<and> (\<lambda>a. {a}) ` A \<subseteq> {X. X \<subseteq> A \<and> finite X}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>a. {a}) A \<and> (\<lambda>a. {a}) ` A \<subseteq> Fpow A

goal (1 subgoal):
 1. |A| \<le>o |Fpow A|
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>a. {a}) A \<and> (\<lambda>a. {a}) ` A \<subseteq> Fpow A

goal (1 subgoal):
 1. |A| \<le>o |Fpow A|
[PROOF STEP]
using card_of_ordLeq
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>a. {a}) A \<and> (\<lambda>a. {a}) ` A \<subseteq> Fpow A
(\<exists>f. inj_on f ?A \<and> f ` ?A \<subseteq> ?B) = (|?A| \<le>o |?B|)

goal (1 subgoal):
 1. |A| \<le>o |Fpow A|
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
|A| \<le>o |Fpow A|

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem universal_domain: "domain {n. True} = {x. True}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain {n. True} = {x. True}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. domain {n. True} = {x. True}
[PROOF STEP]
have "\<forall>x. x = Det True \<or> x = Det False \<or> x \<in> range Indet"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. x = Det True \<or> x = Det False \<or> x \<in> range Indet
[PROOF STEP]
using range_eqI tv.exhaust tv.inject
[PROOF STATE]
proof (prove)
using this:
?b = ?f ?x \<Longrightarrow> ?b \<in> range ?f
\<lbrakk>\<And>x1. ?y = Det x1 \<Longrightarrow> ?P; \<And>x2. ?y = Indet x2 \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
(Det ?x1.0 = Det ?y1.0) = (?x1.0 = ?y1.0)
(Indet ?x2.0 = Indet ?y2.0) = (?x2.0 = ?y2.0)

goal (1 subgoal):
 1. \<forall>x. x = Det True \<or> x = Det False \<or> x \<in> range Indet
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
\<forall>x. x = Det True \<or> x = Det False \<or> x \<in> range Indet

goal (1 subgoal):
 1. domain {n. True} = {x. True}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>x. x = Det True \<or> x = Det False \<or> x \<in> range Indet
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x = Det True \<or> x = Det False \<or> x \<in> range Indet

goal (1 subgoal):
 1. domain {n. True} = {x. True}
[PROOF STEP]
unfolding domain_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x. x = Det True \<or> x = Det False \<or> x \<in> range Indet

goal (1 subgoal):
 1. {Det True, Det False} \<union> Indet ` {n. True} = {x. True}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
domain {n. True} = {x. True}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma drop_last_in: "\<And>n. n < length ls \<Longrightarrow> last ls \<in> set (drop n ls)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. n < |ls| \<Longrightarrow> last ls \<in> set (drop n ls)
[PROOF STEP]
apply (frule_tac last_drop)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>n < |ls|; last (drop n ls) = last ls\<rbrakk> \<Longrightarrow> last ls \<in> set (drop n ls)
[PROOF STEP]
apply(erule subst)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. n < |ls| \<Longrightarrow> last (drop n ls) \<in> set (drop n ls)
[PROOF STEP]
apply (case_tac "drop n ls" rule: rev_exhaust)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>n. \<lbrakk>n < |ls|; drop n ls = []\<rbrakk> \<Longrightarrow> last (drop n ls) \<in> set (drop n ls)
 2. \<And>n ys y. \<lbrakk>n < |ls|; drop n ls = ys @ [y]\<rbrakk> \<Longrightarrow> last (drop n ls) \<in> set (drop n ls)
[PROOF STEP]
by simp_all


[STATEMENT]
lemma wf_bs_polyneg: "wf_bs bs p \<Longrightarrow> wf_bs bs (~\<^sub>p p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_bs bs p \<Longrightarrow> wf_bs bs (~\<^sub>p p)
[PROOF STEP]
unfolding wf_bs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. maxindex p \<le> length bs \<Longrightarrow> maxindex (~\<^sub>p p) \<le> length bs
[PROOF STEP]
by (induct p rule: polyneg.induct) auto


[STATEMENT]
lemma bigo_lesseq3: "f =o O(h) \<Longrightarrow> \<forall>x. 0 <= g x \<Longrightarrow> \<forall>x. g x <= f x \<Longrightarrow>
      g =o O(h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> O(h); \<forall>x. (0::'b) \<le> g x; \<forall>x. g x \<le> f x\<rbrakk> \<Longrightarrow> g \<in> O(h)
[PROOF STEP]
apply (erule bigo_lesseq2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. (0::'b) \<le> g x; \<forall>x. g x \<le> f x\<rbrakk> \<Longrightarrow> \<forall>x. \<bar>g x\<bar> \<le> f x
[PROOF STEP]
apply (rule allI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<forall>x. (0::'b) \<le> g x; \<forall>x. g x \<le> f x\<rbrakk> \<Longrightarrow> \<bar>g x\<bar> \<le> f x
[PROOF STEP]
apply (subst abs_of_nonneg)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<forall>x. (0::'b) \<le> g x; \<forall>x. g x \<le> f x\<rbrakk> \<Longrightarrow> (0::'b) \<le> g x
 2. \<And>x. \<lbrakk>\<forall>x. (0::'b) \<le> g x; \<forall>x. g x \<le> f x\<rbrakk> \<Longrightarrow> g x \<le> f x
[PROOF STEP]
apply (erule spec)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma bounded_closed_interval [simp]:
  fixes a :: "'a::ordered_euclidean_space"
  shows "bounded {a .. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bounded {a..b}
[PROOF STEP]
using bounded_cbox[of a b]
[PROOF STATE]
proof (prove)
using this:
bounded (cbox a b)

goal (1 subgoal):
 1. bounded {a..b}
[PROOF STEP]
by (metis interval_cbox)


[STATEMENT]
lemma lift_01_mat_simp[simp]: "dim_row (lift_01_mat M) = dim_row M"
  "dim_col (lift_01_mat M) = dim_col M"
  "i < dim_row M \<Longrightarrow> j < dim_col M \<Longrightarrow> (lift_01_mat M) $$ (i, j) = of_zero_neq_one (M $$ (i, j))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (lift_01_mat M) = dim_row M &&& dim_col (lift_01_mat M) = dim_col M &&& (\<lbrakk>i < dim_row M; j < dim_col M\<rbrakk> \<Longrightarrow> lift_01_mat M $$ (i, j) = of_zero_neq_one (M $$ (i, j)))
[PROOF STEP]
by (simp_all add: lift_01_mat_def)


[STATEMENT]
lemma inext_le_mono_infin_fin_rev: "
  \<lbrakk> inext a I \<le> inext b I; a \<in> I; b \<in> I; inext a I \<noteq> Max I \<or> infinite I \<rbrakk> \<Longrightarrow> a \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inext a I \<le> inext b I; a \<in> I; b \<in> I; inext a I \<noteq> Max I \<or> infinite I\<rbrakk> \<Longrightarrow> a \<le> b
[PROOF STEP]
by (blast intro: inext_le_mono_infin_rev inext_le_mono_fin_rev)


[STATEMENT]
lemma eval_dioph_mult:
  "eval_dioph ks xs * int n = eval_dioph ks (map (\<lambda>x. x * n) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eval_dioph ks xs * int n = eval_dioph ks (map (\<lambda>x. x * n) xs)
[PROOF STEP]
by(induct ks xs rule: eval_dioph.induct) (simp_all add: distrib_right)


[STATEMENT]
lemma arr_char:
    shows "S.arr f \<longleftrightarrow> f \<noteq> S.Null \<and> Setp (S.Dom f) \<and> Setp (S.Cod f) \<and>
                       S.Map f \<in> extensional (S.Dom f) \<inter> (S.Dom f \<rightarrow> S.Cod f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S.arr f = (f \<noteq> S.Null \<and> Setp (S.Dom f) \<and> Setp (S.Cod f) \<and> S.Map f \<in> extensional (S.Dom f) \<inter> (S.Dom f \<rightarrow> S.Cod f))
[PROOF STEP]
using S.arr_char
[PROOF STATE]
proof (prove)
using this:
S.arr ?f = (?f \<noteq> S.Null \<and> S.Dom ?f \<in> Collect Setp \<and> S.Cod ?f \<in> Collect Setp \<and> S.Map ?f \<in> extensional (S.Dom ?f) \<inter> (S.Dom ?f \<rightarrow> S.Cod ?f))

goal (1 subgoal):
 1. S.arr f = (f \<noteq> S.Null \<and> Setp (S.Dom f) \<and> Setp (S.Cod f) \<and> S.Map f \<in> extensional (S.Dom f) \<inter> (S.Dom f \<rightarrow> S.Cod f))
[PROOF STEP]
by auto


[STATEMENT]
lemma "ipv6addr_toString (ipv6preferred_to_int
           (IPv6AddrPreferred 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff 0xffff)) =
              ''ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff''"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ipv6addr_toString (ipv6preferred_to_int (IPv6AddrPreferred 65535 65535 65535 65535 65535 65535 65535 65535)) = ''ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff''
[PROOF STEP]
by eval


[STATEMENT]
lemma (in equivalence) disjoint_sum:
  assumes "finite (carrier S)"
  shows "(\<Sum>c\<in>classes. \<Sum>x\<in>c. f x) = (\<Sum>x\<in>(carrier S). f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (sum f) classes = sum f (carrier S)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum (sum f) classes = sum f (carrier S)
[PROOF STEP]
have "finite classes"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite classes
[PROOF STEP]
unfolding eq_classes_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {class_of x |x. x \<in> carrier S}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite (carrier S)

goal (1 subgoal):
 1. finite {class_of x |x. x \<in> carrier S}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite classes

goal (1 subgoal):
 1. sum (sum f) classes = sum f (carrier S)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
finite classes

goal (1 subgoal):
 1. sum (sum f) classes = sum f (carrier S)
[PROOF STEP]
using disjoint_sum assms partition_from_equivalence
[PROOF STATE]
proof (prove)
using this:
finite classes
\<lbrakk>finite ?B; finite ?A; Congruence.partition ?A ?B\<rbrakk> \<Longrightarrow> sum (sum ?f) ?B = sum ?f ?A
finite (carrier S)
Congruence.partition (carrier S) classes

goal (1 subgoal):
 1. sum (sum f) classes = sum f (carrier S)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sum (sum f) classes = sum f (carrier S)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inv_rbt_baliL: "inv2 l \<Longrightarrow> inv2 r \<Longrightarrow> inv1l l \<Longrightarrow> inv1 r \<Longrightarrow> bheight l = bheight r \<Longrightarrow>
  inv1 (rbt_baliL l a b r) \<and> inv2 (rbt_baliL l a b r) \<and> bheight (rbt_baliL l a b r) = Suc (bheight l)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>inv2 l; inv2 r; inv1l l; inv1 r; bheight l = bheight r\<rbrakk> \<Longrightarrow> inv1 (rbt_baliL l a b r) \<and> inv2 (rbt_baliL l a b r) \<and> bheight (rbt_baliL l a b r) = Suc (bheight l)
[PROOF STEP]
by (induct l a b r rule: rbt_baliL.induct) auto


[STATEMENT]
lemma card_order_cexp:
  assumes "card_order r1" "card_order r2"
  shows "card_order (r1 ^c r2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_order (r1 ^c r2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card_order (r1 ^c r2)
[PROOF STEP]
have "Field r1 = UNIV" "Field r2 = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Field r1 = UNIV &&& Field r2 = UNIV
[PROOF STEP]
using assms card_order_on_Card_order
[PROOF STATE]
proof (prove)
using this:
card_order r1
card_order r2
card_order_on ?A ?r \<Longrightarrow> ?A = Field ?r \<and> Card_order ?r

goal (1 subgoal):
 1. Field r1 = UNIV &&& Field r2 = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Field r1 = UNIV
Field r2 = UNIV

goal (1 subgoal):
 1. card_order (r1 ^c r2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
Field r1 = UNIV
Field r2 = UNIV

goal (1 subgoal):
 1. card_order (r1 ^c r2)
[PROOF STEP]
unfolding cexp_def Func_def
[PROOF STATE]
proof (prove)
using this:
Field r1 = UNIV
Field r2 = UNIV

goal (1 subgoal):
 1. card_order |{f. (\<forall>a\<in>Field r2. f a \<in> Field r1) \<and> (\<forall>a. a \<notin> Field r2 \<longrightarrow> f a = undefined)}|
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card_order (r1 ^c r2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma step_eps_closure_set_q0: "step_eps_closure_set {q0} bs \<subseteq> {q0, qf} \<union>
  (nfa'.step_eps_closure_set {q0'} bs \<inter> nfa'.SQ)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. step_eps_closure_set {q0} bs \<subseteq> {q0, qf} \<union> nfa'.step_eps_closure_set {q0'} bs \<inter> nfa'.SQ
[PROOF STEP]
unfolding NFA.step_eps_closure_set_def NFA.step_eps_closure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>q\<in>{q0}. Collect ((step_eps bs)\<^sup>*\<^sup>* q)) \<subseteq> {q0, qf} \<union> (\<Union>q\<in>{q0'}. Collect ((nfa'.step_eps bs)\<^sup>*\<^sup>* q)) \<inter> nfa'.SQ
[PROOF STEP]
using rtranclp_step_eps_q0_q0'
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(step_eps ?bs)\<^sup>*\<^sup>* ?q ?q'; ?q = q0\<rbrakk> \<Longrightarrow> ?q' \<in> {q0, qf} \<or> ?q' \<in> nfa'.SQ \<and> (nfa'.step_eps ?bs)\<^sup>*\<^sup>* q0' ?q'

goal (1 subgoal):
 1. (\<Union>q\<in>{q0}. Collect ((step_eps bs)\<^sup>*\<^sup>* q)) \<subseteq> {q0, qf} \<union> (\<Union>q\<in>{q0'}. Collect ((nfa'.step_eps bs)\<^sup>*\<^sup>* q)) \<inter> nfa'.SQ
[PROOF STEP]
by auto


[STATEMENT]
lemma sets_distinct6: "(s::int) < g \<Longrightarrow> {(a::int, b::int).  g < a} \<noteq> {(a::int, b::int).  a = s}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s < g \<Longrightarrow> {(a, b). g < a} \<noteq> {(a, b). a = s}
[PROOF STEP]
apply (rule not_sym)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s < g \<Longrightarrow> {(a, b). a = s} \<noteq> {(a, b). g < a}
[PROOF STEP]
apply (rule sets_distinct5)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. s < g \<Longrightarrow> s < g
[PROOF STEP]
by simp


[STATEMENT]
lemma term_variants_pred_fv_eq:
  assumes "term_variants_pred P s t"
  shows "fv s = fv t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv s = fv t
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
term_variants_pred P s t

goal (1 subgoal):
 1. fv s = fv t
[PROOF STEP]
by (induct rule: term_variants_pred.induct)
   (metis, metis fv_eq_FunI, metis fv_eq_FunI)


[STATEMENT]
lemma lm082:
  assumes "X\<inter>Y = {}"
  shows "(P outside Y)``X=P``X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (P outside Y) `` X = P `` X
[PROOF STEP]
using assms Outside_def
[PROOF STATE]
proof (prove)
using this:
X \<inter> Y = {}
?R outside ?X = ?R - ?X \<times> Range ?R

goal (1 subgoal):
 1. (P outside Y) `` X = P `` X
[PROOF STEP]
by blast


[STATEMENT]
lemma import_rel2_pure_conv: "import_rel2 R (pure A) (pure B) = pure (\<langle>A,B\<rangle>R)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. import_rel2 R (pure A) (pure B) = pure (\<langle>A, B\<rangle>R)
[PROOF STEP]
unfolding import_rel2_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>c ci. \<up> (is_pure (pure A) \<and> is_pure (pure B) \<and> (ci, c) \<in> \<langle>the_pure (pure A), the_pure (pure B)\<rangle>R)) = pure (\<langle>A, B\<rangle>R)
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>c ci. \<up> ((ci, c) \<in> \<langle>A, B\<rangle>R)) = pure (\<langle>A, B\<rangle>R)
[PROOF STEP]
apply (simp add: pure_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma hypnat_one_not_prime [simp]: "1 \<notin> starprime"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 \<notin> starprime
[PROOF STEP]
using hypnat_of_nat_one_not_prime
[PROOF STATE]
proof (prove)
using this:
hypnat_of_nat 1 \<notin> starprime

goal (1 subgoal):
 1. 1 \<notin> starprime
[PROOF STEP]
by simp