[STATEMENT]
lemma det_linear_rows_finsum_lemma:
  assumes fS: "finite S"
    and fT: "finite T" and c: "c \<in> {0..<n} \<rightarrow> carrier_vec n"
    and T: "T \<subseteq> {0 ..< n}"
    and a: "a \<in> T \<rightarrow> S \<rightarrow> carrier_vec n"
  shows "det (mat\<^sub>r n n (\<lambda> i. if i \<in> T then finsum_vec TYPE('a :: comm_ring_1) n (a i) S else c i)) =
    sum (\<lambda>f. det(mat\<^sub>r n n (\<lambda> i. if i \<in> T then a i (f i) else c i)))
      {f. (\<forall>i \<in> T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else c i)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else c i)))
[PROOF STEP]
let ?sum = "finsum_vec TYPE('a) n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else c i)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else c i)))
[PROOF STEP]
using fT c a T
[PROOF STATE]
proof (prove)
using this:
finite T
c \<in> {0..<n} \<rightarrow> carrier_vec n
a \<in> T \<rightarrow> S \<rightarrow> carrier_vec n
T \<subseteq> {0..<n}

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else c i)))
[PROOF STEP]
proof (induct T arbitrary: a c set: finite)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> {} \<rightarrow> S \<rightarrow> carrier_vec n; {} \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then a i (f i) else c i)))
 2. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
c \<in> {0..<n} \<rightarrow> carrier_vec n
a \<in> {} \<rightarrow> S \<rightarrow> carrier_vec n
{} \<subseteq> {0..<n}

goal (2 subgoals):
 1. \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> {} \<rightarrow> S \<rightarrow> carrier_vec n; {} \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then a i (f i) else c i)))
 2. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
let ?f = "(\<lambda> i. i) :: nat \<Rightarrow> nat"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> {} \<rightarrow> S \<rightarrow> carrier_vec n; {} \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then a i (f i) else c i)))
 2. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
have [simp]: "{f. \<forall>i. f i = i} = {?f}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f. \<forall>i. f i = i} = {\<lambda>i. i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f. \<forall>i. f i = i} = {\<lambda>i. i}

goal (2 subgoals):
 1. \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> {} \<rightarrow> S \<rightarrow> carrier_vec n; {} \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then a i (f i) else c i)))
 2. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then a i (f i) else c i)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>{}. f i \<in> S) \<and> (\<forall>i. i \<notin> {} \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> {} then a i (f i) else c i)))

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
case (insert z T a c)
[PROOF STATE]
proof (state)
this:
finite T
z \<notin> T
\<lbrakk>?c1 \<in> {0..<n} \<rightarrow> carrier_vec n; ?a1 \<in> T \<rightarrow> S \<rightarrow> carrier_vec n; T \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (?a1 i) S else ?c1 i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then ?a1 i (f i) else ?c1 i)))
c \<in> {0..<n} \<rightarrow> carrier_vec n
a \<in> insert z T \<rightarrow> S \<rightarrow> carrier_vec n
insert z T \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
hence z: "z < n" and azS: "a z \<in> S \<rightarrow> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
finite T
z \<notin> T
\<lbrakk>?c1 \<in> {0..<n} \<rightarrow> carrier_vec n; ?a1 \<in> T \<rightarrow> S \<rightarrow> carrier_vec n; T \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (?a1 i) S else ?c1 i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then ?a1 i (f i) else ?c1 i)))
c \<in> {0..<n} \<rightarrow> carrier_vec n
a \<in> insert z T \<rightarrow> S \<rightarrow> carrier_vec n
insert z T \<subseteq> {0..<n}

goal (1 subgoal):
 1. z < n &&& a z \<in> S \<rightarrow> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
z < n
a z \<in> S \<rightarrow> carrier_vec n

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
let ?F = "\<lambda>T. {f. (\<forall>i \<in> T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
let ?h = "\<lambda>(y,g) i. if i = z then y else g i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
let ?k = "\<lambda>h. (h(z),(\<lambda>i. if i = z then i else h i))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
let ?s = "\<lambda> k a c f. det(mat\<^sub>r n n (\<lambda> i. if i \<in> T then a i (f i) else c i))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
let ?c = "\<lambda>j i. if i = z then a i j else c i"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
have thif: "\<And>a b c d. (if a \<or> b then c else d) = (if a then c else if b then c else d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c d. (if a \<or> b then c else d) = (if a then c else if b then c else d)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if ?a3 \<or> ?b3 then ?c3 else ?d3) = (if ?a3 then ?c3 else if ?b3 then ?c3 else ?d3)

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
have thif2: "\<And>a b c d e. (if a then b else if c then d else e) =
       (if c then (if a then b else d) else (if a then b else e))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b c d e. (if a then b else if c then d else e) = (if c then if a then b else d else if a then b else e)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(if ?a4 then ?b4 else if ?c4 then ?d4 else ?e4) = (if ?c4 then if ?a4 then ?b4 else ?d4 else if ?a4 then ?b4 else ?e4)

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
from \<open>z \<notin> T\<close>
[PROOF STATE]
proof (chain)
picking this:
z \<notin> T
[PROOF STEP]
have nz: "\<And>i. i \<in> T \<Longrightarrow> i = z \<longleftrightarrow> False"
[PROOF STATE]
proof (prove)
using this:
z \<notin> T

goal (1 subgoal):
 1. \<And>i. i \<in> T \<Longrightarrow> (i = z) = False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i5 \<in> T \<Longrightarrow> (?i5 = z) = False

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
from insert
[PROOF STATE]
proof (chain)
picking this:
finite T
z \<notin> T
\<lbrakk>?c1 \<in> {0..<n} \<rightarrow> carrier_vec n; ?a1 \<in> T \<rightarrow> S \<rightarrow> carrier_vec n; T \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (?a1 i) S else ?c1 i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then ?a1 i (f i) else ?c1 i)))
c \<in> {0..<n} \<rightarrow> carrier_vec n
a \<in> insert z T \<rightarrow> S \<rightarrow> carrier_vec n
insert z T \<subseteq> {0..<n}
[PROOF STEP]
have c: "\<And> i. i < n \<Longrightarrow> c i \<in> carrier_vec n"
[PROOF STATE]
proof (prove)
using this:
finite T
z \<notin> T
\<lbrakk>?c1 \<in> {0..<n} \<rightarrow> carrier_vec n; ?a1 \<in> T \<rightarrow> S \<rightarrow> carrier_vec n; T \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (?a1 i) S else ?c1 i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then ?a1 i (f i) else ?c1 i)))
c \<in> {0..<n} \<rightarrow> carrier_vec n
a \<in> insert z T \<rightarrow> S \<rightarrow> carrier_vec n
insert z T \<subseteq> {0..<n}

