[STATEMENT]
lemma bij_betw_functions_of:
  assumes "finite A" "finite B"
  shows "bij_betw (functions_of A B) {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} ({f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw (functions_of A B) {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} ({f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B)
[PROOF STEP]
proof (rule bij_betw_byWitness[where f'="number_partition_of A B"])
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. \<forall>a\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B a) = a
 2. \<forall>a'\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B a') = a'
 3. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 4. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
have quotient_eq: "{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> ((A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B). univ (\<lambda>f. inj_on f A) F}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. inj_on f A) F}
[PROOF STEP]
using equiv_domain_and_range_permutation[of A B] inj_on_respects_domain_and_range_permutation[of A B]
[PROOF STATE]
proof (prove)
using this:
equiv (A \<rightarrow>\<^sub>E B) (domain_and_range_permutation A B)
(\<lambda>f. inj_on f A) respects domain_and_range_permutation A B

goal (1 subgoal):
 1. {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. inj_on f A) F}
[PROOF STEP]
by (simp only: univ_preserves_predicate)
[PROOF STATE]
proof (state)
this:
{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B = {F \<in> (A \<rightarrow>\<^sub>E B) // domain_and_range_permutation A B. univ (\<lambda>f. inj_on f A) F}

goal (4 subgoals):
 1. \<forall>a\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B a) = a
 2. \<forall>a'\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B a') = a'
 3. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 4. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
show "\<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B.
       functions_of A B (number_partition_of A B F) = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B F) = F
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. \<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B F) = F
[PROOF STEP]
by (auto simp only: quotient_eq functions_of_number_partition_of)
[PROOF STATE]
proof (state)
this:
\<forall>F\<in>{f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B. functions_of A B (number_partition_of A B F) = F

goal (3 subgoals):
 1. \<forall>a\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B a) = a
 2. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 3. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
show "\<forall>N\<in> {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close> number_partition_of_functions_of
[PROOF STATE]
proof (prove)
using this:
finite A
finite B
\<lbrakk>finite ?A; finite ?B; number_partition (card ?A) ?N; size ?N \<le> card ?B\<rbrakk> \<Longrightarrow> number_partition_of ?A ?B (functions_of ?A ?B ?N) = ?N

goal (1 subgoal):
 1. \<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>N\<in>{N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}. number_partition_of A B (functions_of A B N) = N

goal (2 subgoals):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
 2. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
show "number_partition_of A B ` ({f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B)
    \<subseteq> {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
[PROOF STEP]
by (auto simp add: quotient_eq number_partition_of inj_on_implies_all_one simp del: One_nat_def)
[PROOF STATE]
proof (state)
this:
number_partition_of A B ` {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B \<subseteq> {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}

goal (1 subgoal):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
[PROOF STEP]
show "functions_of A B ` {N. (\<forall>n. n\<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B}
    \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
[PROOF STEP]
using \<open>finite A\<close> \<open>finite B\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
finite B

goal (1 subgoal):
 1. functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B
[PROOF STEP]
by (auto simp add: quotient_eq intro: functions_of functions_of_is_inj_on)
[PROOF STATE]
proof (state)
this:
functions_of A B ` {N. (\<forall>n. n \<in># N \<longrightarrow> n = 1) \<and> number_partition (card A) N \<and> size N \<le> card B} \<subseteq> {f \<in> A \<rightarrow>\<^sub>E B. inj_on f A} // domain_and_range_permutation A B

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma snd_INF: "snd (INF x\<in>A. f x) = (INF x\<in>A. snd (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (Inf (f ` A)) = (INF x\<in>A. snd (f x))
[PROOF STEP]
by (simp add: snd_Inf image_image)


[STATEMENT]
lemma replacement_theorem:
  assumes "independent K (Us' @ Us)" and "independent K Vs"
    and "Span K (Us' @ Us) \<subseteq> Span K Vs"
  shows "\<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> independent K (Vs' @ Us)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