goal (1 subgoal):
 1. \<And>i. i < n \<Longrightarrow> c i \<in> carrier_vec n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?i5 < n \<Longrightarrow> c ?i5 \<in> carrier_vec n

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
have fin: "finite {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}
[PROOF STEP]
by (rule finite_bounded_functions[OF fS insert(1)])
[PROOF STATE]
proof (state)
this:
finite {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
have "det (mat\<^sub>r n n (\<lambda> i. if i \<in> insert z T then ?sum (a i) S else c i)) =
      det (mat\<^sub>r n n (\<lambda> i. if i = z then ?sum (a i) S else if i \<in> T then ?sum (a i) S else c i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i))
[PROOF STEP]
unfolding insert_iff thif
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i))

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i))

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
have "\<dots> = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda> i. if i \<in> T then ?sum (a i) S else if i = z then a i j else c i)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i)))
[PROOF STEP]
apply (subst det_linear_row_finsum[OF fS _ z])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i) \<in> {0..<n} \<rightarrow> carrier_vec n
 2. a z \<in> S \<rightarrow> carrier_vec n
 3. (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i = z then a i j else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i))) = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i)))
[PROOF STEP]
prefer 3
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i = z then a i j else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i))) = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i)))
 2. (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i) \<in> {0..<n} \<rightarrow> carrier_vec n
 3. a z \<in> S \<rightarrow> carrier_vec n
[PROOF STEP]
apply (subst thif2)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then if i = z then a i j else finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i))) = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i)))
 2. (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i) \<in> {0..<n} \<rightarrow> carrier_vec n
 3. a z \<in> S \<rightarrow> carrier_vec n
[PROOF STEP]
using nz
[PROOF STATE]
proof (prove)
using this:
?i5 \<in> T \<Longrightarrow> (?i5 = z) = False

goal (3 subgoals):
 1. (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then if i = z then a i j else finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i))) = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i)))
 2. (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i) \<in> {0..<n} \<rightarrow> carrier_vec n
 3. a z \<in> S \<rightarrow> carrier_vec n
[PROOF STEP]
apply (simp cong del: if_weak_cong cong add: if_cong)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i) \<in> {0..<n} \<rightarrow> carrier_vec n
 2. a z \<in> S \<rightarrow> carrier_vec n
[PROOF STEP]
apply (insert azS c fS insert(5), (force intro!: finsum_vec_closed)+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i)))

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i = z then finsum_vec TYPE('a) n (a i) S else if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i)))

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
have "\<dots> = (sum (\<lambda> (j, f). det (mat\<^sub>r n n (\<lambda> i. if i \<in> T then a i (f i)
      else if i = z then a i j
      else c i))) (S \<times> ?F T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i))) = (\<Sum>(j, f)\<in>S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i j else c i)))
[PROOF STEP]
unfolding sum.cartesian_product[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i))) = (\<Sum>x\<in>S. \<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i x else c i)))
[PROOF STEP]
by (rule sum.cong[OF refl], subst insert.hyps(3),
        insert azS c fin z insert(5-6), auto)
[PROOF STATE]
proof (state)
this:
(\<Sum>j\<in>S. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else if i = z then a i j else c i))) = (\<Sum>(j, f)\<in>S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i j else c i)))

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>(j, f)\<in>S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i j else c i)))
[PROOF STEP]
have tha:
      "det (mat\<^sub>r n n (\<lambda> i. if i \<in> insert z T then ?sum (a i) S else c i)) =
       (sum (\<lambda> (j, f). det (mat\<^sub>r n n (\<lambda> i. if i \<in> T then a i (f i)
          else if i = z then a i j
          else c i))) (S \<times> ?F T))"
[PROOF STATE]
proof (prove)
using this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>(j, f)\<in>S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i j else c i)))

goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>(j, f)\<in>S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i j else c i)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>(j, f)\<in>S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i j else c i)))

goal (1 subgoal):
 1. \<And>x F a c. \<lbrakk>finite F; x \<notin> F; \<And>a c. \<lbrakk>c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> F \<rightarrow> S \<rightarrow> carrier_vec n; F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>F. f i \<in> S) \<and> (\<forall>i. i \<notin> F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> F then a i (f i) else c i))); c \<in> {0..<n} \<rightarrow> carrier_vec n; a \<in> insert x F \<rightarrow> S \<rightarrow> carrier_vec n; insert x F \<subseteq> {0..<n}\<rbrakk> \<Longrightarrow> det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert x F. f i \<in> S) \<and> (\<forall>i. i \<notin> insert x F \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert x F then a i (f i) else c i)))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert z T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert z T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then a i (f i) else c i)))
[PROOF STEP]
unfolding tha
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>(j, f)\<in>S \<times> {f. (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i)}. det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else if i = z then a i j else c i))) = (\<Sum>f | (\<forall>i\<in>insert z T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert z T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then a i (f i) else c i)))
[PROOF STEP]
by (rule sum.reindex_bij_witness[where i="?k" and j="?h"], insert \<open>z \<notin> T\<close>
      azS c fS insert(5-6) z fin,
      auto intro!: arg_cong[of _ _ det])
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>insert z T. f i \<in> S) \<and> (\<forall>i. i \<notin> insert z T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> insert z T then a i (f i) else c i)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then finsum_vec TYPE('a) n (a i) S else c i)) = (\<Sum>f | (\<forall>i\<in>T. f i \<in> S) \<and> (\<forall>i. i \<notin> T \<longrightarrow> f i = i). det (mat\<^sub>r n n (\<lambda>i. if i \<in> T then a i (f i) else c i)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fds_integral_add: "fds_integral (a + b) (f + g) = fds_integral a f + fds_integral b g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_integral (a + b) (f + g) = fds_integral a f + fds_integral b g
[PROOF STEP]
by (rule fds_eqI) (auto simp: fds_integral_def scaleR_diff_right)


[STATEMENT]
lemma JN_Join_distrib:
     "(\<Squnion>i \<in> I. F i\<squnion>G i) = (\<Squnion>i \<in> I. F i) \<squnion> (\<Squnion>i \<in> I. G i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Squnion>i\<in>I. F i \<squnion> G i) = JOIN I F \<squnion> JOIN I G
[PROOF STEP]
by (auto intro!: program_equalityI)


[STATEMENT]
lemma floor_log_div:
  "\<lfloor>log b x\<rfloor> = \<lfloor>log b (x div b)\<rfloor> + 1" if "b > 1" "x > 0" "x div b > 0"
    for b x :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
have "\<lfloor>log b x\<rfloor> = \<lfloor>log b (x / b * b)\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real x / real b * real b)\<rfloor>
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
1 < b
0 < x
0 < x div b

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real x / real b * real b)\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real x / real b * real b)\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real x / real b * real b)\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
have "\<dots> = \<lfloor>log b (x / b) + log b b\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real x / real b * real b)\<rfloor> = \<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor>
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
1 < b
0 < x
0 < x div b

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x / real b * real b)\<rfloor> = \<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor>
[PROOF STEP]
by (subst log_mult) auto
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x / real b * real b)\<rfloor> = \<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x / real b * real b)\<rfloor> = \<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
have "\<dots> = \<lfloor>log b (x / b)\<rfloor> + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor> = \<lfloor>log (real b) (real x / real b)\<rfloor> + 1
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
1 < b
0 < x
0 < x div b

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor> = \<lfloor>log (real b) (real x / real b)\<rfloor> + 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor> = \<lfloor>log (real b) (real x / real b)\<rfloor> + 1

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x / real b) + log (real b) (real b)\<rfloor> = \<lfloor>log (real b) (real x / real b)\<rfloor> + 1

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
have "\<lfloor>log b (x / b)\<rfloor> = \<lfloor>log b (x div b + (x / b - x div b))\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real x / real b)\<rfloor> = \<lfloor>log (real b) (real (x div b) + (real x / real b - real (x div b)))\<rfloor>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x / real b)\<rfloor> = \<lfloor>log (real b) (real (x div b) + (real x / real b - real (x div b)))\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x / real b)\<rfloor> = \<lfloor>log (real b) (real (x div b) + (real x / real b - real (x div b)))\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
have "\<dots> = \<lfloor>log b (x div b)\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>log (real b) (real (x div b) + (real x / real b - real (x div b)))\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor>
[PROOF STEP]
using that real_of_nat_div4 divide_nat_diff_div_nat_less_one
[PROOF STATE]
proof (prove)
using this:
1 < b
0 < x
0 < x div b
real (?n div ?x) \<le> real ?n / real ?x
real ?x / real ?b - real (?x div ?b) < 1

goal (1 subgoal):
 1. \<lfloor>log (real b) (real (x div b) + (real x / real b - real (x div b)))\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor>
[PROOF STEP]
by (intro floor_log_add_eqI) auto
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real (x div b) + (real x / real b - real (x div b)))\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor>

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1

goal (1 subgoal):
 1. \<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<lfloor>log (real b) (real x)\<rfloor> = \<lfloor>log (real b) (real (x div b))\<rfloor> + 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma SMP_SMP_subset: "N \<subseteq> SMP M \<Longrightarrow> SMP N \<subseteq> SMP M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<subseteq> SMP M \<Longrightarrow> SMP N \<subseteq> SMP M
[PROOF STEP]
by (metis SMP_mono SMP_subset_union_eq Un_commute Un_upper2)


[STATEMENT]
lemma add_assoc: "add (add k m) n = add k (add m n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add (add k m) n = add k (add m n)
[PROOF STEP]
by (induct k) simp_all


[STATEMENT]
lemma LV_simps:
  shows "LV Zero s = {}"
  and   "LV One s = (if s = [] then {Void} else {})"
  and   "LV (Atom c) s = (if s = [c] then {Atm c} else {})"
  and   "LV (Plus r1 r2) s = Left ` LV r1 s \<union> Right ` LV r2 s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (LV Zero s = {} &&& LV One s = (if s = [] then {Void} else {})) &&& LV (Atom c) s = (if s = [c] then {Atm c} else {}) &&& LV (Plus r1 r2) s = val.Left ` LV r1 s \<union> val.Right ` LV r2 s
[PROOF STEP]
unfolding LV_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({v. \<turnstile> v : Zero \<and> flat v = s} = {} &&& {v. \<turnstile> v : One \<and> flat v = s} = (if s = [] then {Void} else {})) &&& {v. \<turnstile> v : Atom c \<and> flat v = s} = (if s = [c] then {Atm c} else {}) &&& {v. \<turnstile> v : Plus r1 r2 \<and> flat v = s} = val.Left ` {v. \<turnstile> v : r1 \<and> flat v = s} \<union> val.Right ` {v. \<turnstile> v : r2 \<and> flat v = s}
[PROOF STEP]
by (auto intro: Prf.intros elim: Prf.cases)


[STATEMENT]
lemma lemma1: "Key (invKey K) \<in> analz H ==>
               analz (insert (Crypt K X) H) \<subseteq>
               insert (Crypt K X) (analz (insert X H))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Key (invKey K) \<in> analz H \<Longrightarrow> analz (insert (Crypt K X) H) \<subseteq> insert (Crypt K X) (analz (insert X H))