proof (induct "length Us'" arbitrary: Us' Us)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>Us' Us. \<lbrakk>0 = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
 2. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (2 subgoals):
 1. \<And>Us' Us. \<lbrakk>0 = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
 2. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = length ?Us'; local.independent K (?Us' @ ?Us); local.independent K Vs; Span K (?Us' @ ?Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length ?Us' \<and> local.independent K (Vs' @ ?Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n = length ?Us'; local.independent K (?Us' @ ?Us); local.independent K Vs; Span K (?Us' @ ?Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length ?Us' \<and> local.independent K (Vs' @ ?Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs
[PROOF STEP]
obtain u Us'' where Us'': "Us' = Us'' @ [u]"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = length ?Us'; local.independent K (?Us' @ ?Us); local.independent K Vs; Span K (?Us' @ ?Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length ?Us' \<and> local.independent K (Vs' @ ?Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. (\<And>Us'' u. Us' = Us'' @ [u] \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis list.size(3) nat.simps(3) rev_exhaust)
[PROOF STATE]
proof (state)
this:
Us' = Us'' @ [u]

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
Us' = Us'' @ [u]
[PROOF STEP]
obtain Vs' where Vs': "set Vs' \<subseteq> set Vs" "length Vs' = n" "independent K (Vs' @ (u # Us))"
[PROOF STATE]
proof (prove)
using this:
Us' = Us'' @ [u]

goal (1 subgoal):
 1. (\<And>Vs'. \<lbrakk>set Vs' \<subseteq> set Vs; length Vs' = n; local.independent K (Vs' @ u # Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc(1)[of Us'' "u # Us"] Suc(2-5)
[PROOF STATE]
proof (prove)
using this:
Us' = Us'' @ [u]
\<lbrakk>n = length Us''; local.independent K (Us'' @ u # Us); local.independent K Vs; Span K (Us'' @ u # Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us'' \<and> local.independent K (Vs' @ u # Us)
Suc n = length Us'
local.independent K (Us' @ Us)
local.independent K Vs
Span K (Us' @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. (\<And>Vs'. \<lbrakk>set Vs' \<subseteq> set Vs; length Vs' = n; local.independent K (Vs' @ u # Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Vs' \<subseteq> set Vs
length Vs' = n
local.independent K (Vs' @ u # Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
hence li: "independent K ((u # Vs') @ Us)"
[PROOF STATE]
proof (prove)
using this:
set Vs' \<subseteq> set Vs
length Vs' = n
local.independent K (Vs' @ u # Us)

goal (1 subgoal):
 1. local.independent K ((u # Vs') @ Us)
[PROOF STEP]
using independent_same_set[OF _ _ Vs'(3), of "(u # Vs') @ Us"]
[PROOF STATE]
proof (prove)
using this:
set Vs' \<subseteq> set Vs
length Vs' = n
local.independent K (Vs' @ u # Us)
\<lbrakk>set (Vs' @ u # Us) = set ((u # Vs') @ Us); length (Vs' @ u # Us) = length ((u # Vs') @ Us)\<rbrakk> \<Longrightarrow> local.independent K ((u # Vs') @ Us)

goal (1 subgoal):
 1. local.independent K ((u # Vs') @ Us)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
local.independent K ((u # Vs') @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
local.independent K ((u # Vs') @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
have in_carrier:
    "u \<in> carrier R" "set Us \<subseteq> carrier R" "set Us' \<subseteq> carrier R" "set Vs \<subseteq> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (u \<in> carrier R &&& set Us \<subseteq> carrier R) &&& set Us' \<subseteq> carrier R &&& set Vs \<subseteq> carrier R
[PROOF STEP]
using Suc(3-4)[THEN independent_in_carrier] Us''
[PROOF STATE]
proof (prove)
using this:
set (Us' @ Us) \<subseteq> carrier R
set Vs \<subseteq> carrier R
Us' = Us'' @ [u]

goal (1 subgoal):
 1. (u \<in> carrier R &&& set Us \<subseteq> carrier R) &&& set Us' \<subseteq> carrier R &&& set Vs \<subseteq> carrier R
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
have "Span K ((u # Vs') @ Us) \<subseteq> Span K Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
have "set Us \<subseteq> Span K Vs" "u \<in> Span K Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set Us \<subseteq> Span K Vs &&& u \<in> Span K Vs
[PROOF STEP]
using Suc(5) Span_base_incl[of "Us' @ Us"] Us'' in_carrier(2-3)
[PROOF STATE]
proof (prove)
using this:
Span K (Us' @ Us) \<subseteq> Span K Vs
set (Us' @ Us) \<subseteq> carrier R \<Longrightarrow> set (Us' @ Us) \<subseteq> Span K (Us' @ Us)
Us' = Us'' @ [u]
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R

goal (1 subgoal):
 1. set Us \<subseteq> Span K Vs &&& u \<in> Span K Vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
have "set Vs' \<subseteq> Span K Vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set Vs' \<subseteq> Span K Vs
[PROOF STEP]
using Span_base_incl[OF in_carrier(4)] Vs'(1)
[PROOF STATE]
proof (prove)
using this:
set Vs \<subseteq> Span K Vs
set Vs' \<subseteq> set Vs

goal (1 subgoal):
 1. set Vs' \<subseteq> Span K Vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set Vs' \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs
set Vs' \<subseteq> Span K Vs
[PROOF STEP]
have "set ((u # Vs') @ Us) \<subseteq> Span K Vs"
[PROOF STATE]
proof (prove)
using this:
set Us \<subseteq> Span K Vs
u \<in> Span K Vs
set Vs' \<subseteq> Span K Vs

goal (1 subgoal):
 1. set ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
set ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
using mono_Span_subset[OF _ in_carrier(4)]
[PROOF STATE]
proof (prove)
using this:
set ((u # Vs') @ Us) \<subseteq> Span K Vs
set ?Us \<subseteq> Span K Vs \<Longrightarrow> Span K ?Us \<subseteq> Span K Vs

goal (1 subgoal):
 1. Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
by (simp del: Span.simps)
[PROOF STATE]
proof (state)
this:
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
local.independent K ((u # Vs') @ Us)
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
[PROOF STEP]
obtain v where "v \<in> set Vs" "independent K ((v # Vs') @ Us)"
[PROOF STATE]
proof (prove)
using this:
local.independent K ((u # Vs') @ Us)
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> set Vs; local.independent K ((v # Vs') @ Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using independent_replacement[OF _ Suc(4), of u "Vs' @ Us"]
[PROOF STATE]
proof (prove)
using this:
local.independent K ((u # Vs') @ Us)
u \<in> carrier R
set Us \<subseteq> carrier R
set Us' \<subseteq> carrier R
set Vs \<subseteq> carrier R
Span K ((u # Vs') @ Us) \<subseteq> Span K Vs
\<lbrakk>local.independent K (u # Vs' @ Us); Span K (u # Vs' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>v\<in>set Vs. local.independent K (v # Vs' @ Us)

goal (1 subgoal):
 1. (\<And>v. \<lbrakk>v \<in> set Vs; local.independent K ((v # Vs') @ Us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
v \<in> set Vs
local.independent K ((v # Vs') @ Us)

goal (1 subgoal):
 1. \<And>x Us' Us. \<lbrakk>\<And>Us' Us. \<lbrakk>x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us); Suc x = length Us'; local.independent K (Us' @ Us); local.independent K Vs; Span K (Us' @ Us) \<subseteq> Span K Vs\<rbrakk> \<Longrightarrow> \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
v \<in> set Vs
local.independent K ((v # Vs') @ Us)

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
using Vs'(1-2) Suc(2)
[PROOF STATE]
proof (prove)
using this:
v \<in> set Vs
local.independent K ((v # Vs') @ Us)
set Vs' \<subseteq> set Vs
length Vs' = n
Suc n = length Us'

goal (1 subgoal):
 1. \<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)
[PROOF STEP]
by (metis (mono_tags, lifting) insert_subset length_Cons list.simps(15))
[PROOF STATE]
proof (state)
this:
\<exists>Vs'. set Vs' \<subseteq> set Vs \<and> length Vs' = length Us' \<and> local.independent K (Vs' @ Us)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_codim_map:
  "x \<in> X \<Longrightarrow> y \<in> X \<Longrightarrow> card (f`x - f`y) = card (x-y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> card (f ` x - f ` y) = card (x - y)
[PROOF STEP]
using inj inj_on_image_set_diff[of f _ x y] finite_simplex subset_inj_on[of f _ "x-y"]
        inj_on_iff_eq_card[of "x-y"]
[PROOF STATE]
proof (prove)
using this:
inj_on f (\<Union> X)
\<lbrakk>inj_on f ?C; x - y \<subseteq> ?C; y \<subseteq> ?C\<rbrakk> \<Longrightarrow> f ` (x - y) = f ` x - f ` y
?x \<in> X \<Longrightarrow> finite ?x
\<lbrakk>inj_on f ?B; x - y \<subseteq> ?B\<rbrakk> \<Longrightarrow> inj_on f (x - y)
finite (x - y) \<Longrightarrow> inj_on ?f (x - y) = (card (?f ` (x - y)) = card (x - y))

goal (1 subgoal):
 1. \<lbrakk>x \<in> X; y \<in> X\<rbrakk> \<Longrightarrow> card (f ` x - f ` y) = card (x - y)
[PROOF STEP]
by    fastforce


[STATEMENT]
lemma sum_unroll:
  "(\<Sum>k\<le>n::nat. f k) = (if n = 0 then f 0 else f n + (\<Sum>k\<le>n - 1. f k))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum f {..n} = (if n = 0 then f 0 else f n + sum f {..n - 1})
[PROOF STEP]
by (cases n) (simp_all add: add_ac)


[STATEMENT]
lemma cf_cat_prod_21_of_3_is_functor'[cat_cs_intros]:
  assumes "category \<alpha> \<AA>"
    and "category \<alpha> \<BB>"
    and "category \<alpha> \<CC>"
    and "\<AA>' = \<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC>"
    and "\<BB>' = (\<AA> \<times>\<^sub>C \<BB>) \<times>\<^sub>C \<CC>"
  shows "cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
using assms(1-3)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
category \<alpha> \<CC>

goal (1 subgoal):
 1. cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
unfolding assms(4,5)
[PROOF STATE]
proof (prove)
using this:
category \<alpha> \<AA>
category \<alpha> \<BB>
category \<alpha> \<CC>

goal (1 subgoal):
 1. cf_cat_prod_21_of_3 \<AA> \<BB> \<CC> : \<AA> \<times>\<^sub>C\<^sub>3 \<BB> \<times>\<^sub>C\<^sub>3 \<CC> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> (\<AA> \<times>\<^sub>C \<BB>) \<times>\<^sub>C \<CC>
[PROOF STEP]
by (rule cf_cat_prod_21_of_3_is_functor)


[STATEMENT]
lemma lt_dim_vec_MV_Rel[transfer_rule]: "(MV_Rel ===> (=) ===> (=)) (\<lambda> v j. j < dim_vec v) (\<lambda> v j. j < dim_vec v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MV_Rel ===> (=) ===> (=)) (\<lambda>v j. j < dim_vec v) (\<lambda>v j. j < dim_vec v)
[PROOF STEP]
unfolding MV_Rel_def rel_fun_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. vec_mod x = to_int_vec y \<longrightarrow> (\<forall>xa ya. xa = ya \<longrightarrow> (xa < dim_vec x) = (ya < dim_vec y))
[PROOF STEP]
using index_map_vec(2) vec_mod_dim
[PROOF STATE]
proof (prove)
using this:
dim_vec (map_vec ?f ?v) = dim_vec ?v
dim_vec (vec_mod ?v) = dim_vec ?v

goal (1 subgoal):
 1. \<forall>x y. vec_mod x = to_int_vec y \<longrightarrow> (\<forall>xa ya. xa = ya \<longrightarrow> (xa < dim_vec x) = (ya < dim_vec y))
[PROOF STEP]
by metis


[STATEMENT]
lemma open_prod_elim:
  assumes "open S" and "x \<in> S"
  obtains A B where "open A" and "open B" and "x \<in> A \<times> B" and "A \<times> B \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
open S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast


[STATEMENT]
lemma convolution_zero :
  fixes     f g :: "'a::group_add \<Rightarrow> 'b::{comm_monoid_add,mult_zero}"
  shows     "f = 0 \<or> g = 0 \<Longrightarrow> convolution f g = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = 0 \<or> g = 0 \<Longrightarrow> convolution f g = 0
[PROOF STEP]
unfolding convolution_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = 0 \<or> g = 0 \<Longrightarrow> (\<lambda>x. \<Sum>y | x - y \<in> supp f \<and> y \<in> supp g. f (x - y) * g y) = 0
[PROOF STEP]
by        auto


[STATEMENT]
lemma Limit_vpair_in_VsetI[intro]:
  assumes "Limit \<alpha>" and "a \<in>\<^sub>\<circ> Vset \<alpha>" and "b \<in>\<^sub>\<circ> Vset \<alpha>"
  shows "\<langle>a, b\<rangle> \<in>\<^sub>\<circ> Vset \<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> Vset \<alpha>
[PROOF STEP]
using assms Limit_vdoubleton_in_VsetI Limit_vsingleton_in_VsetI
[PROOF STATE]
proof (prove)
using this:
Limit \<alpha>
a \<in>\<^sub>\<circ> Vset \<alpha>
b \<in>\<^sub>\<circ> Vset \<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>; ?b \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a, ?b} \<in>\<^sub>\<circ> Vset ?\<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a} \<in>\<^sub>\<circ> Vset ?\<alpha>

goal (1 subgoal):
 1. \<langle>a, b\<rangle> \<in>\<^sub>\<circ> Vset \<alpha>
[PROOF STEP]
unfolding vpair_def
[PROOF STATE]
proof (prove)
using this:
Limit \<alpha>
a \<in>\<^sub>\<circ> Vset \<alpha>
b \<in>\<^sub>\<circ> Vset \<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>; ?b \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a, ?b} \<in>\<^sub>\<circ> Vset ?\<alpha>
\<lbrakk>Limit ?\<alpha>; ?a \<in>\<^sub>\<circ> Vset ?\<alpha>\<rbrakk> \<Longrightarrow> set {?a} \<in>\<^sub>\<circ> Vset ?\<alpha>

goal (1 subgoal):
 1. set {set {a}, set {a, b}} \<in>\<^sub>\<circ> Vset \<alpha>
[PROOF STEP]
by simp


[STATEMENT]
lemma rel_list_all2_Cons2:
  "list_all2 (fun_of S) xs (y#ys) =
  (\<exists>z zs. xs = z#zs \<and> (z,y) \<in> S \<and> list_all2 (fun_of S) zs ys)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (fun_of S) xs (y # ys) = (\<exists>z zs. xs = z # zs \<and> (z, y) \<in> S \<and> list_all2 (fun_of S) zs ys)
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all2 (fun_of S) xs (y # ys) = (\<exists>z zs. xs = z # zs \<and> (z, y) \<in> S \<and> list_all2 (fun_of S) zs ys)
[PROOF STEP]
by (cases xs) auto


[STATEMENT]
lemma decode_0_iff: "well_base\<^sub>h M \<Longrightarrow> aligned\<^sub>d e M \<Longrightarrow> decode e M = 0 \<longleftrightarrow> M = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>local.well_base\<^sub>h M; local.aligned\<^sub>d e M\<rbrakk> \<Longrightarrow> (local.decode e M = 0) = (M = 0)
[PROOF STEP]
by (metis aligned\<^sub>d_0 decode_0 decode_exp_shift encode_0 less_imp_decode_less mult_0_right neqE
    not_less_zero well_base\<^sub>h_encode)


[STATEMENT]
lemma finite_pderivs_lang_UNIV1:
  shows "finite (pderivs_lang UNIV1 r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (pderivs_lang UNIV1 r)
[PROOF STEP]
apply(induct r)
[PROOF STATE]
proof (prove)
goal (6 subgoals):
 1. finite (pderivs_lang UNIV1 Zero)
 2. finite (pderivs_lang UNIV1 One)
 3. \<And>x. finite (pderivs_lang UNIV1 (Atom x))
 4. \<And>r1 r2. \<lbrakk>finite (pderivs_lang UNIV1 r1); finite (pderivs_lang UNIV1 r2)\<rbrakk> \<Longrightarrow> finite (pderivs_lang UNIV1 (Plus r1 r2))
 5. \<And>r1 r2. \<lbrakk>finite (pderivs_lang UNIV1 r1); finite (pderivs_lang UNIV1 r2)\<rbrakk> \<Longrightarrow> finite (pderivs_lang UNIV1 (Times r1 r2))
 6. \<And>r. finite (pderivs_lang UNIV1 r) \<Longrightarrow> finite (pderivs_lang UNIV1 (Star r))
[PROOF STEP]
apply(simp_all add:
  finite_subset[OF pderivs_lang_Times]
  finite_subset[OF pderivs_lang_Star])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma div_Suc: "
  0 < n \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)
[PROOF STEP]
apply (drule Suc_leI, drule le_imp_less_or_eq)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 < n \<or> Suc 0 = n \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)
[PROOF STEP]
apply (case_tac "n = Suc 0", simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0\<rbrakk> \<Longrightarrow> Suc m div n = (if Suc (m mod n) = n then Suc (m div n) else m div n)
[PROOF STEP]
apply (split if_split, intro conjI impI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) = n\<rbrakk> \<Longrightarrow> Suc m div n = Suc (m div n)
 2. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (rule_tac t="Suc m" and s="m + 1" in subst, simp)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) = n\<rbrakk> \<Longrightarrow> (m + 1) div n = Suc (m div n)
 2. \<lbrakk>Suc 0 < n \<or> Suc 0 = n; n \<noteq> Suc 0; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (subst div_add1_eq2, simp+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Suc 0 < n; Suc (m mod n) \<noteq> n\<rbrakk> \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (insert le_neq_trans[OF mod_less_divisor[THEN Suc_leI, of n m]], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (m mod n) < n \<Longrightarrow> Suc m div n = m div n
[PROOF STEP]
apply (rule_tac t="Suc m" and s="m + 1" in subst, simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (m mod n) < n \<Longrightarrow> (m + 1) div n = m div n
[PROOF STEP]
apply (subst div_add1_eq1, simp+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma fds_abs_converges_prod:
  fixes s :: "'a :: {nat_power, real_normed_field, banach, second_countable_topology}"
  shows "(\<And>x. x \<in> A \<Longrightarrow> fds_abs_converges (f x) s) \<Longrightarrow> fds_abs_converges (prod f A) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> A \<Longrightarrow> fds_abs_converges (f x) s) \<Longrightarrow> fds_abs_converges (prod f A) s
[PROOF STEP]
by (induction A rule: infinite_finite_induct) (auto intro!: fds_abs_converges_mult)


[STATEMENT]
lemma UINF_refines:
  "\<lbrakk> \<And> i. i\<in>I \<Longrightarrow> P \<sqsubseteq> Q i \<rbrakk> \<Longrightarrow> P \<sqsubseteq> (\<Sqinter> i\<in>I \<bullet> Q i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> P \<sqsubseteq> Q i) \<Longrightarrow> P \<sqsubseteq> (\<Sqinter> i \<in> I \<bullet> Q i)
[PROOF STEP]
by (simp add: UINF_as_Sup_collect, metis SUP_least)


[STATEMENT]
lemma confluentp_eq_semiconfluentp: "confluentp r \<longleftrightarrow> semiconfluentp r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. confluentp r = semiconfluentp r
[PROOF STEP]
by(blast intro: semiconfluentp_imp_confluentp confluentp_imp_semiconfluentp)


[STATEMENT]
lemma walk_array_append:
  "walk_array f (Array (xs@[x])) b = f (walk_array f (Array xs) b) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. walk_array f (Array (xs @ [x])) b = f (walk_array f (Array xs) b) x
[PROOF STEP]
by (induct xs arbitrary: b) (simp add: walk_array_def, simp add: walk_array_Cons)


[STATEMENT]
lemma mat_of_col_last_nth[simp]:
  "\<lbrakk> i < n; i < dim_col A \<rbrakk> \<Longrightarrow> col (mat_col_last A n) i = col A (dim_col A - n + i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < n; i < dim_col A\<rbrakk> \<Longrightarrow> col (mat_col_last A n) i = col A (dim_col A - n + i)
[PROOF STEP]
unfolding mat_col_last_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i < n; i < dim_col A\<rbrakk> \<Longrightarrow> col (mat_row_last A\<^sup>T n)\<^sup>T i = col A (dim_col A - n + i)
[PROOF STEP]
by auto


[STATEMENT]
lemma wf_tuple_restrict: "wf_tuple n B v \<Longrightarrow> A \<inter> B = C \<Longrightarrow> wf_tuple n C (restrict A v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>wf_tuple n B v; A \<inter> B = C\<rbrakk> \<Longrightarrow> wf_tuple n C (restrict A v)
[PROOF STEP]
unfolding restrict_def wf_tuple_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>length v = n \<and> (\<forall>i<n. (v ! i = None) = (i \<notin> B)); A \<inter> B = C\<rbrakk> \<Longrightarrow> length (map (\<lambda>i. if i \<in> A then v ! i else None) [0..<length v]) = n \<and> (\<forall>i<n. (map (\<lambda>i. if i \<in> A then v ! i else None) [0..<length v] ! i = None) = (i \<notin> C))
[PROOF STEP]
by auto


[STATEMENT]
lemma M_is_Z_iff_1_is_top:
  "M = Z \<longleftrightarrow> 1 = top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M = Z) = ((1::'a) = top)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. M = Z \<Longrightarrow> (1::'a) = top
 2. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
assume "M = Z"
[PROOF STATE]
proof (state)
this:
M = Z

goal (2 subgoals):
 1. M = Z \<Longrightarrow> (1::'a) = top
 2. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
hence "Z = S\<^sup>T * Z"
[PROOF STATE]
proof (prove)
using this:
M = Z

goal (1 subgoal):
 1. Z = S[[Z]]
[PROOF STEP]
by (metis S_mapping Z_point order.antisym bijective_reverse inf.eq_refl shunt_mapping)
[PROOF STATE]
proof (state)
this:
Z = S[[Z]]

goal (2 subgoals):
 1. M = Z \<Longrightarrow> (1::'a) = top
 2. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
thus "1 = top"
[PROOF STATE]
proof (prove)
using this:
Z = S[[Z]]

goal (1 subgoal):
 1. (1::'a) = top
[PROOF STEP]
by (metis S_star_Z_top Z_point inf.eq_refl star_left_induct sup.absorb2 symmetric_top_closed top_le)
[PROOF STATE]
proof (state)
this:
(1::'a) = top

goal (1 subgoal):
 1. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
assume "1 = top"
[PROOF STATE]
proof (state)
this:
(1::'a) = top

goal (1 subgoal):
 1. (1::'a) = top \<Longrightarrow> M = Z
[PROOF STEP]
thus "M = Z"
[PROOF STATE]
proof (prove)
using this:
(1::'a) = top

goal (1 subgoal):
 1. M = Z
[PROOF STEP]
using S_mapping comp_right_one mult_1_left
[PROOF STATE]
proof (prove)
using this:
(1::'a) = top
coreflexive (S[[S]]) \<and> times_top_class.total S
?x * (1::'a) = ?x
(1::'a) * ?a = ?a

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma n_kat_21_opp:  "y \<cdot> n z \<le> n x \<cdot> y \<Longrightarrow> n x \<cdot> y \<cdot> n z = y \<cdot> n z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
assume "y \<cdot> n z \<le> n x \<cdot> y"
[PROOF STATE]
proof (state)
this:
y \<cdot> !z \<le> !x \<cdot> y

goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
hence "y \<cdot> n z + n x \<cdot> y = n x \<cdot> y"
[PROOF STATE]
proof (prove)
using this:
y \<cdot> !z \<le> !x \<cdot> y

goal (1 subgoal):
 1. y \<cdot> !z + !x \<cdot> y = !x \<cdot> y
[PROOF STEP]
by (meson local.join.sup_absorb2)
[PROOF STATE]
proof (state)
this:
y \<cdot> !z + !x \<cdot> y = !x \<cdot> y

goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
hence "n x \<cdot> y \<cdot> n z = y \<cdot> n z + (n x \<cdot> (y \<cdot> n z) + 0)"
[PROOF STATE]
proof (prove)
using this:
y \<cdot> !z + !x \<cdot> y = !x \<cdot> y

goal (1 subgoal):
 1. !x \<cdot> y \<cdot> !z = y \<cdot> !z + (!x \<cdot> (y \<cdot> !z) + (0::'a))
[PROOF STEP]
by (metis local.add_zeror local.distrib_right' local.n_mult_idem mult_assoc)
[PROOF STATE]
proof (state)
this:
!x \<cdot> y \<cdot> !z = y \<cdot> !z + (!x \<cdot> (y \<cdot> !z) + (0::'a))

goal (1 subgoal):
 1. y \<cdot> !z \<le> !x \<cdot> y \<Longrightarrow> !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
!x \<cdot> y \<cdot> !z = y \<cdot> !z + (!x \<cdot> (y \<cdot> !z) + (0::'a))

goal (1 subgoal):
 1. !x \<cdot> y \<cdot> !z = y \<cdot> !z
[PROOF STEP]
by (metis local.add_zeror local.distrib_right' local.join.sup_absorb2 local.join.sup_left_commute local.mult_onel local.n_subid')
[PROOF STATE]
proof (state)
this:
!x \<cdot> y \<cdot> !z = y \<cdot> !z

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma unique_ConsD: "unique (x#xs) \<Longrightarrow> unique xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unique (x # xs) \<Longrightarrow> unique xs
[PROOF STEP]
by (simp add: unique_def)


[STATEMENT]
lemma sunflower_nonempty_core_lift:
  assumes finE: "finite (E :: 'a set)"
    and sunflower: "\<And> G :: 'a set set.
     (\<forall> A \<in> G. finite A \<and> card A \<le> k) \<Longrightarrow> card G > c
        \<Longrightarrow> \<exists> S. S \<subseteq> G \<and> sunflower S \<and> card S = r"
    and F: "\<forall> A \<in> F. A \<subseteq> E \<and> card A \<le> k"
    and empty: "{} \<notin> F"
    and cardF: "card F > card E * c"
  shows "\<exists> S. S \<subseteq> F \<and> sunflower S \<and> card S = r \<and> (\<Inter> S) \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
proof (cases "r = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
r \<noteq> 0

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
from F empty
[PROOF STATE]
proof (chain)
picking this:
\<forall>A\<in>F. A \<subseteq> E \<and> card A \<le> k
{} \<notin> F
[PROOF STEP]
have F': "\<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k "
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>F. A \<subseteq> E \<and> card A \<le> k
{} \<notin> F

goal (1 subgoal):
 1. \<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k
[PROOF STEP]
using finE
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>F. A \<subseteq> E \<and> card A \<le> k
{} \<notin> F
finite E

goal (1 subgoal):
 1. \<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k
[PROOF STEP]
by (metis One_nat_def Suc_leI card_gt_0_iff finite_subset)
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>F. A \<subseteq> E \<and> 1 \<le> card A \<and> card A \<le> k

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
from cardF
[PROOF STATE]
proof (chain)
picking this:
card E * c < card F
[PROOF STEP]
have cardF': "(card E choose 1) * c < card F"
[PROOF STATE]
proof (prove)
using this:
card E * c < card F

goal (1 subgoal):
 1. (card E choose 1) * c < card F
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(card E choose 1) * c < card F

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
from sunflower_card_core_lift[OF finE sunflower, of k c F 1, OF _ _ F' cardF' _ False]
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> \<forall>A\<in>G. finite A \<and> card A \<le> k; \<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> c < card G; 1 \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> 1 \<le> card (\<Inter> S)
[PROOF STEP]
obtain S where "S \<subseteq> F" and main: "sunflower S" "card S = r" "1 \<le> card (\<Inter> S)"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> \<forall>A\<in>G. finite A \<and> card A \<le> k; \<And>G. \<lbrakk>\<forall>A\<in>G. finite A \<and> card A \<le> k; c < card G\<rbrakk> \<Longrightarrow> c < card G; 1 \<noteq> 0\<rbrakk> \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> 1 \<le> card (\<Inter> S)

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>S \<subseteq> F; sunflower S; card S = r; 1 \<le> card (\<Inter> S)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
S \<subseteq> F
sunflower S
card S = r
1 \<le> card (\<Inter> S)

goal (2 subgoals):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
 2. r \<noteq> 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> F
sunflower S
card S = r
1 \<le> card (\<Inter> S)

goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
by (intro exI[of _ S], auto)
[PROOF STATE]
proof (state)
this:
\<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}

goal (1 subgoal):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
r = 0

goal (1 subgoal):
 1. r = 0 \<Longrightarrow> \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
r = 0

goal (1 subgoal):
 1. \<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}
[PROOF STEP]
by (intro exI[of _ "{}"], auto simp: empty_sunflower)
[PROOF STATE]
proof (state)
this:
\<exists>S\<subseteq>F. sunflower S \<and> card S = r \<and> \<Inter> S \<noteq> {}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bool_to_ternary_simp3: "eval_ternary_Not (bool_to_ternary X) = TernaryTrue \<longleftrightarrow> \<not> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eval_ternary_Not (bool_to_ternary X) = TernaryTrue) = (\<not> X)
[PROOF STEP]
by (metis (full_types) bool_to_ternary_simp2 eval_ternary_Not.simps(1) eval_ternary_idempotence_Not)


[STATEMENT]
lemma dist_geq_iff_midpoint_in_between:
  fixes A B X :: "'a::euclidean_space"
  assumes "between (A, B) X"
  shows "dist A X \<le> dist B X \<longleftrightarrow> between (X, B) (midpoint A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (dist A X \<le> dist B X) = between (X, B) (midpoint A B)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
assume "dist A X \<le> dist B X"
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist B X

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from \<open>between (A, B) X\<close> this
[PROOF STATE]
proof (chain)
picking this:
between (A, B) X
dist A X \<le> dist B X
[PROOF STEP]
obtain u
    where u: "1 / 2 \<le> u" "u \<le> 1" and X: "X = u *\<^sub>R A + (1 - u) *\<^sub>R B"
[PROOF STATE]
proof (prove)
using this:
between (A, B) X
dist A X \<le> dist B X

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>1 / 2 \<le> u; u \<le> 1; X = u *\<^sub>R A + (1 - u) *\<^sub>R B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using betweenE_if_dist_leq
[PROOF STATE]
proof (prove)
using this:
between (A, B) X
dist A X \<le> dist B X
\<lbrakk>between (?A, ?B) ?X; dist ?A ?X \<le> dist ?B ?X; \<And>u. \<lbrakk>1 / 2 \<le> u; u \<le> 1; ?X = u *\<^sub>R ?A + (1 - u) *\<^sub>R ?B\<rbrakk> \<Longrightarrow> ?thesis\<rbrakk> \<Longrightarrow> ?thesis

goal (1 subgoal):
 1. (\<And>u. \<lbrakk>1 / 2 \<le> u; u \<le> 1; X = u *\<^sub>R A + (1 - u) *\<^sub>R B\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
1 / 2 \<le> u
u \<le> 1
X = u *\<^sub>R A + (1 - u) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
have M: "midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B
[PROOF STEP]
unfolding midpoint_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A + B) /\<^sub>R 2 = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B
[PROOF STEP]
by (simp add: scaleR_add_right)
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from \<open>1 / 2 \<le> u\<close>
[PROOF STATE]
proof (chain)
picking this:
1 / 2 \<le> u
[PROOF STEP]
have 1: "midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - (1 / (2 * u))) *\<^sub>R B"
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u

goal (1 subgoal):
 1. midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
have "(2 - u * 2) / (2 * u) = 1 / u - u / u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (2 - u * 2) / (2 * u) = 1 / u - u / u
[PROOF STEP]
using u(1)
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u

goal (1 subgoal):
 1. (2 - u * 2) / (2 * u) = 1 / u - u / u
[PROOF STEP]
by (simp add: diff_divide_distrib)
[PROOF STATE]
proof (state)
this:
(2 - u * 2) / (2 * u) = 1 / u - u / u

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(2 - u * 2) / (2 * u) = 1 / u - u / u

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
have "\<dots> = 1 / u - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 / u - u / u = 1 / u - 1
[PROOF STEP]
using u(1)
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u

goal (1 subgoal):
 1. 1 / u - u / u = 1 / u - 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1 / u - u / u = 1 / u - 1

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(2 - u * 2) / (2 * u) = 1 / u - 1
[PROOF STEP]
have "(2 - u * 2) / (2 * u) = 1 / u - 1"
[PROOF STATE]
proof (prove)
using this:
(2 - u * 2) / (2 * u) = 1 / u - 1

goal (1 subgoal):
 1. (2 - u * 2) / (2 * u) = 1 / u - 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(2 - u * 2) / (2 * u) = 1 / u - 1

goal (1 subgoal):
 1. 1 / 2 \<le> u \<Longrightarrow> midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
from \<open>1 / 2 \<le> u\<close> this
[PROOF STATE]
proof (chain)
picking this:
1 / 2 \<le> u
(2 - u * 2) / (2 * u) = 1 / u - 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u
(2 - u * 2) / (2 * u) = 1 / u - 1

goal (1 subgoal):
 1. midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
using X M
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u
(2 - u * 2) / (2 * u) = 1 / u - 1
X = u *\<^sub>R A + (1 - u) *\<^sub>R B
midpoint A B = (1 / 2) *\<^sub>R A + (1 / 2) *\<^sub>R B

goal (1 subgoal):
 1. midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
[PROOF STEP]
by (simp add: scaleR_add_right scaleR_add_left[symmetric])
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from u
[PROOF STATE]
proof (chain)
picking this:
1 / 2 \<le> u
u \<le> 1
[PROOF STEP]
have 2: "(1 / (2 * u)) \<ge> 0" "(1 / (2 * u)) \<le> 1"
[PROOF STATE]
proof (prove)
using this:
1 / 2 \<le> u
u \<le> 1

goal (1 subgoal):
 1. 0 \<le> 1 / (2 * u) &&& 1 / (2 * u) \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1

goal (2 subgoals):
 1. dist A X \<le> dist B X \<Longrightarrow> between (X, B) (midpoint A B)
 2. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1
[PROOF STEP]
show "between (X, B) (midpoint A B)"
[PROOF STATE]
proof (prove)
using this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1

goal (1 subgoal):
 1. between (X, B) (midpoint A B)
[PROOF STEP]
using betweenI [of concl: B X]
[PROOF STATE]
proof (prove)
using this:
midpoint A B = (1 / (2 * u)) *\<^sub>R X + (1 - 1 / (2 * u)) *\<^sub>R B
0 \<le> 1 / (2 * u)
1 / (2 * u) \<le> 1
\<lbrakk>0 \<le> ?u; ?u \<le> 1; ?x = (1 - ?u) *\<^sub>R B + ?u *\<^sub>R X\<rbrakk> \<Longrightarrow> between (B, X) ?x

goal (1 subgoal):
 1. between (X, B) (midpoint A B)
[PROOF STEP]
by (metis add.commute between_commute)
[PROOF STATE]
proof (state)
this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
assume "between (X, B) (midpoint A B)"
[PROOF STATE]
proof (state)
this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
between (X, B) (midpoint A B)
[PROOF STEP]
have "between (A, midpoint A B) X"
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. between (A, midpoint A B) X
[PROOF STEP]
using \<open>between (A, B) X\<close> between_midpoint(1) between_swap
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)
between (A, B) X
between (?a, ?b) (midpoint ?a ?b)
\<lbrakk>between (?A, ?B) ?X; between (?A, ?B) ?Y\<rbrakk> \<Longrightarrow> between (?X, ?B) ?Y = between (?A, ?Y) ?X

goal (1 subgoal):
 1. between (A, midpoint A B) X
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
between (A, midpoint A B) X

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
between (A, midpoint A B) X
[PROOF STEP]
have "dist A X \<le> dist A (midpoint A B)"
[PROOF STATE]
proof (prove)
using this:
between (A, midpoint A B) X

goal (1 subgoal):
 1. dist A X \<le> dist A (midpoint A B)
[PROOF STEP]
using between zero_le_dist
[PROOF STATE]
proof (prove)
using this:
between (A, midpoint A B) X
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)
0 \<le> dist ?x ?y

goal (1 subgoal):
 1. dist A X \<le> dist A (midpoint A B)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist A (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist A (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
have "dist A (midpoint A B) \<le> dist B (midpoint A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist A (midpoint A B) \<le> dist B (midpoint A B)
[PROOF STEP]
by (simp add: dist_midpoint)
[PROOF STATE]
proof (state)
this:
dist A (midpoint A B) \<le> dist B (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
dist A (midpoint A B) \<le> dist B (midpoint A B)

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
from \<open>between (X, B) (midpoint A B)\<close>
[PROOF STATE]
proof (chain)
picking this:
between (X, B) (midpoint A B)
[PROOF STEP]
have "dist B (midpoint A B) \<le> dist B X"
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)

goal (1 subgoal):
 1. dist B (midpoint A B) \<le> dist B X
[PROOF STEP]
using between zero_le_dist
[PROOF STATE]
proof (prove)
using this:
between (X, B) (midpoint A B)
between (?a, ?b) ?x = (dist ?a ?b = dist ?a ?x + dist ?x ?b)
0 \<le> dist ?x ?y

goal (1 subgoal):
 1. dist B (midpoint A B) \<le> dist B X
[PROOF STEP]
by (metis add.commute dist_commute le_add_same_cancel1)
[PROOF STATE]
proof (state)
this:
dist B (midpoint A B) \<le> dist B X

goal (1 subgoal):
 1. between (X, B) (midpoint A B) \<Longrightarrow> dist A X \<le> dist B X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
dist A X \<le> dist B X
[PROOF STEP]
show "dist A X \<le> dist B X"
[PROOF STATE]
proof (prove)
using this:
dist A X \<le> dist B X

goal (1 subgoal):
 1. dist A X \<le> dist B X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
dist A X \<le> dist B X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma open_prod_elim:
  assumes "open S" and "x \<in> S"
  obtains A B where "open A" and "open B" and "x \<in> A \<times> B" and "A \<times> B \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
open S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding open_prod_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S
x \<in> S

goal (1 subgoal):
 1. (\<And>A B. \<lbrakk>open A; open B; x \<in> A \<times> B; A \<times> B \<subseteq> S\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by fast


[STATEMENT]
lemma of_complex_prod[simp]: "of_complex (prod f s) = (\<Prod>x\<in>s. of_complex (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_complex (prod f s) = (\<Prod>x\<in>s. of_complex (f x))
[PROOF STEP]
by (induct s rule: infinite_finite_induct) auto


[STATEMENT]
lemma sum_order_add_mset: "(\<And> x . f x \<ge> 0) \<Longrightarrow> (\<Sum> x \<in># A. f x ) \<le> (\<Sum> x \<in># add_mset a A. f x )"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. (0::'a) \<le> f x) \<Longrightarrow> \<Sum>\<^sub># (image_mset f A) \<le> \<Sum>\<^sub># (image_mset f (add_mset a A))
[PROOF STEP]
by (simp add: local.add_increasing)


[STATEMENT]
lemma create_ldeep_inorder[simp]: "left_deep t \<Longrightarrow> create_ldeep (inorder t) = t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. left_deep t \<Longrightarrow> create_ldeep (inorder t) = t
[PROOF STEP]
apply(induction t)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. left_deep (Relation x) \<Longrightarrow> create_ldeep (inorder (Relation x)) = Relation x
 2. \<And>t1 t2. \<lbrakk>left_deep t1 \<Longrightarrow> create_ldeep (inorder t1) = t1; left_deep t2 \<Longrightarrow> create_ldeep (inorder t2) = t2; left_deep (Join t1 t2)\<rbrakk> \<Longrightarrow> create_ldeep (inorder (Join t1 t2)) = Join t1 t2
[PROOF STEP]
apply (simp add: create_ldeep_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>t1 t2. \<lbrakk>left_deep t1 \<Longrightarrow> create_ldeep (inorder t1) = t1; left_deep t2 \<Longrightarrow> create_ldeep (inorder t2) = t2; left_deep (Join t1 t2)\<rbrakk> \<Longrightarrow> create_ldeep (inorder (Join t1 t2)) = Join t1 t2
[PROOF STEP]
by (metis Nil_is_append_conv create_ldeep_snoc inorder.simps
      ldeep_trans left_deep.simps(3) not_Cons_self2 relations_mset.cases)


[STATEMENT]
lemma last_subset:
  assumes "A \<subseteq> {a,b}"
  and "a\<noteq> b"
and "A \<noteq> {a, b}"
and "A\<noteq> {}"
and "A \<noteq> {a}"
shows "A = {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = {b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {a, b}
a \<noteq> b
A \<noteq> {a, b}
A \<noteq> {}
A \<noteq> {a}

goal (1 subgoal):
 1. A = {b}
[PROOF STEP]
by blast


[STATEMENT]
lemma ffilter_transfer [transfer_rule]:
  assumes "bi_unique A"
  shows "((A ===> (=)) ===> rel_fset A ===> rel_fset A) ffilter ffilter"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> (=)) ===> rel_fset A ===> rel_fset A) ffilter ffilter
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bi_unique A

goal (1 subgoal):
 1. ((A ===> (=)) ===> rel_fset A ===> rel_fset A) ffilter ffilter
[PROOF STEP]
unfolding rel_fun_def
[PROOF STATE]
proof (prove)
using this:
bi_unique A

goal (1 subgoal):
 1. \<forall>x y. (\<forall>xa ya. A xa ya \<longrightarrow> x xa = y ya) \<longrightarrow> (\<forall>xa ya. rel_fset A xa ya \<longrightarrow> rel_fset A (ffilter x xa) (ffilter y ya))
[PROOF STEP]
using Lifting_Set.filter_transfer[unfolded rel_fun_def, rule_format, Transfer.transferred]
[PROOF STATE]
proof (prove)
using this:
bi_unique A
\<lbrakk>bi_unique ?A; \<And>x y. ?A x y \<Longrightarrow> ?x x = ?y y; rel_fset ?A ?xa ?ya\<rbrakk> \<Longrightarrow> rel_fset ?A (ffilter ?x ?xa) (ffilter ?y ?ya)

goal (1 subgoal):
 1. \<forall>x y. (\<forall>xa ya. A xa ya \<longrightarrow> x xa = y ya) \<longrightarrow> (\<forall>xa ya. rel_fset A xa ya \<longrightarrow> rel_fset A (ffilter x xa) (ffilter y ya))
[PROOF STEP]
by blast


[STATEMENT]
lemma parts_UN [simp]: "parts(\<Union>x\<in>A. H x) = (\<Union>x\<in>A. parts(H x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parts (\<Union> (H ` A)) = (\<Union>x\<in>A. parts (H x))
[PROOF STEP]
by (intro equalityI parts_UN_subset1 parts_UN_subset2)


[STATEMENT]
lemma on_tripleD[dest]:
  assumes "((l1,v1,v2),(l2,v3,v4)) \<in> on_triple R"
  shows "l2 = l1" "(v1,v3)\<in> R" "(v2,v4) \<in> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2 = l1 &&& (v1, v3) \<in> R &&& (v2, v4) \<in> R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((l1, v1, v2), l2, v3, v4) \<in> on_triple R

goal (1 subgoal):
 1. l2 = l1 &&& (v1, v3) \<in> R &&& (v2, v4) \<in> R
[PROOF STEP]
unfolding on_triple_def
[PROOF STATE]
proof (prove)
using this:
((l1, v1, v2), l2, v3, v4) \<in> {((l, s, t), l', s', t'). l = l' \<and> (s, s') \<in> R \<and> (t, t') \<in> R}

goal (1 subgoal):
 1. l2 = l1 &&& (v1, v3) \<in> R &&& (v2, v4) \<in> R
[PROOF STEP]
by auto


[STATEMENT]
lemma (in ring) mono_generate_ring:
  assumes "I \<subseteq> J" and "J \<subseteq> carrier R"
  shows "generate_ring R I \<subseteq> generate_ring R J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
have "I \<subseteq> generate_ring R J "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<subseteq> generate_ring R J
[PROOF STEP]
using assms generate_ringE(2)
[PROOF STATE]
proof (prove)
using this:
I \<subseteq> J
J \<subseteq> carrier R
\<lbrakk>?H \<subseteq> carrier R; ?E = generate_ring R ?H\<rbrakk> \<Longrightarrow> ?H \<subseteq> ?E

goal (1 subgoal):
 1. I \<subseteq> generate_ring R J
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
I \<subseteq> generate_ring R J

goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
thus "generate_ring R I \<subseteq> generate_ring R J"
[PROOF STATE]
proof (prove)
using this:
I \<subseteq> generate_ring R J

goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
using generate_ring_min_subring1[of I "generate_ring R J"] assms generate_ring_is_subring[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
I \<subseteq> generate_ring R J
\<lbrakk>I \<subseteq> carrier R; subring (generate_ring R J) R; I \<subseteq> generate_ring R J\<rbrakk> \<Longrightarrow> generate_ring R I \<subseteq> generate_ring R J
I \<subseteq> J
J \<subseteq> carrier R
subring (generate_ring R J) R

goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
generate_ring R I \<subseteq> generate_ring R J

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma listgcd_greatest_mult: "(\<And> x :: 'a. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
 2. \<And>a xs. \<lbrakk>(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z; \<And>x. x \<in> set (a # xs) \<Longrightarrow> y dvd x * z\<rbrakk> \<Longrightarrow> y dvd listgcd (a # xs) * z
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
?x1 \<in> set (x # xs) \<Longrightarrow> y dvd ?x1 * z

goal (2 subgoals):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
 2. \<And>a xs. \<lbrakk>(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z; \<And>x. x \<in> set (a # xs) \<Longrightarrow> y dvd x * z\<rbrakk> \<Longrightarrow> y dvd listgcd (a # xs) * z
[PROOF STEP]
from Cons
[PROOF STATE]
proof (chain)
picking this:
(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
?x1 \<in> set (x # xs) \<Longrightarrow> y dvd ?x1 * z
[PROOF STEP]
have "y dvd x * z" "y dvd listgcd xs * z"
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
?x1 \<in> set (x # xs) \<Longrightarrow> y dvd ?x1 * z

goal (1 subgoal):
 1. y dvd x * z &&& y dvd listgcd xs * z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y dvd x * z
y dvd listgcd xs * z

goal (2 subgoals):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
 2. \<And>a xs. \<lbrakk>(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z; \<And>x. x \<in> set (a # xs) \<Longrightarrow> y dvd x * z\<rbrakk> \<Longrightarrow> y dvd listgcd (a # xs) * z
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
y dvd x * z
y dvd listgcd xs * z

goal (1 subgoal):
 1. y dvd listgcd (x # xs) * z
[PROOF STEP]
unfolding listgcd_simps
[PROOF STATE]
proof (prove)
using this:
y dvd x * z
y dvd listgcd xs * z

goal (1 subgoal):
 1. y dvd gcd x (listgcd xs) * z
[PROOF STEP]
by (rule gcd_greatest_mult)
[PROOF STATE]
proof (state)
this:
y dvd listgcd (x # xs) * z

goal (1 subgoal):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
[PROOF STEP]
qed (simp)


[STATEMENT]
lemma cblinfun_of_mat_times:
  fixes M N ::"complex mat"
  defines "nA \<equiv> length (canonical_basis :: 'a::{basis_enum,complex_normed_vector} list)"
    and "nB \<equiv> length (canonical_basis :: 'b::{basis_enum,complex_normed_vector} list)"
    and "nC \<equiv> length (canonical_basis :: 'c::{basis_enum,complex_normed_vector} list)"
  assumes a1: "M \<in> carrier_mat nC nB" and a2: "N \<in> carrier_mat nB nA"
  shows  "cblinfun_of_mat (M * N) = ((cblinfun_of_mat M)::'b \<Rightarrow>\<^sub>C\<^sub>L'c) o\<^sub>C\<^sub>L ((cblinfun_of_mat N)::'a \<Rightarrow>\<^sub>C\<^sub>L'b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have b1: "((cblinfun_of_mat M)::'b \<Rightarrow>\<^sub>C\<^sub>L'c) v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum v)"
    for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat M *\<^sub>V v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by (metis assms(4) cblinfun_of_mat.rep_eq nB_def nC_def)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat M *\<^sub>V ?v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have b2: "((cblinfun_of_mat N)::'a \<Rightarrow>\<^sub>C\<^sub>L'b) v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)"
    for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat N *\<^sub>V v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by (metis assms(5) cblinfun_of_mat.rep_eq nA_def nB_def)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat N *\<^sub>V ?v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have b3: "((cblinfun_of_mat (M * N))::'a \<Rightarrow>\<^sub>C\<^sub>L'c) v
       = basis_enum_of_vec ((M * N) *\<^sub>v vec_of_basis_enum v)"
    for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat (M * N) *\<^sub>V v = basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by (metis assms(4) assms(5) cblinfun_of_mat.rep_eq mult_carrier_mat nA_def nC_def)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat (M * N) *\<^sub>V ?v = basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have "(basis_enum_of_vec ((M * N) *\<^sub>v vec_of_basis_enum v)::'c)
      = (basis_enum_of_vec (M *\<^sub>v ( vec_of_basis_enum ( (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v))::'b ))))"
    for v::'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have c1: "vec_of_basis_enum (basis_enum_of_vec x :: 'b) = x"
      if "dim_vec x = nB"
      for x::"complex vec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec x) = x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
dim_vec x = nB

goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec x) = x
[PROOF STEP]
unfolding nB_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = length canonical_basis

goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec x) = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec ?x = nB \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec ?x) = ?x

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have c2: "vec_of_basis_enum v \<in> carrier_vec nA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum v \<in> carrier_vec nA
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) add.commute carrier_vec_dim_vec index_add_vec(2)
          index_zero_vec(2) nA_def vec_of_basis_enum_add basis_enum_of_vec_inverse)
[PROOF STATE]
proof (state)
this:
vec_of_basis_enum v \<in> carrier_vec nA

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have "(M * N) *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
using Matrix.assoc_mult_mat_vec a1 a2 c2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2; ?B \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3; ?v \<in> carrier_vec ?n\<^sub>3\<rbrakk> \<Longrightarrow> ?A * ?B *\<^sub>v ?v = ?A *\<^sub>v (?B *\<^sub>v ?v)
M \<in> carrier_mat nC nB
N \<in> carrier_mat nB nA
vec_of_basis_enum v \<in> carrier_vec nA

goal (1 subgoal):
 1. M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
hence "(basis_enum_of_vec ((M * N) *\<^sub>v vec_of_basis_enum v)::'c)
        = (basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))::'c)"
[PROOF STATE]
proof (prove)
using this:
M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have "\<dots> =
      (basis_enum_of_vec (M *\<^sub>v ( vec_of_basis_enum ( (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v))::'b ))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
using c1 a2
[PROOF STATE]
proof (prove)
using this:
dim_vec ?x = nB \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec ?x) = ?x
N \<in> carrier_mat nB nA

goal (1 subgoal):
 1. basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)))

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)))

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
using b1 b2 b3
[PROOF STATE]
proof (prove)
using this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)))
cblinfun_of_mat M *\<^sub>V ?v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum ?v)
cblinfun_of_mat N *\<^sub>V ?v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)
cblinfun_of_mat (M * N) *\<^sub>V ?v = basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
by (simp add: cblinfun_eqI scaleC_cblinfun.rep_eq)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma qtable_unit_table: "(\<And>x. wf_tuple n {} x \<Longrightarrow> P x \<Longrightarrow> Q x) \<Longrightarrow> qtable n {} P Q (unit_table n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>wf_tuple n {} x; P x\<rbrakk> \<Longrightarrow> Q x) \<Longrightarrow> qtable n {} P Q (unit_table n)
[PROOF STEP]
unfolding qtable_def table_def in_unit_table
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>wf_tuple n {} x; P x\<rbrakk> \<Longrightarrow> Q x) \<Longrightarrow> Ball (unit_table n) (wf_tuple n {}) \<and> (\<forall>x. (wf_tuple n {} x \<and> P x \<longrightarrow> Q x) \<and> (wf_tuple n {} x \<and> P x \<and> Q x \<longrightarrow> wf_tuple n {} x))
[PROOF STEP]
by auto


[STATEMENT]
lemma tl_as_projection:
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "tl a = project_at_indices {1::nat..<n} a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have 0: "indices_of a = {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indices_of a = {..<n}
[PROOF STEP]
using assms cartesian_power_car_memE indices_of_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> length ?as = ?n
indices_of ?as = {..<length ?as}

goal (1 subgoal):
 1. indices_of a = {..<n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
indices_of a = {..<n}

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have 1: "length (tl a) = n - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (tl a) = n - 1
[PROOF STEP]
using assms cartesian_power_car_memE length_tl
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> length ?as = ?n
length (tl ?xs) = degree ?xs

goal (1 subgoal):
 1. length (tl a) = n - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length (tl a) = n - 1

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have 2: "length (tl a) = length (project_at_indices {1::nat..<n} a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (tl a) = length (nths a {1..<n})
[PROOF STEP]
using 0 assms cartesian_power_car_memE[of a R n] proj_at_index_list_length[of "{1::nat..<n}" a]
[PROOF STATE]
proof (prove)
using this:
indices_of a = {..<n}
a \<in> carrier (R\<^bsup>n\<^esup>)
a \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> length a = n
{1..<n} \<subseteq> indices_of a \<Longrightarrow> length (nths a {1..<n}) = card {1..<n}

goal (1 subgoal):
 1. length (tl a) = length (nths a {1..<n})
[PROOF STEP]
by (metis "1" atLeastLessThan_iff card_atLeastLessThan  lessThan_iff subsetI)
[PROOF STATE]
proof (state)
this:
length (tl a) = length (nths a {1..<n})

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have "\<And>i. i < n - 1 \<Longrightarrow> (tl a) ! i = (project_at_indices {1::nat..<n} a) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n - 1 \<Longrightarrow> tl a ! i = nths a {1..<n} ! i
[PROOF STEP]
using project_at_indices_consecutive_indices'[of 1 n n a R] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < n; n \<le> n; a \<in> carrier (R\<^bsup>n\<^esup>); ?k < n - 1\<rbrakk> \<Longrightarrow> nths a {1..<n} ! ?k = a ! (1 + ?k)
a \<in> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. \<And>i. i < n - 1 \<Longrightarrow> tl a ! i = nths a {1..<n} ! i
[PROOF STEP]
by (metis "1" One_nat_def Suc_leI le_add_diff_inverse2 le_numeral_extra(4)
        linorder_neqE_nat nat_add_left_cancel_le nat_diff_split_asm not_less0 nth_tl plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
?i < n - 1 \<Longrightarrow> tl a ! ?i = nths a {1..<n} ! ?i

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < n - 1 \<Longrightarrow> tl a ! ?i = nths a {1..<n} ! ?i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i < n - 1 \<Longrightarrow> tl a ! ?i = nths a {1..<n} ! ?i

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
by (metis "1" "2" nth_equalityI)
[PROOF STATE]
proof (state)
this:
tl a = nths a {1..<n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_compose_add:
  assumes "is_poly_tuple m fs"
  assumes "length fs = n"
  assumes "f \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  assumes "g \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  shows "poly_compose n m fs (f \<oplus>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> g) = (poly_compose n m fs f) \<oplus>\<^bsub>coord_ring R m\<^esub>  (poly_compose n m fs g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_compose n m fs (f \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> g) = poly_compose n m fs f \<oplus>\<^bsub>R [\<X>\<^bsub>m\<^esub>]\<^esub> poly_compose n m fs g
[PROOF STEP]
using assms poly_compose_ring_hom ring_hom_add
[PROOF STATE]
proof (prove)
using this:
is_poly_tuple m fs
length fs = n
f \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> ring_hom_ring (R [\<X>\<^bsub>?n\<^esub>]) (R [\<X>\<^bsub>?m\<^esub>]) (poly_compose ?n ?m ?fs)
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<oplus>\<^bsub>?R\<^esub> ?y) = ?h ?x \<oplus>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. poly_compose n m fs (f \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> g) = poly_compose n m fs f \<oplus>\<^bsub>R [\<X>\<^bsub>m\<^esub>]\<^esub> poly_compose n m fs g
[PROOF STEP]
by (metis (mono_tags, lifting) ring_hom_ring.homh)


[STATEMENT]
lemma nonneg_has_sum_le_0D_complex:
  fixes f :: "'a \<Rightarrow> complex"
  assumes "has_sum f A a" and \<open>a \<le> 0\<close>
    and "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0" and "x \<in> A"
  shows "f x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
by (metis assms infsumI nonneg_infsum_le_0D_complex summable_on_def)


[STATEMENT]
lemma ofilter_ordLeq:
assumes "Well_order r" and "ofilter r A"
shows "Restr r A \<le>o r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
have "A \<le> Field r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> Field r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Well_order r
ofilter r A

goal (1 subgoal):
 1. A \<subseteq> Field r
[PROOF STEP]
by (auto simp add: wo_rel_def wo_rel.ofilter_def)
[PROOF STATE]
proof (state)
this:
A \<subseteq> Field r

goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> Field r

goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> Field r
Well_order r
ofilter r A

goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
by (simp add: ofilter_subset_ordLeq wo_rel.Field_ofilter
      wo_rel_def Restr_Field)
[PROOF STATE]
proof (state)
this:
Restr r A \<le>o r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_sums_not_infty_minus:
  assumes "f sums (a::ereal)"
    and "\<bar>a\<bar> \<noteq> \<infinity>"
  shows "(\<lambda>n. - f n) sums -a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
have "\<And>n. \<bar>f n\<bar> \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<bar>f n\<bar> \<noteq> \<infinity>
[PROOF STEP]
using assms  ereal_sums_not_infty
[PROOF STATE]
proof (prove)
using this:
f sums a
\<bar>a\<bar> \<noteq> \<infinity>
\<lbrakk>?f sums ?a; \<bar>?a\<bar> \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<bar>?f ?n\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. \<And>n. \<bar>f n\<bar> \<noteq> \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>f ?n\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
define g where "g = (\<lambda>n. real_of_ereal (f n))"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>n. real_of_ereal (f n))

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
have "\<And>n. f n = ereal (g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. f n = ereal (g n)
[PROOF STEP]
using  \<open>\<And>n. \<bar>f n\<bar> \<noteq> \<infinity>\<close>
[PROOF STATE]
proof (prove)
using this:
\<bar>f ?n\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. \<And>n. f n = ereal (g n)
[PROOF STEP]
by (simp add: ereal_real' g_def)
[PROOF STATE]
proof (state)
this:
f ?n = ereal (g ?n)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "\<And>n. - f n = ereal (-g n)"
[PROOF STATE]
proof (prove)
using this:
f ?n = ereal (g ?n)

goal (1 subgoal):
 1. \<And>n. - f n = ereal (- g n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- f ?n = ereal (- g ?n)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
have "\<exists>r. a = ereal (r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. a = ereal r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f sums a
\<bar>a\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. \<exists>r. a = ereal r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>r. a = ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>r. a = ereal r
[PROOF STEP]
obtain r where "a = ereal r"
[PROOF STATE]
proof (prove)
using this:
\<exists>r. a = ereal r

goal (1 subgoal):
 1. (\<And>r. a = ereal r \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
a = ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "f sums (ereal r)"
[PROOF STATE]
proof (prove)
using this:
a = ereal r

goal (1 subgoal):
 1. f sums ereal r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a = ereal r
f sums a
\<bar>a\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. f sums ereal r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f sums ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. ereal (g n)) sums (ereal r)"
[PROOF STATE]
proof (prove)
using this:
f sums ereal r

goal (1 subgoal):
 1. (\<lambda>n. ereal (g n)) sums ereal r
[PROOF STEP]
using \<open>\<And>n. f n = ereal (g n)\<close>
      sums_cong[of f "\<lambda>n. ereal (g n)"]
[PROOF STATE]
proof (prove)
using this:
f sums ereal r
f ?n = ereal (g ?n)
(\<And>n. f n = ereal (g n)) \<Longrightarrow> f sums ?c = (\<lambda>n. ereal (g n)) sums ?c

goal (1 subgoal):
 1. (\<lambda>n. ereal (g n)) sums ereal r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (g n)) sums ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "g sums r"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (g n)) sums ereal r

goal (1 subgoal):
 1. g sums r
[PROOF STEP]
by (simp add: sums_ereal)
[PROOF STATE]
proof (state)
this:
g sums r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. -g n) sums -r"
[PROOF STATE]
proof (prove)
using this:
g sums r

goal (1 subgoal):
 1. (\<lambda>n. - g n) sums - r
[PROOF STEP]
using sums_minus[of g]
[PROOF STATE]
proof (prove)
using this:
g sums r
g sums ?a \<Longrightarrow> (\<lambda>n. - g n) sums - ?a

goal (1 subgoal):
 1. (\<lambda>n. - g n) sums - r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - g n) sums - r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. ereal (- g n)) sums ereal (-r)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - g n) sums - r

goal (1 subgoal):
 1. (\<lambda>n. ereal (- g n)) sums ereal (- r)
[PROOF STEP]
by (simp add: sums_ereal)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (- g n)) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. - f n) sums (ereal (-r))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (- g n)) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums ereal (- r)
[PROOF STEP]
using \<open>\<And>n. - f n = ereal (-g n)\<close>
      sums_cong[of f "\<lambda>n. ereal (g n)"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (- g n)) sums ereal (- r)
- f ?n = ereal (- g ?n)
(\<And>n. f n = ereal (g n)) \<Longrightarrow> f sums ?c = (\<lambda>n. ereal (g n)) sums ?c

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums ereal (- r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - f n) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - f n) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
using \<open>a = ereal r\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - f n) sums ereal (- r)
a = ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - f n) sums - a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iTILL_add_neg: "[\<dots>n] \<oplus>- k = (if k \<le> n then [\<dots>n - k] else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<dots>n] \<oplus>- k = (if k \<le> n then [\<dots>n - k] else {})
[PROOF STEP]
by (force simp add: set_eq_iff iT_Plus_neg_mem_iff iT_iff)