[PROOF STEP]
apply (rule subsetI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>Key (invKey K) \<in> analz H; x \<in> analz (insert (Crypt K X) H)\<rbrakk> \<Longrightarrow> x \<in> insert (Crypt K X) (analz (insert X H))
[PROOF STEP]
apply (erule_tac x = x in analz.induct, auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma (in cring) trivialideals_eq_field:
  assumes carrnzero: "carrier R \<noteq> {\<zero>}"
  shows "({I. ideal I R} = {{\<zero>}, carrier R}) = field R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ({I. ideal I R} = {{\<zero>}, carrier R}) = field R
[PROOF STEP]
by (fast intro!: trivialideals_fieldI[OF carrnzero] field.all_ideals)


[STATEMENT]
lemma dg_prod_vdiff_vunion_Arr_in_Arr:
  assumes "J \<subseteq>\<^sub>\<circ> I"
    and "b \<in>\<^sub>\<circ> (\<Prod>\<^sub>D\<^sub>Gk\<in>\<^sub>\<circ>I -\<^sub>\<circ> J. \<AA> k)\<lparr>Arr\<rparr>"
    and "c \<in>\<^sub>\<circ> (\<Prod>\<^sub>D\<^sub>Gj\<in>\<^sub>\<circ>J. \<AA> j)\<lparr>Arr\<rparr>"
  shows "b \<union>\<^sub>\<circ> c \<in>\<^sub>\<circ> (\<Prod>\<^sub>D\<^sub>Gi\<in>\<^sub>\<circ>I. \<AA> i)\<lparr>Arr\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<union>\<^sub>\<circ> c \<in>\<^sub>\<circ> dg_prod I \<AA>\<lparr>Arr\<rparr>
[PROOF STEP]
by
    (
      vdiff_of_vunion
        rule: dg_prod_vunion_Arr_in_Arr assms: assms(2,3) subset: assms(1)
    )


[STATEMENT]
lemma odiff_eq_iff: "z \<unlhd> x \<Longrightarrow> odiff x z = y \<longleftrightarrow> x = z + y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<unlhd> x \<Longrightarrow> (odiff x z = y) = (x = z + y)
[PROOF STEP]
by (auto simp: odiff_def vle_def)


[STATEMENT]
lemma Apos: "A \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> A
[PROOF STEP]
unfolding A_def u_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Inf {dist (0::'a) ((T ^^ n) (0::'a)) / real n |n. 0 < n}
[PROOF STEP]
by (rule cInf_greatest, auto)


[STATEMENT]
lemma sorted_up: "sorted (up a xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (up a xs)
[PROOF STEP]
by (induction xs arbitrary: a) (auto dest: set_upD intro: less_imp_le)


[STATEMENT]
lemma numeral_mod_ring_eq_iff [simp]:
  "((numeral a :: 'a :: nontriv mod_ring) = numeral b) \<longleftrightarrow>
   ((numeral a mod CARD('a)) = (numeral b mod CARD('a)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (numeral a = numeral b) = (numeral a mod CARD('a) = numeral b mod CARD('a))
[PROOF STEP]
using of_nat_mod_ring_eq_iff[of "numeral a" "numeral b", where ?'a = 'a]
[PROOF STATE]
proof (prove)
using this:
(of_nat (numeral a) = of_nat (numeral b)) = (numeral a mod CARD('a) = numeral b mod CARD('a))

goal (1 subgoal):
 1. (numeral a = numeral b) = (numeral a mod CARD('a) = numeral b mod CARD('a))
[PROOF STEP]
by (simp del: of_nat_mod_ring_eq_iff)


[STATEMENT]
lemma fresh_prod4[nominal_prod_simps,ms_fresh]: "x \<sharp> (a,b,c,d) = (x \<sharp> a \<and> x \<sharp> b  \<and> x \<sharp> c  \<and> x \<sharp> d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sharp> (a, b, c, d) = (x \<sharp> a \<and> x \<sharp> b \<and> x \<sharp> c \<and> x \<sharp> d)
[PROOF STEP]
using fresh_def supp_Pair
[PROOF STATE]
proof (prove)
using this:
?a \<sharp> ?x \<equiv> ?a \<notin> supp ?x
supp (?x, ?y) = supp ?x \<union> supp ?y

goal (1 subgoal):
 1. x \<sharp> (a, b, c, d) = (x \<sharp> a \<and> x \<sharp> b \<and> x \<sharp> c \<and> x \<sharp> d)
[PROOF STEP]
by fastforce


[STATEMENT]
theorem robbins_is_boolean_II:
  "class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>
[PROOF STEP]
interpret huntington:
    huntington_algebra uminus "(\<sqinter>)" "(\<squnion>)" \<bottom> \<top>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.huntington_algebra uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>
[PROOF STEP]
by (fact robbins_is_huntington)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>
[PROOF STEP]
by (simp add: huntington.huntington_is_boolean_II)
[PROOF STATE]
proof (state)
this:
class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_less_Fract_iff: "0 < b \<Longrightarrow> 1 < Fract a b \<longleftrightarrow> b < a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) < b \<Longrightarrow> (1 < Fract a b) = (b < a)
[PROOF STEP]
by (auto simp add: One_fract_def mult_less_cancel_right_disj)


[STATEMENT]
lemma One_rat_def: "1 = Fract 1 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 = Fract 1 1
[PROOF STEP]
by transfer simp


[STATEMENT]
lemma disc_\<P>\<^sub>1_lim: "lim (\<lambda>n. (\<Sum>t\<le>n. l^t *\<^sub>R \<P>\<^sub>1 ^^ t)) = (\<Sum>t. l^t *\<^sub>R \<P>\<^sub>1 ^^t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lim (\<lambda>n. \<Sum>t\<le>n. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) = (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t)
[PROOF STEP]
using limI disc_\<P>\<^sub>1_tendsto
[PROOF STATE]
proof (prove)
using this:
?X \<longlonglongrightarrow> ?L \<Longrightarrow> lim ?X = ?L
(\<lambda>n. \<Sum>t\<le>n. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) \<longlonglongrightarrow> (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t)

goal (1 subgoal):
 1. lim (\<lambda>n. \<Sum>t\<le>n. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t) = (\<Sum>t. l ^ t *\<^sub>R \<P>\<^sub>1 ^^ t)
[PROOF STEP]
by blast


[STATEMENT]
lemma continuous_infnorm[continuous_intros]:
  "continuous F f \<Longrightarrow> continuous F (\<lambda>x. infnorm (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous F f \<Longrightarrow> continuous F (\<lambda>x. infnorm (f x))
[PROOF STEP]
unfolding continuous_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f (netlimit F)) F \<Longrightarrow> ((\<lambda>x. infnorm (f x)) \<longlongrightarrow> infnorm (f (netlimit F))) F
[PROOF STEP]
by (rule tendsto_infnorm)


[STATEMENT]
lemma payload_synth_analz:
  "\<lbrakk> X \<in> synth (analz S); S \<subseteq> payload \<rbrakk> \<Longrightarrow> X \<in> payload"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>X \<in> synth (analz S); S \<subseteq> payload\<rbrakk> \<Longrightarrow> X \<in> payload
[PROOF STEP]
by (erule synth.induct) (auto intro: payload_analz)


[STATEMENT]
lemma lebesgue_measurable_diff_null:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::euclidean_space"
  assumes "N \<in> null_sets lebesgue"
  shows "f \<in> borel_measurable (lebesgue_on (-N)) \<longleftrightarrow> f \<in> borel_measurable lebesgue"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<in> borel_measurable (lebesgue_on (- N))) = (f \<in> borel_measurable lebesgue)
[PROOF STEP]
by (simp add: Compl_eq_Diff_UNIV assms borel_measurable_diff_null lebesgue_on_UNIV_eq)


[STATEMENT]
lemma (in prob_space) indep_var_eq:
  "indep_var S X T Y \<longleftrightarrow>
    (random_variable S X \<and> random_variable T Y) \<and>
    indep_set
      (sigma_sets (space M) { X -` A \<inter> space M | A. A \<in> sets S})
      (sigma_sets (space M) { Y -` A \<inter> space M | A. A \<in> sets T})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indep_var S X T Y = ((random_variable S X \<and> random_variable T Y) \<and> indep_set (sigma_sets (space M) {X -` A \<inter> space M |A. A \<in> sets S}) (sigma_sets (space M) {Y -` A \<inter> space M |A. A \<in> sets T}))
[PROOF STEP]
unfolding indep_var_def indep_vars_def indep_set_def UNIV_bool
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>i\<in>{False, True}. random_variable (case i of True \<Rightarrow> S | False \<Rightarrow> T) (case i of True \<Rightarrow> X | False \<Rightarrow> Y)) \<and> indep_sets (\<lambda>i. sigma_sets (space M) {(case i of True \<Rightarrow> X | False \<Rightarrow> Y) -` A \<inter> space M |A. A \<in> sets (case i of True \<Rightarrow> S | False \<Rightarrow> T)}) {False, True}) = ((random_variable S X \<and> random_variable T Y) \<and> indep_sets (case_bool (sigma_sets (space M) {X -` A \<inter> space M |A. A \<in> sets S}) (sigma_sets (space M) {Y -` A \<inter> space M |A. A \<in> sets T})) {False, True})
[PROOF STEP]
by (intro arg_cong2[where f="(\<and>)"] arg_cong2[where f=indep_sets] ext)
     (auto split: bool.split)


[STATEMENT]
lemma pos_diff_neg_meas_set:
  assumes "(pos_meas_set M1)"
    and "(neg_meas_set N2)"
    and "(space M = N1 \<union> N2)"
    and "N1 \<in> sets M"
  shows "neg_meas_set ((M1 - N1) \<inter> space M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. neg_meas_set ((M1 - N1) \<inter> space M)
[PROOF STEP]
using assms neg_meas_subset
[PROOF STATE]
proof (prove)
using this:
pos_meas_set M1
neg_meas_set N2
space M = N1 \<union> N2
N1 \<in> sets M
\<lbrakk>neg_meas_set ?A; ?B \<subseteq> ?A; ?B \<in> sets M\<rbrakk> \<Longrightarrow> neg_meas_set ?B

goal (1 subgoal):
 1. neg_meas_set ((M1 - N1) \<inter> space M)
[PROOF STEP]
by (metis Diff_subset_conv Int_lower2 pos_meas_setD1 sets.Diff
      sets.Int_space_eq2)


[STATEMENT]
lemma vimage_comp:
"f: A \<rightarrow> B \<Longrightarrow> A \<inter> (f -` B \<inter> f -` g -` m)= A \<inter> (g \<circ> f) -` m "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> A \<rightarrow> B \<Longrightarrow> A \<inter> (f -` B \<inter> f -` g -` m) = A \<inter> (g \<circ> f) -` m
[PROOF STEP]
by (auto dest: funcset_mem)


[STATEMENT]
lemma some_NF:
  assumes SN: "SN_on r {x}"
  shows "(x, some_NF r x) \<in> r\<^sup>* \<and> some_NF r x \<in> NF r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x, some_NF r x) \<in> r\<^sup>* \<and> some_NF r x \<in> NF r
[PROOF STEP]
using someI_ex [OF SN_reaches_NF [OF SN]]
[PROOF STATE]
proof (prove)
using this:
(x, SOME xa. (x, xa) \<in> r\<^sup>* \<and> xa \<in> NF r) \<in> r\<^sup>* \<and> (SOME xa. (x, xa) \<in> r\<^sup>* \<and> xa \<in> NF r) \<in> NF r

goal (1 subgoal):
 1. (x, some_NF r x) \<in> r\<^sup>* \<and> some_NF r x \<in> NF r
[PROOF STEP]
unfolding some_NF_def
[PROOF STATE]
proof (prove)
using this:
(x, SOME xa. (x, xa) \<in> r\<^sup>* \<and> xa \<in> NF r) \<in> r\<^sup>* \<and> (SOME xa. (x, xa) \<in> r\<^sup>* \<and> xa \<in> NF r) \<in> NF r

goal (1 subgoal):
 1. (x, SOME y. (x, y) \<in> r\<^sup>* \<and> y \<in> NF r) \<in> r\<^sup>* \<and> (SOME y. (x, y) \<in> r\<^sup>* \<and> y \<in> NF r) \<in> NF r
[PROOF STEP]
.


[STATEMENT]
lemma majE: "2 * (E - \<alpha>) \<ge> N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. N \<le> 2 * (E - \<alpha>)
[PROOF STEP]
using TNaE TltN
[PROOF STATE]
proof (prove)
using this:
2 * (N + 2 * \<alpha> - E) \<le> T
T < N

goal (1 subgoal):
 1. N \<le> 2 * (E - \<alpha>)
[PROOF STEP]
by auto


[STATEMENT]
lemma plus_nat_code [code]:
  "nat_of_num k + nat_of_num l = nat_of_num (k + l)"
  "m + 0 = (m::nat)"
  "0 + n = (n::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_of_num k + nat_of_num l = nat_of_num (k + l) &&& m + 0 = m &&& 0 + n = n
[PROOF STEP]
by (simp_all add: nat_of_num_numeral)


[STATEMENT]
lemma local_flow_ball: "local_flow (f g) UNIV UNIV (\<phi> g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local_flow (f g) UNIV UNIV (\<lambda>t s. \<chi>i. if i = 1 then g \<cdot> t\<^sup>2 / 2 + s $ 2 \<cdot> t + s $ 1 else g \<cdot> t + s $ 2)
[PROOF STEP]
apply(unfold_locales, simp_all add: local_lipschitz_def lipschitz_on_def vec_eq_iff, clarsimp)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x t. \<exists>u>0. (\<exists>ta. dist t ta \<le> u) \<longrightarrow> (\<exists>L\<ge>0. \<forall>xa\<in>cball x u. \<forall>y\<in>cball x u. dist (f g xa) (f g y) \<le> L \<cdot> dist xa y)
 2. \<And>t s. \<forall>i.  D (\<lambda>x. if i = 1 then g \<cdot> x\<^sup>2 / 2 + s $ 2 \<cdot> x + s $ 1 else g \<cdot> x + s $ 2) = (\<lambda>x. if i = 1 then (\<chi>i. if i = 1 then g \<cdot> x\<^sup>2 / 2 + s $ 2 \<cdot> x + s $ 1 else g \<cdot> x + s $ 2) $ 2 else g) on {0--t}
 3. \<And>s. \<forall>i. i \<noteq> 1 \<longrightarrow> s $ 2 = s $ i
[PROOF STEP]
apply(rule_tac x="1/2" in exI, clarsimp, rule_tac x=1 in exI)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x t ta. dist t ta \<cdot> 2 \<le> 1 \<Longrightarrow> 0 \<le> 1 \<and> (\<forall>xa\<in>cball x (1 / 2). \<forall>y\<in>cball x (1 / 2). dist (f g xa) (f g y) \<le> 1 \<cdot> dist xa y)
 2. \<And>t s. \<forall>i.  D (\<lambda>x. if i = 1 then g \<cdot> x\<^sup>2 / 2 + s $ 2 \<cdot> x + s $ 1 else g \<cdot> x + s $ 2) = (\<lambda>x. if i = 1 then (\<chi>i. if i = 1 then g \<cdot> x\<^sup>2 / 2 + s $ 2 \<cdot> x + s $ 1 else g \<cdot> x + s $ 2) $ 2 else g) on {0--t}
 3. \<And>s. \<forall>i. i \<noteq> 1 \<longrightarrow> s $ 2 = s $ i
[PROOF STEP]
apply(simp add: dist_norm norm_vec_def L2_set_def UNIV_2)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>t s. \<forall>i.  D (\<lambda>x. if i = 1 then g \<cdot> x\<^sup>2 / 2 + s $ 2 \<cdot> x + s $ 1 else g \<cdot> x + s $ 2) = (\<lambda>x. if i = 1 then (\<chi>i. if i = 1 then g \<cdot> x\<^sup>2 / 2 + s $ 2 \<cdot> x + s $ 1 else g \<cdot> x + s $ 2) $ 2 else g) on {0--t}
 2. \<And>s. \<forall>i. i \<noteq> 1 \<longrightarrow> s $ 2 = s $ i
[PROOF STEP]
by (auto simp: forall_2 intro!: poly_derivatives)


[STATEMENT]
lemma meet_below1[intro]:
  fixes x y :: "'a :: Finite_Meet_cpo"
  assumes "x \<sqsubseteq> z"
  shows "(x \<sqinter> y) \<sqsubseteq> z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<sqinter> y \<sqsubseteq> z
[PROOF STEP]
unfolding meet_def'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sqinter>{x, y} \<sqsubseteq> z
[PROOF STEP]
by (metis assms binary_meet_exists' below_trans glb_eqI is_glbD1 is_lb_insert)


[STATEMENT]
lemma retraction_maps_to_retract_maps:
   "retraction_maps X Y r s
        \<Longrightarrow> retraction_maps X (subtopology X (s ` (topspace Y))) (s \<circ> r) id"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. retraction_maps X Y r s \<Longrightarrow> retraction_maps X (subtopology X (s ` topspace Y)) (s \<circ> r) id
[PROOF STEP]
unfolding retraction_maps_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map X Y r \<and> continuous_map Y X s \<and> (\<forall>x\<in>topspace Y. r (s x) = x) \<Longrightarrow> continuous_map X (subtopology X (s ` topspace Y)) (s \<circ> r) \<and> continuous_map (subtopology X (s ` topspace Y)) X id \<and> (\<forall>x\<in>topspace (subtopology X (s ` topspace Y)). (s \<circ> r) (id x) = x)
[PROOF STEP]
by (auto simp: continuous_map_compose continuous_map_into_subtopology continuous_map_from_subtopology)


[STATEMENT]
lemma inverse_scaleR_distrib: "inverse (scaleR a x) = scaleR (inverse a) (inverse x)"
  for x :: "'a::{real_div_algebra,division_ring}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (a *\<^sub>R x) = inverse x /\<^sub>R a
[PROOF STEP]
by (metis inverse_zero nonzero_inverse_scaleR_distrib scale_eq_0_iff)


[STATEMENT]
lemma surj_map_us: "surj (map_us::('a::complete_lattice_with_dual \<Rightarrow> 'b::complete_lattice_with_dual) \<Rightarrow> ('a upset \<Rightarrow> 'b upset))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. top_pres ((`) map_us)
[PROOF STEP]
by (simp add: map_us_map_IInf_iff surj_def)


[STATEMENT]
theorem wls_fresh_psubst_E1:
assumes "wls s X" and "wlsEnv rho"
and "rho ys y = None" and "fresh zs z (X #[rho])"
shows "fresh ys y X \<or> (ys \<noteq> zs \<or> y \<noteq> z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fresh ys y X \<or> ys \<noteq> zs \<or> y \<noteq> z
[PROOF STEP]
using assms fresh_psubst_E1[of X rho ys y zs z]
[PROOF STATE]
proof (prove)
using this:
wls s X
wlsEnv rho
rho ys y = None
fresh zs z X #[rho]
\<lbrakk>good X; goodEnv rho; rho ys y = None; fresh zs z X #[rho]\<rbrakk> \<Longrightarrow> fresh ys y X \<or> ys \<noteq> zs \<or> y \<noteq> z

goal (1 subgoal):
 1. fresh ys y X \<or> ys \<noteq> zs \<or> y \<noteq> z
[PROOF STEP]
by simp


[STATEMENT]
lemma eclose_0 [simp]: "eclose 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eclose 0 = 0
[PROOF STEP]
by (metis Ord_0 Vset_0 Vset_Transset eclose_minimal less_eq_hempty)


[STATEMENT]
lemma float_nprt:
  "nprt (float (a, b)) = (if 0 <= a then (float (0,b)) else (float (a, b)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprt (float (a, b)) = (if 0 \<le> a then float (0, b) else float (a, b))
[PROOF STEP]
by (auto simp add: zero_le_float float_le_zero float_zero)


[STATEMENT]
lemma cadd_succ: "succ m \<oplus> n = vcard (succ(m \<oplus> n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZFC_in_HOL.succ m \<oplus> n = vcard (ZFC_in_HOL.succ (m \<oplus> n))
[PROOF STEP]
proof (unfold cadd_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
have [intro]: "elts (m \<Uplus> n) \<approx> elts (vcard (m \<Uplus> n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (m \<Uplus> n) \<approx> elts (vcard (m \<Uplus> n))
[PROOF STEP]
using cardinal_eqpoll eqpoll_sym
[PROOF STATE]
proof (prove)
using this:
elts (vcard ?a) \<approx> elts ?a
?A \<approx> ?B \<Longrightarrow> ?B \<approx> ?A

goal (1 subgoal):
 1. elts (m \<Uplus> n) \<approx> elts (vcard (m \<Uplus> n))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
elts (m \<Uplus> n) \<approx> elts (vcard (m \<Uplus> n))

goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
have "vcard (succ m \<Uplus> n) = vcard (succ(m \<Uplus> n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (m \<Uplus> n))
[PROOF STEP]
by (rule sum_succ_eqpoll [THEN cardinal_cong])
[PROOF STATE]
proof (state)
this:
vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (m \<Uplus> n))

goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (m \<Uplus> n))

goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
have "\<dots> = vcard (succ(vcard (m \<Uplus> n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ (m \<Uplus> n)) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
by (blast intro: succ_eqpoll_cong cardinal_cong)
[PROOF STATE]
proof (state)
this:
vcard (ZFC_in_HOL.succ (m \<Uplus> n)) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))

goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
show "vcard (succ m \<Uplus> n) = vcard (succ(vcard (m \<Uplus> n)))"
[PROOF STATE]
proof (prove)
using this:
vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))

goal (1 subgoal):
 1. vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vcard (ZFC_in_HOL.succ m \<Uplus> n) = vcard (ZFC_in_HOL.succ (vcard (m \<Uplus> n)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma FL_Red_F_eq:
  "FL.Red_F N =
   {C. \<forall>D \<in> \<G>_F (fst C). D \<in> G.Red_F (\<Union> (\<G>_F ` fst ` N)) \<or> (\<exists>E \<in> N. E \<sqsubset> C \<and> D \<in> \<G>_F (fst E))}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. FL.Red_F_\<G> N = {C. \<forall>D\<in>\<G>_F (fst C). D \<in> G.Red_F (\<Union> (\<G>_F ` fst ` N)) \<or> (\<exists>E\<in>N. E \<sqsubset> C \<and> D \<in> \<G>_F (fst E))}
[PROOF STEP]
unfolding FL.Red_F_def FL.Red_F_\<G>_q_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Inter>q. {C. \<forall>D\<in>\<G>_F (fst C). D \<in> G.Red_F (\<Union>CL\<in>N. \<G>_F (fst CL)) \<or> (\<exists>E\<in>N. E \<sqsubset> C \<and> D \<in> \<G>_F (fst E))}) = {C. \<forall>D\<in>\<G>_F (fst C). D \<in> G.Red_F (\<Union> (\<G>_F ` fst ` N)) \<or> (\<exists>E\<in>N. E \<sqsubset> C \<and> D \<in> \<G>_F (fst E))}
[PROOF STEP]
by auto


[STATEMENT]
lemma nn_integral_monotone_convergence_SUP_countable:
  fixes f :: "'a \<Rightarrow> 'b \<Rightarrow> ennreal"
  assumes nonempty: "Y \<noteq> {}"
  and chain: "Complete_Partial_Order.chain (\<le>) (f ` Y)"
  and countable: "countable B"
  shows "(\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B) = (SUP i\<in>Y. (\<integral>\<^sup>+ x. f i x \<partial>count_space B))"
  (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
let ?f = "(\<lambda>i x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
have "?lhs = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B (to_nat_on B x))) \<partial>count_space B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B (to_nat_on B x))) \<partial>count_space B
[PROOF STEP]
by(rule nn_integral_cong)(simp add: countable)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B (to_nat_on B x))) \<partial>count_space B

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B (to_nat_on B x))) \<partial>count_space B

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x)) \<partial>count_space (to_nat_on B ` B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B (to_nat_on B x))) \<partial>count_space B = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x)) \<partial>count_space (to_nat_on B ` B)
[PROOF STEP]
by(simp add: embed_measure_count_space'[symmetric] inj_on_to_nat_on countable nn_integral_embed_measure' measurable_embed_measure1)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B (to_nat_on B x))) \<partial>count_space B = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x)) \<partial>count_space (to_nat_on B ` B)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B (to_nat_on B x))) \<partial>count_space B = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x)) \<partial>count_space (to_nat_on B ` B)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
have "\<dots> = \<integral>\<^sup>+ x. (SUP i\<in>Y. ?f i x) \<partial>count_space UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x)) \<partial>count_space (to_nat_on B ` B) = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) \<partial>count_space UNIV
[PROOF STEP]
by(simp add: nn_integral_count_space_indicator ennreal_indicator[symmetric] SUP_mult_right_ennreal nonempty)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x)) \<partial>count_space (to_nat_on B ` B) = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x)) \<partial>count_space (to_nat_on B ` B) = \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) \<partial>count_space UNIV

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
have "\<dots> = (SUP i\<in>Y. \<integral>\<^sup>+ x. ?f i x \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) \<partial>count_space UNIV = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x \<partial>count_space UNIV)
[PROOF STEP]
proof(rule nn_integral_monotone_convergence_SUP_nat)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Complete_Partial_Order.chain (\<le>) ((\<lambda>i x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) ` Y)
 2. Y \<noteq> {}
[PROOF STEP]
show "Complete_Partial_Order.chain (\<le>) (?f ` Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complete_Partial_Order.chain (\<le>) ((\<lambda>i x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) ` Y)
[PROOF STEP]
by(rule chain_imageI[OF chain, unfolded image_image])(auto intro!: le_funI split: split_indicator dest: le_funD)
[PROOF STATE]
proof (state)
this:
Complete_Partial_Order.chain (\<le>) ((\<lambda>i x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) ` Y)

goal (1 subgoal):
 1. Y \<noteq> {}
[PROOF STEP]
qed fact
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) \<partial>count_space UNIV = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x \<partial>count_space UNIV)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x) \<partial>count_space UNIV = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x \<partial>count_space UNIV)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
have "\<dots> = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) \<partial>count_space (to_nat_on B ` B))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x \<partial>count_space UNIV) = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) \<partial>count_space (to_nat_on B ` B))
[PROOF STEP]
by(simp add: nn_integral_count_space_indicator)
[PROOF STATE]
proof (state)
this:
(SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x \<partial>count_space UNIV) = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) \<partial>count_space (to_nat_on B ` B))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) * indicator (to_nat_on B ` B) x \<partial>count_space UNIV) = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) \<partial>count_space (to_nat_on B ` B))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
have "\<dots> = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B (to_nat_on B x)) \<partial>count_space B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) \<partial>count_space (to_nat_on B ` B)) = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B (to_nat_on B x)) \<partial>count_space B)
[PROOF STEP]
by(simp add: embed_measure_count_space'[symmetric] inj_on_to_nat_on countable nn_integral_embed_measure' measurable_embed_measure1)
[PROOF STATE]
proof (state)
this:
(SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) \<partial>count_space (to_nat_on B ` B)) = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B (to_nat_on B x)) \<partial>count_space B)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B x) \<partial>count_space (to_nat_on B ` B)) = (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B (to_nat_on B x)) \<partial>count_space B)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B (to_nat_on B x)) \<partial>count_space B) = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
by(intro arg_cong2[where f = "\<lambda>A f. Sup (f ` A)"] ext nn_integral_cong_AE)(simp_all add: AE_count_space countable)
[PROOF STATE]
proof (state)
this:
(SUP i\<in>Y. \<integral>\<^sup>+ x. f i (from_nat_into B (to_nat_on B x)) \<partial>count_space B) = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. (SUP i\<in>Y. f i x) \<partial>count_space B = (SUP i\<in>Y. integral\<^sup>N (count_space B) (f i))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integral_indicator_finite_real:
  fixes f :: "'a \<Rightarrow> real"
  assumes [simp]: "finite A"
  assumes [measurable]: "\<And>a. a \<in> A \<Longrightarrow> {a} \<in> sets M"
  assumes finite: "\<And>a. a \<in> A \<Longrightarrow> emeasure M {a} < \<infinity>"
  shows "(\<integral>x. f x * indicator A x \<partial>M) = (\<Sum>a\<in>A. f a * measure M {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
have "(\<integral>x. f x * indicator A x \<partial>M) = (\<integral>x. (\<Sum>a\<in>A. f a * indicator {a} x) \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. f x * indicat_real A x = LINT x|M. (\<Sum>a\<in>A. f a * indicat_real {a} x)
[PROOF STEP]
proof (intro integral_cong refl)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x * indicat_real A x = (\<Sum>a\<in>A. f a * indicat_real {a} x)
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> space M \<Longrightarrow> f x * indicat_real A x = (\<Sum>a\<in>A. f a * indicat_real {a} x)
[PROOF STEP]
show "f x * indicator A x = (\<Sum>a\<in>A. f a * indicator {a} x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x * indicat_real A x = (\<Sum>a\<in>A. f a * indicat_real {a} x)
[PROOF STEP]
by (auto split: split_indicator simp: eq_commute[of x] cong: conj_cong)
[PROOF STATE]
proof (state)
this:
f x * indicat_real A x = (\<Sum>a\<in>A. f a * indicat_real {a} x)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
LINT x|M. f x * indicat_real A x = LINT x|M. (\<Sum>a\<in>A. f a * indicat_real {a} x)

goal (1 subgoal):
 1. LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
LINT x|M. f x * indicat_real A x = LINT x|M. (\<Sum>a\<in>A. f a * indicat_real {a} x)

goal (1 subgoal):
 1. LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
have "\<dots> = (\<Sum>a\<in>A. f a * measure M {a})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LINT x|M. (\<Sum>a\<in>A. f a * indicat_real {a} x) = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
using finite
[PROOF STATE]
proof (prove)
using this:
?a \<in> A \<Longrightarrow> emeasure M {?a} < \<infinity>

goal (1 subgoal):
 1. LINT x|M. (\<Sum>a\<in>A. f a * indicat_real {a} x) = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
by (subst integral_sum) (auto)
[PROOF STATE]
proof (state)
this:
LINT x|M. (\<Sum>a\<in>A. f a * indicat_real {a} x) = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})

goal (1 subgoal):
 1. LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})

goal (1 subgoal):
 1. LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
LINT x|M. f x * indicat_real A x = (\<Sum>a\<in>A. f a * Sigma_Algebra.measure M {a})

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rev_ordsetmap: "\<lbrakk> a\<in>P; b\<in>P; f a \<^bold>\<le>* f b \<rbrakk> \<Longrightarrow> a \<^bold>\<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> P; b \<in> P; f a \<^bold>\<le>* f b\<rbrakk> \<Longrightarrow> a \<^bold>\<le> b
[PROOF STEP]
using inv_ordsetmap the_inv_into_f_f[OF inj]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?a \<in> f ` P; ?b \<in> f ` P; ?a \<^bold>\<le>* ?b\<rbrakk> \<Longrightarrow> the_inv_into P f ?a \<^bold>\<le> the_inv_into P f ?b
?x \<in> P \<Longrightarrow> the_inv_into P f (f ?x) = ?x

goal (1 subgoal):
 1. \<lbrakk>a \<in> P; b \<in> P; f a \<^bold>\<le>* f b\<rbrakk> \<Longrightarrow> a \<^bold>\<le> b
[PROOF STEP]
by fastforce


[STATEMENT]
lemma finite_divisors_nat': "n > (0 :: nat) \<Longrightarrow> finite {(a,b). a * b = n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < n \<Longrightarrow> finite {(a, b). a * b = n}
[PROOF STEP]
by (rule finite_subset[of _ "{0<..n} \<times> {0<..n}"]) auto


[STATEMENT]
lemma wf_nabla: "wf (converse R) \<longleftrightarrow> rel_nabla R = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf (R\<inverse>) = (rel_nabla R = {})
[PROOF STEP]
by (metis (no_types, lifting) fdia_rel_im2 rel_fdivka.nabla_unfold_eq rel_nabla_prop rel_nabla_unfold wfE_pf wfI_pf wf_nabla_aux)


[STATEMENT]
lemma deformation_retraction_imp_isomorphic_relative_homology_groups:
   "\<lbrakk>retraction_maps X Y r s; r ` U \<subseteq> V; s ` V \<subseteq> U; homotopic_with (\<lambda>h. h ` U \<subseteq> U) X X (s \<circ> r) id\<rbrakk>
    \<Longrightarrow> relative_homology_group p X U \<cong> relative_homology_group p Y V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>retraction_maps X Y r s; r ` U \<subseteq> V; s ` V \<subseteq> U; homotopic_with (\<lambda>h. h ` U \<subseteq> U) X X (s \<circ> r) id\<rbrakk> \<Longrightarrow> relative_homology_group p X U \<cong> relative_homology_group p Y V
[PROOF STEP]
by (blast intro: is_isoI group_isomorphisms_imp_iso deformation_retraction_relative_homology_group_isomorphisms)


[STATEMENT]
lemma cf_comp_ArrMap_app[cat_cs_simps]:
  assumes "\<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>" and "\<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>" and [simp]: "f \<in>\<^sub>\<circ> \<AA>\<lparr>Arr\<rparr>"
  shows "(\<GG> \<circ>\<^sub>C\<^sub>F \<FF>)\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> = \<GG>\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> = \<GG>\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>\<rparr>
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> = \<GG>\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>\<rparr>
[PROOF STEP]
interpret L: is_functor \<alpha> \<BB> \<CC> \<GG>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<GG> : \<BB> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> = \<GG>\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>\<rparr>
[PROOF STEP]
interpret R: is_functor \<alpha> \<AA> \<BB> \<FF>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<FF> : \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> = \<GG>\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>\<rparr>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> = \<GG>\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>\<rparr>
[PROOF STEP]
by
      (
        rule smcf_comp_ArrMap_app
          [
            OF L.cf_is_semifunctor R.cf_is_semifunctor,
            unfolded slicing_simps slicing_commute,
            OF assms(3)
          ]
      )
[PROOF STATE]
proof (state)
this:
(\<GG> \<circ>\<^sub>D\<^sub>G\<^sub>H\<^sub>M \<FF>)\<lparr>ArrMap\<rparr>\<lparr>f\<rparr> = \<GG>\<lparr>ArrMap\<rparr>\<lparr>\<FF>\<lparr>ArrMap\<rparr>\<lparr>f\<rparr>\<rparr>

goal:
No subgoals!
[PROOF STEP]
qed