[STATEMENT]
lemma chordal_circle1:
  assumes "is_real A" and "is_real D" and "Re (A * D) < 0" and "r = sqrt(Re ((4*A)/(A-D)))"
  shows "mk_circline A 0 0 D = chordal_circle \<infinity>\<^sub>h r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mk_circline A 0 0 D = chordal_circle \<infinity>\<^sub>h r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
is_real A
is_real D
Re (A * D) < 0
r = sqrt (Re (4 * A / (A - D)))

goal (1 subgoal):
 1. mk_circline A 0 0 D = chordal_circle \<infinity>\<^sub>h r
[PROOF STEP]
proof (transfer, transfer)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
fix A D r
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
assume *: "is_real A" "is_real D" "Re (A * D) < 0" "r = sqrt (Re ((4*A)/(A-D)))"
[PROOF STATE]
proof (state)
this:
is_real A
is_real D
Re (A * D) < 0
r = sqrt (Re (4 * A / (A - D)))

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
hence "A \<noteq> 0 \<or> D \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
is_real A
is_real D
Re (A * D) < 0
r = sqrt (Re (4 * A / (A - D)))

goal (1 subgoal):
 1. A \<noteq> 0 \<or> D \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A \<noteq> 0 \<or> D \<noteq> 0

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
hence "(A, 0, 0, D) \<in> hermitean_nonzero"
[PROOF STATE]
proof (prove)
using this:
A \<noteq> 0 \<or> D \<noteq> 0

goal (1 subgoal):
 1. (A, 0, 0, D) \<in> hermitean_nonzero
[PROOF STEP]
using eq_cnj_iff_real[of A] eq_cnj_iff_real[of D] *
[PROOF STATE]
proof (prove)
using this:
A \<noteq> 0 \<or> D \<noteq> 0
(cnj A = A) = is_real A
(cnj D = D) = is_real D
is_real A
is_real D
Re (A * D) < 0
r = sqrt (Re (4 * A / (A - D)))

goal (1 subgoal):
 1. (A, 0, 0, D) \<in> hermitean_nonzero
[PROOF STEP]
unfolding hermitean_def
[PROOF STATE]
proof (prove)
using this:
A \<noteq> 0 \<or> D \<noteq> 0
(cnj A = A) = is_real A
(cnj D = D) = is_real D
is_real A
is_real D
Re (A * D) < 0
r = sqrt (Re (4 * A / (A - D)))

goal (1 subgoal):
 1. (A, 0, 0, D) \<in> {H. mat_adj H = H \<and> H \<noteq> mat_zero}
[PROOF STEP]
by (simp add: mat_adj_def mat_cnj_def)
[PROOF STATE]
proof (state)
this:
(A, 0, 0, D) \<in> hermitean_nonzero

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(A, 0, 0, D) \<in> hermitean_nonzero

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
have "(- (cor r)\<^sup>2, 0, 0, 4 - (cor r)\<^sup>2) \<in> hermitean_nonzero"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- (cor r)\<^sup>2, 0, 0, 4 - (cor r)\<^sup>2) \<in> hermitean_nonzero
[PROOF STEP]
by (simp add: hermitean_def mat_adj_def mat_cnj_def power2_eq_square)
[PROOF STATE]
proof (state)
this:
(- (cor r)\<^sup>2, 0, 0, 4 - (cor r)\<^sup>2) \<in> hermitean_nonzero

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(- (cor r)\<^sup>2, 0, 0, 4 - (cor r)\<^sup>2) \<in> hermitean_nonzero

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
have "A \<noteq> D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<noteq> D
[PROOF STEP]
using \<open>Re (A * D) < 0\<close> \<open>is_real A\<close> \<open>is_real D\<close>
[PROOF STATE]
proof (prove)
using this:
Re (A * D) < 0
is_real A
is_real D

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

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
have "Re ((4*A)/(A-D)) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Re (4 * A / (A - D))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. 0 \<le> Re (4 * A / (A - D))
[PROOF STEP]
have "Re A / Re (A - D) \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> Re A / Re (A - D)
[PROOF STEP]
using \<open>Re (A * D) < 0\<close> \<open>is_real A\<close> \<open>is_real D\<close>
[PROOF STATE]
proof (prove)
using this:
Re (A * D) < 0
is_real A
is_real D

goal (1 subgoal):
 1. 0 \<le> Re A / Re (A - D)
[PROOF STEP]
using chordal_circle_det_positive[of "Re A" "Re D"]
[PROOF STATE]
proof (prove)
using this:
Re (A * D) < 0
is_real A
is_real D
Re A * Re D < 0 \<Longrightarrow> 0 < Re A / (Re A - Re D)

goal (1 subgoal):
 1. 0 \<le> Re A / Re (A - D)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
0 \<le> Re A / Re (A - D)

goal (1 subgoal):
 1. 0 \<le> Re (4 * A / (A - D))
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
0 \<le> Re A / Re (A - D)

goal (1 subgoal):
 1. 0 \<le> Re (4 * A / (A - D))
[PROOF STEP]
using \<open>is_real A\<close> \<open>is_real D\<close> \<open>A \<noteq> D\<close>
[PROOF STATE]
proof (prove)
using this:
0 \<le> Re A / Re (A - D)
is_real A
is_real D
A \<noteq> D

goal (1 subgoal):
 1. 0 \<le> Re (4 * A / (A - D))
[PROOF STEP]
by (subst Re_divide_real, auto)
[PROOF STATE]
proof (state)
this:
0 \<le> Re (4 * A / (A - D))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> Re (4 * A / (A - D))

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> Re (4 * A / (A - D))

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
have "- (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A
[PROOF STEP]
using \<open>is_real A\<close> \<open>is_real D\<close> \<open>A \<noteq> D\<close> \<open>Re ((4*A)/(A-D)) \<ge> 0\<close>
[PROOF STATE]
proof (prove)
using this:
is_real A
is_real D
A \<noteq> D
0 \<le> Re (4 * A / (A - D))

goal (1 subgoal):
 1. - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A
[PROOF STEP]
by (simp add: cor_sqrt_squared field_simps)
[PROOF STATE]
proof (state)
this:
- (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
- (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
have "4 - 4 * A / (A - D) = 4 * D / (D - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 4 - 4 * A / (A - D) = 4 * D / (D - A)
[PROOF STEP]
using\<open>A \<noteq> D\<close>
[PROOF STATE]
proof (prove)
using this:
A \<noteq> D

goal (1 subgoal):
 1. 4 - 4 * A / (A - D) = 4 * D / (D - A)
[PROOF STEP]
by (simp add: divide_simps split: if_split_asm) (simp add: minus_mult_right)
[PROOF STATE]
proof (state)
this:
4 - 4 * A / (A - D) = 4 * D / (D - A)

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
hence **: "4 - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * D"
[PROOF STATE]
proof (prove)
using this:
4 - 4 * A / (A - D) = 4 * D / (D - A)

goal (1 subgoal):
 1. 4 - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * D
[PROOF STEP]
using \<open>Re ((4*A)/(A-D)) \<ge> 0\<close> \<open>is_real A\<close> \<open>is_real D\<close> \<open>A \<noteq> D\<close>
[PROOF STATE]
proof (prove)
using this:
4 - 4 * A / (A - D) = 4 * D / (D - A)
0 \<le> Re (4 * A / (A - D))
is_real A
is_real D
A \<noteq> D

goal (1 subgoal):
 1. 4 - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * D
[PROOF STEP]
by (simp add: cor_sqrt_squared field_simps)
[PROOF STATE]
proof (state)
this:
4 - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * D

goal (1 subgoal):
 1. \<And>A D r Aa Da ra. \<lbrakk>is_real A; is_real D; Re (A * D) < 0; r = sqrt (Re (4 * A / (A - D))); is_real Aa; is_real Da; Re (Aa * Da) < 0; ra = sqrt (Re (4 * Aa / (Aa - Da)))\<rbrakk> \<Longrightarrow> circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(A, 0, 0, D) \<in> hermitean_nonzero
(- (cor r)\<^sup>2, 0, 0, 4 - (cor r)\<^sup>2) \<in> hermitean_nonzero
0 \<le> Re (4 * A / (A - D))
- (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A
4 - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * D
[PROOF STEP]
show "circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)"
[PROOF STATE]
proof (prove)
using this:
(A, 0, 0, D) \<in> hermitean_nonzero
(- (cor r)\<^sup>2, 0, 0, 4 - (cor r)\<^sup>2) \<in> hermitean_nonzero
0 \<le> Re (4 * A / (A - D))
- (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A
4 - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * D

goal (1 subgoal):
 1. circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
using * \<open>is_real A\<close> \<open>is_real D\<close> \<open>A \<noteq> D\<close> \<open>r = sqrt(Re ((4*A)/(A-D)))\<close>
[PROOF STATE]
proof (prove)
using this:
(A, 0, 0, D) \<in> hermitean_nonzero
(- (cor r)\<^sup>2, 0, 0, 4 - (cor r)\<^sup>2) \<in> hermitean_nonzero
0 \<le> Re (4 * A / (A - D))
- (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * A
4 - (cor (sqrt (Re (4 * A / (A - D)))))\<^sup>2 = cor (Re (4 / (D - A))) * D
is_real A
is_real D
Re (A * D) < 0
r = sqrt (Re (4 * A / (A - D)))
is_real A
is_real D
A \<noteq> D
r = sqrt (Re (4 * A / (A - D)))

goal (1 subgoal):
 1. circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)
[PROOF STEP]
by (simp, rule_tac x="Re(4/(D-A))" in exI, auto, simp_all add: **)
[PROOF STATE]
proof (state)
this:
circline_eq_cmat (mk_circline_cmat A 0 0 D) (chordal_circle_cvec_cmat \<infinity>\<^sub>v r)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nonpos_IntsI:
  "x \<in> \<int> \<Longrightarrow> x \<le> 0 \<Longrightarrow> (x :: 'a :: linordered_idom) \<in> \<int>\<^sub>\<le>\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> \<int>; x \<le> (0::'a)\<rbrakk> \<Longrightarrow> x \<in> \<int>\<^sub>\<le>\<^sub>0
[PROOF STEP]
unfolding nonpos_Ints_def Ints_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> range of_int; x \<le> (0::'a)\<rbrakk> \<Longrightarrow> x \<in> {of_int n |n. n \<le> 0}
[PROOF STEP]
by auto


[STATEMENT]
lemma has_integral_nonneg:
  fixes f :: "'n::euclidean_space \<Rightarrow> real"
  assumes "(f has_integral i) S"
    and "\<And>x. x \<in> S \<Longrightarrow> 0 \<le> f x"
  shows "0 \<le> i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
using has_integral_component_nonneg[of 1 f i S]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<in> Basis; (f has_integral i) S; \<And>x. x \<in> S \<Longrightarrow> 0 \<le> f x \<bullet> 1\<rbrakk> \<Longrightarrow> 0 \<le> i \<bullet> 1

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
unfolding o_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<in> Basis; (f has_integral i) S; \<And>x. x \<in> S \<Longrightarrow> 0 \<le> f x \<bullet> 1\<rbrakk> \<Longrightarrow> 0 \<le> i \<bullet> 1

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 \<in> Basis; (f has_integral i) S; \<And>x. x \<in> S \<Longrightarrow> 0 \<le> f x \<bullet> 1\<rbrakk> \<Longrightarrow> 0 \<le> i \<bullet> 1
(f has_integral i) S
?x \<in> S \<Longrightarrow> 0 \<le> f ?x

goal (1 subgoal):
 1. 0 \<le> i
[PROOF STEP]
by auto


[STATEMENT]
lemma subset_f_image_iff: "(B \<subseteq> xs `\<^sup>f A) = (\<exists>A'\<subseteq>A. B = xs `\<^sup>f A')"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B \<subseteq> xs `\<^sup>f A) = (\<exists>A'\<subseteq>A. B = xs `\<^sup>f A')
[PROOF STEP]
apply (rule iffI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. B \<subseteq> xs `\<^sup>f A \<Longrightarrow> \<exists>A'\<subseteq>A. B = xs `\<^sup>f A'
 2. \<exists>A'\<subseteq>A. B = xs `\<^sup>f A' \<Longrightarrow> B \<subseteq> xs `\<^sup>f A
[PROOF STEP]
apply (rule_tac x="{ n. n \<in> A \<and> n < length xs \<and> xs ! n \<in> B }" in exI)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. B \<subseteq> xs `\<^sup>f A \<Longrightarrow> {n \<in> A. n < length xs \<and> xs ! n \<in> B} \<subseteq> A \<and> B = xs `\<^sup>f {n \<in> A. n < length xs \<and> xs ! n \<in> B}
 2. \<exists>A'\<subseteq>A. B = xs `\<^sup>f A' \<Longrightarrow> B \<subseteq> xs `\<^sup>f A
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>A'\<subseteq>A. B = xs `\<^sup>f A' \<Longrightarrow> B \<subseteq> xs `\<^sup>f A
[PROOF STEP]
apply (blast intro: f_image_mono)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma complete_less_not: "\<lbrakk> complete A r; hasw [x,y] A; \<not> x \<^bsub>r\<^esub>\<prec> y \<rbrakk> \<Longrightarrow> y \<^bsub>r\<^esub>\<preceq> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>complete A r; hasw [x, y] A; \<not> x \<^bsub>r\<^esub>\<prec> y\<rbrakk> \<Longrightarrow> y \<^bsub>r\<^esub>\<preceq> x
[PROOF STEP]
unfolding complete_def strict_pref_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x\<in>A. \<forall>y\<in>A - {x}. x \<^bsub>r\<^esub>\<preceq> y \<or> y \<^bsub>r\<^esub>\<preceq> x; hasw [x, y] A; \<not> (x \<^bsub>r\<^esub>\<preceq> y \<and> (y, x) \<notin> r)\<rbrakk> \<Longrightarrow> y \<^bsub>r\<^esub>\<preceq> x
[PROOF STEP]
by auto


[STATEMENT]
lemma max_Var_floatarith_eq_Max_vars_floatarith:
  "max_Var_floatarith fa = (if vars_floatarith fa = {} then 0 else Suc (Max (vars_floatarith fa)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. max_Var_floatarith fa = (if vars_floatarith fa = {} then 0 else Suc (Max (vars_floatarith fa)))
[PROOF STEP]
by (induction fa) (auto split: if_splits simp: Max_Un Max_eq_iff max_def)


[STATEMENT]
lemma aff_dim_eq_dim_subtract:
  "aff_dim S = int (dim ((\<lambda>x. x - a) ` S))" if "a \<in> affine hull S"
    for S :: "'n::euclidean_space set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. aff_dim S = int (dim ((\<lambda>x. x - a) ` S))
[PROOF STEP]
using aff_dim_eq_dim [of a] that
[PROOF STATE]
proof (prove)
using this:
a \<in> affine hull ?S \<Longrightarrow> aff_dim ?S = int (dim ((+) (- a) ` ?S))
a \<in> affine hull S

goal (1 subgoal):
 1. aff_dim S = int (dim ((\<lambda>x. x - a) ` S))
[PROOF STEP]
by (simp cong: image_cong_simp)


[STATEMENT]
lemma conjuncts: "(\<forall>q\<in> set (conjuncts p). Ifm vs bs q) = Ifm vs bs p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>q\<in>set (conjuncts p). Ifm vs bs q) = Ifm vs bs p
[PROOF STEP]
by (induct p rule: conjuncts.induct) auto


[STATEMENT]
lemma norm_isometry:
  fixes U :: \<open>'a::{chilbert_space,not_singleton} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_inner\<close>
  assumes \<open>isometry U\<close>
  shows \<open>norm U = 1\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm U = 1
[PROOF STEP]
apply (subst asm_rl[of \<open>U = U o\<^sub>C\<^sub>L id_cblinfun\<close>], simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (U o\<^sub>C\<^sub>L id_cblinfun) = 1
[PROOF STEP]
apply (subst norm_isometry_compose, simp add: assms)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm id_cblinfun = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma monoD[dest?]:
  assumes "mono\<^sub>a\<^sub>b f" and "x \<le>\<^sub>a y"
  shows "f x \<le>\<^sub>b f y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x \<le>\<^sub>b f y
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mono\<^sub>a\<^sub>b f
x \<le>\<^sub>a y

goal (1 subgoal):
 1. f x \<le>\<^sub>b f y
[PROOF STEP]
unfolding mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>UNIV. \<forall>y\<in>UNIV. x \<le>\<^sub>a y \<longrightarrow> f x \<le>\<^sub>b f y
x \<le>\<^sub>a y

goal (1 subgoal):
 1. f x \<le>\<^sub>b f y
[PROOF STEP]
by simp


[STATEMENT]
lemma walk_length_odd_sym:
  assumes "is_walk w"
  assumes "hd w \<in> Y" and "last w \<in> X"
  shows "odd (walk_length w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (walk_length w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd (walk_length w)
[PROOF STEP]
interpret sym: bipartite_graph V E Y X
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bipartite_graph V E Y X
[PROOF STEP]
using bipartite_sym
[PROOF STATE]
proof (prove)
using this:
bipartite_graph V E Y X

goal (1 subgoal):
 1. bipartite_graph V E Y X
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. odd (walk_length w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. odd (walk_length w)
[PROOF STEP]
using assms sym.walk_length_odd
[PROOF STATE]
proof (prove)
using this:
is_walk w
hd w \<in> Y
last w \<in> X
\<lbrakk>is_walk ?w; hd ?w \<in> Y; last ?w \<in> X\<rbrakk> \<Longrightarrow> odd (walk_length ?w)

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma W_eq_berlekamp_mat:
fixes u::"'a mod_ring poly"
shows "{v. [v^CARD('a) = v] (mod u) \<and> degree v < degree u}
  = {h. let H = vec_of_list ((coeffs h) @ replicate (degree u - length (coeffs h)) 0) in
    (transpose_mat (berlekamp_mat u)) *\<^sub>v H = H \<and> degree h < degree u}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u} = {h. let H = vec_of_list (coeffs h @ replicate (degree u - length (coeffs h)) 0) in (berlekamp_mat u)\<^sup>T *\<^sub>v H = H \<and> degree h < degree u}
[PROOF STEP]
using equation_13
[PROOF STATE]
proof (prove)
using this:
degree ?h < degree ?u \<Longrightarrow> [?h ^ CARD(?'a) = ?h] (mod ?u) = ((berlekamp_mat ?u)\<^sup>T *\<^sub>v vec_of_list (coeffs ?h @ replicate (degree ?u - length (coeffs ?h)) 0) = vec_of_list (coeffs ?h @ replicate (degree ?u - length (coeffs ?h)) 0))

goal (1 subgoal):
 1. {v. [v ^ CARD('a) = v] (mod u) \<and> degree v < degree u} = {h. let H = vec_of_list (coeffs h @ replicate (degree u - length (coeffs h)) 0) in (berlekamp_mat u)\<^sup>T *\<^sub>v H = H \<and> degree h < degree u}
[PROOF STEP]
by (auto simp add: Let_def)


[STATEMENT]
lemma Least_disj: "
  \<lbrakk> \<exists>x. P x; \<exists>x. Q x \<rbrakk> \<Longrightarrow>
  (LEAST (x::'a::wellorder). (P x \<or> Q x)) = min (LEAST x. P x) (LEAST x. Q x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>x. P x; \<exists>x. Q x\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (elim exE, rename_tac x1 x2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>P x1; Q x2\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (subgoal_tac "\<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
 2. \<And>x1 x2 x1a x2a Pa Qa. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa\<rbrakk> \<Longrightarrow> (LEAST x. Pa x \<or> Qa x) = Least Pa
[PROOF STEP]
prefer 2
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2 x1a x2a Pa Qa. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa\<rbrakk> \<Longrightarrow> (LEAST x. Pa x \<or> Qa x) = Least Pa
 2. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (rule Least_equality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x1 x2 x1a x2a Pa Qa. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa\<rbrakk> \<Longrightarrow> Pa (Least Pa) \<or> Qa (Least Pa)
 2. \<And>x1 x2 x1a x2a Pa Qa y. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa; Pa y \<or> Qa y\<rbrakk> \<Longrightarrow> Least Pa \<le> y
 3. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (blast intro: LeastI Least_le)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2 x1a x2a Pa Qa y. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa; Pa y \<or> Qa y\<rbrakk> \<Longrightarrow> Least Pa \<le> y
 2. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (erule disjE)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<And>x1 x2 x1a x2a Pa Qa y. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa; Pa y\<rbrakk> \<Longrightarrow> Least Pa \<le> y
 2. \<And>x1 x2 x1a x2a Pa Qa y. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa; Qa y\<rbrakk> \<Longrightarrow> Least Pa \<le> y
 3. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (rule Least_le, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2 x1a x2a Pa Qa y. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa; Qa y\<rbrakk> \<Longrightarrow> Least Pa \<le> y
 2. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (rule order_trans, assumption)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2 x1a x2a Pa Qa y. \<lbrakk>P x1; Q x2; Pa x1a; Qa x2a; Least Pa \<le> Least Qa; Qa y\<rbrakk> \<Longrightarrow> Least Qa \<le> y
 2. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (rule Least_le, assumption)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = min (LEAST x. P x) (LEAST x. Q x)
[PROOF STEP]
apply (unfold min_def, split if_split, safe)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P
 2. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P; \<not> Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least Q
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P; \<not> Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least Q
[PROOF STEP]
apply (subst disj_commute)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x1 x2. \<lbrakk>P x1; Q x2; \<And>x1 x2 P Q. \<lbrakk>P x1; Q x2; Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. P x \<or> Q x) = Least P; \<not> Least P \<le> Least Q\<rbrakk> \<Longrightarrow> (LEAST x. Q x \<or> P x) = Least Q
[PROOF STEP]
apply (fastforce simp: linorder_not_le)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cSUP_singleton [simp]: "(SUP x\<in>{x}. f x :: _ :: conditionally_complete_lattice) = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> (f ` {x}) = f x
[PROOF STEP]
by (metis cSup_singleton image_empty image_insert)


[STATEMENT]
lemma strict_mono_f_make_mono:
"\<forall>n. f n < oLimit f \<Longrightarrow> strict_mono (\<lambda>n. f (make_mono f n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>n. f n < oLimit f \<Longrightarrow> OrdinalInduct.strict_mono (\<lambda>n. f (make_mono f n))
[PROOF STEP]
by (rule strict_mono_natI, erule f_make_mono_less)


[STATEMENT]
lemma continuous_map_square_root: "continuous_map euclideanreal euclideanreal sqrt"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_map euclideanreal euclideanreal sqrt
[PROOF STEP]
by (simp add: continuous_at_imp_continuous_on isCont_real_sqrt)


[STATEMENT]
lemma GRP031_2:
  "(\<forall>X Y. product(X::'a,Y,multiply(X::'a,Y))) &
  (\<forall>X Y Z W. product(X::'a,Y,Z) & product(X::'a,Y,W) --> equal(Z::'a,W)) &
  (\<forall>Y U Z X V W. product(X::'a,Y,U) & product(Y::'a,Z,V) & product(U::'a,Z,W) --> product(X::'a,V,W)) &
  (\<forall>Y X V U Z W. product(X::'a,Y,U) & product(Y::'a,Z,V) & product(X::'a,V,W) --> product(U::'a,Z,W)) &
  (\<forall>A. product(A::'a,INVERSE(A),identity)) &
  (\<forall>A. product(A::'a,identity,A)) &
  (\<forall>A. ~product(A::'a,a,identity)) --> False"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>X Y. product (X, Y, multiply (X, Y))) \<and> (\<forall>X Y Z W. product (X, Y, Z) \<and> product (X, Y, W) \<longrightarrow> equal (Z, W)) \<and> (\<forall>Y U Z X V W. product (X, Y, U) \<and> product (Y, Z, V) \<and> product (U, Z, W) \<longrightarrow> product (X, V, W)) \<and> (\<forall>Y X V U Z W. product (X, Y, U) \<and> product (Y, Z, V) \<and> product (X, V, W) \<longrightarrow> product (U, Z, W)) \<and> (\<forall>A. product (A, INVERSE A, identity)) \<and> (\<forall>A. product (A, identity, A)) \<and> (\<forall>A. \<not> product (A, a, identity)) \<longrightarrow> False
[PROOF STEP]
by meson


[STATEMENT]
lemma listwordinterval_compress:
    "(\<Union>s \<in> set (listwordinterval_compress ss). interval_of s) = (\<Union>s \<in> set ss. interval_of s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> (interval_of ` set (listwordinterval_compress ss)) = \<Union> (interval_of ` set ss)
[PROOF STEP]
apply(induction ss rule: listwordinterval_compress.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<Union> (interval_of ` set (listwordinterval_compress [])) = \<Union> (interval_of ` set [])
 2. \<And>s ss. \<lbrakk>Ball (set ss) (disjoint_intervals s) \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress ss)) = \<Union> (interval_of ` set ss); \<not> Ball (set ss) (disjoint_intervals s) \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress (merge_overlap s ss))) = \<Union> (interval_of ` set (merge_overlap s ss))\<rbrakk> \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress (s # ss))) = \<Union> (interval_of ` set (s # ss))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s ss. \<lbrakk>Ball (set ss) (disjoint_intervals s) \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress ss)) = \<Union> (interval_of ` set ss); \<not> Ball (set ss) (disjoint_intervals s) \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress (merge_overlap s ss))) = \<Union> (interval_of ` set (merge_overlap s ss))\<rbrakk> \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress (s # ss))) = \<Union> (interval_of ` set (s # ss))
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s ss. \<lbrakk>\<forall>x\<in>set ss. disjoint_intervals s x \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress ss)) = \<Union> (interval_of ` set ss); \<exists>x\<in>set ss. \<not> disjoint_intervals s x \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress (merge_overlap s ss))) = \<Union> (interval_of ` set (merge_overlap s ss))\<rbrakk> \<Longrightarrow> (\<exists>x\<in>set ss. \<not> disjoint_intervals s x) \<longrightarrow> \<Union> (interval_of ` set (merge_overlap s ss)) = interval_of s \<union> \<Union> (interval_of ` set ss)
[PROOF STEP]
apply(intro impI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s ss. \<lbrakk>\<forall>x\<in>set ss. disjoint_intervals s x \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress ss)) = \<Union> (interval_of ` set ss); \<exists>x\<in>set ss. \<not> disjoint_intervals s x \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress (merge_overlap s ss))) = \<Union> (interval_of ` set (merge_overlap s ss)); \<exists>x\<in>set ss. \<not> disjoint_intervals s x\<rbrakk> \<Longrightarrow> \<Union> (interval_of ` set (merge_overlap s ss)) = interval_of s \<union> \<Union> (interval_of ` set ss)
[PROOF STEP]
apply(simp add: disjoint_intervals_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s ss. \<lbrakk>\<forall>x\<in>set ss. disjoint (interval_of s) (interval_of x) \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress ss)) = \<Union> (interval_of ` set ss); \<Union> (interval_of ` set (listwordinterval_compress (merge_overlap s ss))) = \<Union> (interval_of ` set (merge_overlap s ss)); \<exists>x\<in>set ss. \<not> disjoint (interval_of s) (interval_of x)\<rbrakk> \<Longrightarrow> \<Union> (interval_of ` set (merge_overlap s ss)) = interval_of s \<union> \<Union> (interval_of ` set ss)
[PROOF STEP]
apply(drule merge_overlap_helper2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>s ss. \<lbrakk>\<forall>x\<in>set ss. disjoint (interval_of s) (interval_of x) \<Longrightarrow> \<Union> (interval_of ` set (listwordinterval_compress ss)) = \<Union> (interval_of ` set ss); \<Union> (interval_of ` set (listwordinterval_compress (merge_overlap s ss))) = \<Union> (interval_of ` set (merge_overlap s ss)); interval_of s \<union> \<Union> (interval_of ` set ss) = \<Union> (interval_of ` set (merge_overlap s ss))\<rbrakk> \<Longrightarrow> \<Union> (interval_of ` set (merge_overlap s ss)) = interval_of s \<union> \<Union> (interval_of ` set ss)
[PROOF STEP]
apply(simp)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma m_st_height: assumes "finite X" and "set (dom S) \<subseteq> X"
shows "m_st m_ivl S \<le> 2 * card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m_st m_ivl S \<le> 2 * card X
[PROOF STEP]
proof(auto simp: m_st_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
have "(\<Sum>x\<in>set(dom S). m_ivl (fun S x)) \<le> (\<Sum>x\<in>set(dom S). 2)" (is "?L \<le> _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> (\<Sum>x\<in>set (Abs_State.dom S). 2)
[PROOF STEP]
by(rule sum_mono)(simp add:m_ivl_height)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> (\<Sum>x\<in>set (Abs_State.dom S). 2)

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> (\<Sum>x\<in>set (Abs_State.dom S). 2)

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
have "\<dots> \<le> (\<Sum>x\<in>X. 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). 2) \<le> (\<Sum>x\<in>X. 2)
[PROOF STEP]
by(rule sum_mono2[OF assms]) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Abs_State.dom S). 2) \<le> (\<Sum>x\<in>X. 2)

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Abs_State.dom S). 2) \<le> (\<Sum>x\<in>X. 2)

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
have "\<dots> = 2 * card X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x\<in>X. 2) = 2 * card X
[PROOF STEP]
by(simp)
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>X. 2) = 2 * card X

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
show "?L \<le> \<dots>"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X

goal (1 subgoal):
 1. (\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>set (Abs_State.dom S). m_ivl (fun S x)) \<le> 2 * card X

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trans_valid_step:
  "valid_step (i,j) (i',j') \<Longrightarrow> valid_step (i+k\<^sub>1,j+k\<^sub>2) (i'+k\<^sub>1,j'+k\<^sub>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_step (i, j) (i', j') \<Longrightarrow> valid_step (i + k\<^sub>1, j + k\<^sub>2) (i' + k\<^sub>1, j' + k\<^sub>2)
[PROOF STEP]
unfolding valid_step_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. case (i, j) of (i, j) \<Rightarrow> (i', j') \<in> {(i + 1, j + 2), (i - 1, j + 2), (i + 1, j - 2), (i - 1, j - 2), (i + 2, j + 1), (i - 2, j + 1), (i + 2, j - 1), (i - 2, j - 1)} \<Longrightarrow> case (i + k\<^sub>1, j + k\<^sub>2) of (i, j) \<Rightarrow> (i' + k\<^sub>1, j' + k\<^sub>2) \<in> {(i + 1, j + 2), (i - 1, j + 2), (i + 1, j - 2), (i - 1, j - 2), (i + 2, j + 1), (i - 2, j + 1), (i + 2, j - 1), (i - 2, j - 1)}
[PROOF STEP]
by auto


[STATEMENT]
lemma homeomorphic_Borsukian_eq:
   "S homeomorphic T \<Longrightarrow> Borsukian S \<longleftrightarrow> Borsukian T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S homeomorphic T \<Longrightarrow> Borsukian S = Borsukian T
[PROOF STEP]
by (meson homeomorphic_Borsukian homeomorphic_sym)


[STATEMENT]
lemma card_lists_distinct_length_eq:
  assumes "finite A"
  shows "card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
 2. \<not> ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
assume "n \<le> card A"
[PROOF STATE]
proof (state)
this:
n \<le> card A

goal (2 subgoals):
 1. ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
 2. \<not> ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
have "card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - n + 1..card A}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - n + 1..card A}
[PROOF STEP]
using \<open>finite A\<close> \<open>n \<le> card A\<close>
[PROOF STATE]
proof (prove)
using this:
finite A
n \<le> card A

goal (1 subgoal):
 1. card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - n + 1..card A}
[PROOF STEP]
by (rule card_lists_distinct_length_eq)
[PROOF STATE]
proof (state)
this:
card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - n + 1..card A}

goal (2 subgoals):
 1. ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
 2. \<not> ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = \<Prod>{card A - n + 1..card A}

goal (2 subgoals):
 1. ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
 2. \<not> ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
have "\<dots> = ffact n (card A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>{card A - n + 1..card A} = ffact n (card A)
[PROOF STEP]
using \<open>n \<le> card A\<close>
[PROOF STATE]
proof (prove)
using this:
n \<le> card A

goal (1 subgoal):
 1. \<Prod>{card A - n + 1..card A} = ffact n (card A)
[PROOF STEP]
by (simp add: prod_rev_ffact_nat'[symmetric])
[PROOF STATE]
proof (state)
this:
\<Prod>{card A - n + 1..card A} = ffact n (card A)

goal (2 subgoals):
 1. ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
 2. \<not> ?P \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)

goal (1 subgoal):
 1. card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)

goal (1 subgoal):
 1. \<not> n \<le> card A \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> n \<le> card A \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
assume "\<not> n \<le> card A"
[PROOF STATE]
proof (state)
this:
\<not> n \<le> card A

goal (1 subgoal):
 1. \<not> n \<le> card A \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
from this \<open>finite A\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> card A
finite A
[PROOF STEP]
have "\<forall>xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A \<longrightarrow> False"
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> card A
finite A

goal (1 subgoal):
 1. \<forall>xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A \<longrightarrow> False
[PROOF STEP]
by (metis card_mono distinct_card)
[PROOF STATE]
proof (state)
this:
\<forall>xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A \<longrightarrow> False

goal (1 subgoal):
 1. \<not> n \<le> card A \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<forall>xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A \<longrightarrow> False
[PROOF STEP]
have eq_empty: "{xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = {}"
[PROOF STATE]
proof (prove)
using this:
\<forall>xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A \<longrightarrow> False

goal (1 subgoal):
 1. {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = {}
[PROOF STEP]
using \<open>finite A\<close>
[PROOF STATE]
proof (prove)
using this:
\<forall>xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A \<longrightarrow> False
finite A

goal (1 subgoal):
 1. {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = {}

goal (1 subgoal):
 1. \<not> n \<le> card A \<Longrightarrow> card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
from \<open>\<not> n \<le> card A\<close>
[PROOF STATE]
proof (chain)
picking this:
\<not> n \<le> card A
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> n \<le> card A

goal (1 subgoal):
 1. card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)
[PROOF STEP]
by (simp add: ffact_nat_triv eq_empty)
[PROOF STATE]
proof (state)
this:
card {xs. length xs = n \<and> distinct xs \<and> set xs \<subseteq> A} = ffact n (card A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma frac_le: "0 \<le> x \<Longrightarrow> x \<le> y \<Longrightarrow> 0 < w \<Longrightarrow> w \<le> z  \<Longrightarrow> x / z \<le> y / w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> x; x \<le> y; (0::'a) < w; w \<le> z\<rbrakk> \<Longrightarrow> x / z \<le> y / w
[PROOF STEP]
using local.mult_imp_div_pos_le local.mult_imp_le_div_pos local.mult_mono
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(0::'a) < ?y; ?x \<le> ?z * ?y\<rbrakk> \<Longrightarrow> ?x / ?y \<le> ?z
\<lbrakk>(0::'a) < ?y; ?z * ?y \<le> ?x\<rbrakk> \<Longrightarrow> ?z \<le> ?x / ?y
\<lbrakk>?a \<le> ?b; ?c \<le> ?d; (0::'a) \<le> ?b; (0::'a) \<le> ?c\<rbrakk> \<Longrightarrow> ?a * ?c \<le> ?b * ?d

goal (1 subgoal):
 1. \<lbrakk>(0::'a) \<le> x; x \<le> y; (0::'a) < w; w \<le> z\<rbrakk> \<Longrightarrow> x / z \<le> y / w
[PROOF STEP]
by auto


[STATEMENT]
lemma vector_3 [simp]:
 "(vector [x,y,z] ::('a::zero)^3)$1 = x"
 "(vector [x,y,z] ::('a::zero)^3)$2 = y"
 "(vector [x,y,z] ::('a::zero)^3)$3 = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vector [x, y, z] $ 1 = x &&& vector [x, y, z] $ 2 = y &&& vector [x, y, z] $ 3 = z
[PROOF STEP]
unfolding vector_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [x, y, z] (\<lambda>n x. 0::'a) 1) $ 1 = x &&& vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [x, y, z] (\<lambda>n x. 0::'a) 1) $ 2 = y &&& vec_lambda (foldr (\<lambda>x f n. (f (n + 1))(n := x)) [x, y, z] (\<lambda>n x. 0::'a) 1) $ 3 = z
[PROOF STEP]
by simp_all


[STATEMENT]
lemma wf_subterm_triple_rel:
    shows "wf subterm_triple_rel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf {((t1, t2, t3), u1, u2, u3). subterm t1 u1 \<and> subterm t2 u2 \<and> subterm t3 u3}
[PROOF STEP]
using subterm_implies_smaller
            wf_if_img_lt [of subterm_triple_rel
                             "\<lambda>(t1, t2, t3). max (max (size t1) (size t2)) (size t3)"]
[PROOF STATE]
proof (prove)
using this:
subterm ?t ?u \<Longrightarrow> local.size ?t < local.size ?u
(\<And>x y. (x, y) \<in> {((t1, t2, t3), u1, u2, u3). subterm t1 u1 \<and> subterm t2 u2 \<and> subterm t3 u3} \<Longrightarrow> (case x of (t1, t2, t3) \<Rightarrow> max (max (local.size t1) (local.size t2)) (local.size t3)) < (case y of (t1, t2, t3) \<Rightarrow> max (max (local.size t1) (local.size t2)) (local.size t3))) \<Longrightarrow> wf {((t1, t2, t3), u1, u2, u3). subterm t1 u1 \<and> subterm t2 u2 \<and> subterm t3 u3}

goal (1 subgoal):
 1. wf {((t1, t2, t3), u1, u2, u3). subterm t1 u1 \<and> subterm t2 u2 \<and> subterm t3 u3}
[PROOF STEP]
by fastforce


[STATEMENT]
lemma singular_relboundary_alt:
   "singular_relboundary p X S c \<longleftrightarrow>
    (\<exists>d e. singular_chain (Suc p) X d \<and> singular_chain p (subtopology X S) e \<and>
           chain_boundary (Suc p) d = c + e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. singular_relboundary p X S c = (\<exists>d e. singular_chain (Suc p) X d \<and> singular_chain p (subtopology X S) e \<and> chain_boundary (Suc p) d = c + e)
[PROOF STEP]
unfolding singular_relboundary_def mod_subset_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>d. singular_chain (Suc p) X d \<and> (chain_boundary (Suc p) d, c) \<in> {(a, b). singular_chain p (subtopology X S) (a - b)}) = (\<exists>d e. singular_chain (Suc p) X d \<and> singular_chain p (subtopology X S) e \<and> chain_boundary (Suc p) d = c + e)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma sum_ssub_block_bound:
  shows "nth_digit (\<Sum>S- p j (\<lambda>k. s k && z (l k))) t b \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nth_digit \<Sum>S- p j (\<lambda>k. s k && z (l k))  t b \<le> 1
[PROOF STEP]
using block_sum_ssub_bound sum_ssub_nth_digit_commute
[PROOF STATE]
proof (prove)
using this:
\<forall>t. \<Sum>S- p ?j (\<lambda>k. nth_digit (s k && z (?l k)) t b)  \<le> 1
nth_digit \<Sum>S- p ?j (\<lambda>k. s k && z (?l k))  ?t b = \<Sum>S- p ?j (\<lambda>k. nth_digit (s k && z (?l k)) ?t b)

goal (1 subgoal):
 1. nth_digit \<Sum>S- p j (\<lambda>k. s k && z (l k))  t b \<le> 1
[PROOF STEP]
by auto


[STATEMENT]
lemma decrease_variant:
  assumes "y \<le> z"
      and "w \<le> z"
      and "\<not> w \<le> y"
    shows "card { x . x \<le> y } < card { x . x \<le> z }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {x. x \<le> y} < card {x. x \<le> z}
[PROOF STEP]
by (metis Collect_mono assms card_seteq linorder_not_le dual_order.trans finite_code mem_Collect_eq)


[STATEMENT]
lemma ereal_abs_mult: "\<bar>x * y :: ereal\<bar> = \<bar>x\<bar> * \<bar>y\<bar>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x * y\<bar> = \<bar>x\<bar> * \<bar>y\<bar>
[PROOF STEP]
by (cases x y rule: ereal2_cases) (auto simp: abs_mult)


[STATEMENT]
theorem complete_nat:
  assumes finite_cs: "finite Cs" "\<forall>C\<in>Cs. finite C"
  assumes unsat: "\<forall>(F::nat fun_denot) (G::nat pred_denot) . \<not>eval\<^sub>c\<^sub>s F G Cs"
  shows "\<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'
[PROOF STEP]
using assms completeness_nat
[PROOF STATE]
proof (prove)
using this:
finite Cs
\<forall>C\<in>Cs. finite C
\<forall>F G. \<not> eval\<^sub>c\<^sub>s F G Cs
\<lbrakk>finite ?Cs; \<forall>C\<in>?Cs. finite C; \<forall>F G. \<not> eval\<^sub>c\<^sub>s F G ?Cs\<rbrakk> \<Longrightarrow> \<exists>Cs'. resolution_deriv ?Cs Cs' \<and> {} \<in> Cs'

goal (1 subgoal):
 1. \<exists>Cs'. resolution_deriv Cs Cs' \<and> {} \<in> Cs'
[PROOF STEP]
by -


[STATEMENT]
lemma (in prob_space) distributed_joint_indep:
  assumes S: "sigma_finite_measure S" and T: "sigma_finite_measure T"
  assumes X: "distributed M S X Px" and Y: "distributed M T Y Py"
  assumes indep: "indep_var S X T Y"
  shows "distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>(x, y). Px x * Py y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>(x, y). Px x * Py y)
[PROOF STEP]
using indep_var_distribution_eq[of S X T Y] indep
[PROOF STATE]
proof (prove)
using this:
indep_var S X T Y = (random_variable S X \<and> random_variable T Y \<and> distr M S X \<Otimes>\<^sub>M distr M T Y = distr M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)))
indep_var S X T Y

goal (1 subgoal):
 1. distributed M (S \<Otimes>\<^sub>M T) (\<lambda>x. (X x, Y x)) (\<lambda>(x, y). Px x * Py y)
[PROOF STEP]
by (intro distributed_joint_indep'[OF S T X Y]) auto


[STATEMENT]
theorem elements_matrix_distribution_1:
assumes wf1:"mat (row_length A1) (length A1) A1"
   and wf2:"mat (row_length A2) (length A2) A2"
   and wf3:"mat (row_length B1) (length B1) B1"
   and wf4:"mat (row_length B2) (length B2) B2"
   and matchAA:"length A1 = row_length A2"
   and matchBB:"length B1 = row_length B2"
   and non_Nil:"(A1 \<noteq> [])\<and>(A2 \<noteq> [])\<and>(B1 \<noteq> [])\<and>(B2 \<noteq> [])"
   and "i<(row_length A1)*(row_length B1)" and "j< (length A2)*(length B2)"
shows
"((matrix_mult A1  A2)\<otimes>(matrix_mult B1  B2))!j!i
  =  f (scalar_product (row A1 (i div (row_length B1)))
                        (col A2  (j div (length B2))))
       (scalar_product (row B1 (i mod (row_length B1)))
                       (col B2 (j mod (length B2))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have 0:"((matrix_mult A1  A2)\<otimes>(matrix_mult B1  B2)) \<noteq> []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []
[PROOF STEP]
using non_empty_distribution assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>mat ?nr1.0 ?n1.0 ?A1.0; mat ?n1.0 ?nc1.0 ?A2.0; mat ?nr2.0 ?n2.0 ?B1.0; mat ?n2.0 ?nc2.0 ?B2.0; ?A1.0 \<noteq> []; ?B1.0 \<noteq> []; ?A2.0 \<noteq> []; ?B2.0 \<noteq> []\<rbrakk> \<Longrightarrow> ?A1.0 \<circ> ?A2.0 \<otimes> ?B1.0 \<circ> ?B2.0 \<noteq> []
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2

goal (1 subgoal):
 1. A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []
[PROOF STEP]
have 1:"mat ((row_length A1)*(row_length B1))
            ((length A2)*(length B2))
                    ((A1\<circ>A2)\<otimes>(B1\<circ>B2))"
[PROOF STATE]
proof (prove)
using this:
A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []

goal (1 subgoal):
 1. mat (row_length A1 * row_length B1) (length A2 * length B2) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
using tensor_compose_distribution1 assms
[PROOF STATE]
proof (prove)
using this:
A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []
\<lbrakk>mat (row_length ?A1.0) (length ?A1.0) ?A1.0; mat (row_length ?A2.0) (length ?A2.0) ?A2.0; mat (row_length ?B1.0) (length ?B1.0) ?B1.0; mat (row_length ?B2.0) (length ?B2.0) ?B2.0; length ?A1.0 = row_length ?A2.0; length ?B1.0 = row_length ?B2.0; ?A1.0 \<noteq> [] \<and> ?A2.0 \<noteq> [] \<and> ?B1.0 \<noteq> [] \<and> ?B2.0 \<noteq> []\<rbrakk> \<Longrightarrow> mat (row_length ?A1.0 * row_length ?B1.0) (length ?A2.0 * length ?B2.0) (?A1.0 \<circ> ?A2.0 \<otimes> ?B1.0 \<circ> ?B2.0)
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2

goal (1 subgoal):
 1. mat (row_length A1 * row_length B1) (length A2 * length B2) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length A1 * row_length B1) (length A2 * length B2) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length A1 * row_length B1) (length A2 * length B2) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
have 2:"mat (row_length  ((A1\<circ>A2)\<otimes>(B1\<circ>B2)))
            (length  ((A1\<circ>A2)\<otimes>(B1\<circ>B2)))
                    ((A1\<circ>A2)\<otimes>(B1\<circ>B2))"
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1 * row_length B1) (length A2 * length B2) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)

goal (1 subgoal):
 1. mat (row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
by (metis matrix_row_length)
[PROOF STATE]
proof (state)
this:
mat (row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
have 3:"((row_length A1)*(row_length B1))
                         = (row_length  ((A1\<circ>A2)\<otimes>(B1\<circ>B2))) "
        and "((length A2)*(length B2)) = (length  ((A1\<circ>A2)\<otimes>(B1\<circ>B2)))"
[PROOF STATE]
proof (prove)
using this:
mat (row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)

goal (1 subgoal):
 1. row_length A1 * row_length B1 = row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2) &&& length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
using 0 1 unique_row_col
[PROOF STATE]
proof (prove)
using this:
mat (row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []
mat (row_length A1 * row_length B1) (length A2 * length B2) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nr1.0 = ?nr2.0
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nc1.0 = ?nc2.0

goal (1 subgoal):
 1. row_length A1 * row_length B1 = row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2) &&& length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
apply metis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
using 0 1 2 unique_row_col
[PROOF STATE]
proof (prove)
using this:
A1 \<circ> A2 \<otimes> B1 \<circ> B2 \<noteq> []
mat (row_length A1 * row_length B1) (length A2 * length B2) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
mat (row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)) (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nr1.0 = ?nr2.0
\<lbrakk>mat ?nr1.0 ?nc1.0 ?M; mat ?nr2.0 ?nc2.0 ?M; ?M \<noteq> []\<rbrakk> \<Longrightarrow> ?nc1.0 = ?nc2.0

goal (1 subgoal):
 1. length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
row_length A1 * row_length B1 = row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
row_length A1 * row_length B1 = row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
[PROOF STEP]
have i:"(i < ((row_length A1)*(row_length B1)))
                             = (i < (row_length  ((A1\<circ>A2)\<otimes>(B1\<circ>B2))))"
[PROOF STATE]
proof (prove)
using this:
row_length A1 * row_length B1 = row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)

goal (1 subgoal):
 1. (i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have j:"(j < ((length A2)*(length B2)))
                         = (j < (length  ((A1\<circ>A2)\<otimes>(B1\<circ>B2))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (j < length A2 * length B2) = (j < length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))
[PROOF STEP]
using 3 \<open>length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)\<close>
[PROOF STATE]
proof (prove)
using this:
row_length A1 * row_length B1 = row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)
length A2 * length B2 = length (A1 \<circ> A2 \<otimes> B1 \<circ> B2)

goal (1 subgoal):
 1. (j < length A2 * length B2) = (j < length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
(j < length A2 * length B2) = (j < length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have 4:"mat (row_length A1) (length A2) (A1 \<circ> A2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (row_length A1) (length A2) (A1 \<circ> A2)
[PROOF STEP]
using assms mat_mult
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2
\<lbrakk>mat ?nr ?n ?m1.0; mat ?n ?nc ?m2.0\<rbrakk> \<Longrightarrow> mat ?nr ?nc (mat_multI ?ze ?pl ?ti ?nr ?m1.0 ?m2.0)

goal (1 subgoal):
 1. mat (row_length A1) (length A2) (A1 \<circ> A2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length A1) (length A2) (A1 \<circ> A2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length A1) (length A2) (A1 \<circ> A2)
[PROOF STEP]
have 5:"mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A2) (A1 \<circ> A2)

goal (1 subgoal):
 1. mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)
[PROOF STEP]
using  matrix_row_length
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A2) (A1 \<circ> A2)
mat ?nr ?nc ?M \<Longrightarrow> mat (row_length ?M) (length ?M) ?M

goal (1 subgoal):
 1. mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
with 4
[PROOF STATE]
proof (chain)
picking this:
mat (row_length A1) (length A2) (A1 \<circ> A2)
mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)
[PROOF STEP]
have 6:"row_length A1 = row_length (A1 \<circ> A2)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A2) (A1 \<circ> A2)
mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)

goal (1 subgoal):
 1. row_length A1 = row_length (A1 \<circ> A2)
[PROOF STEP]
by (metis "0" Tensor.simps(1) unique_row_col(1))
[PROOF STATE]
proof (state)
this:
row_length A1 = row_length (A1 \<circ> A2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
with 4 5
[PROOF STATE]
proof (chain)
picking this:
mat (row_length A1) (length A2) (A1 \<circ> A2)
mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)
row_length A1 = row_length (A1 \<circ> A2)
[PROOF STEP]
have 7:"length A2 = length (A1 \<circ> A2)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A2) (A1 \<circ> A2)
mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)
row_length A1 = row_length (A1 \<circ> A2)

goal (1 subgoal):
 1. length A2 = length (A1 \<circ> A2)
[PROOF STEP]
by (metis  mat_empty_column_length unique_row_col(2))
[PROOF STATE]
proof (state)
this:
length A2 = length (A1 \<circ> A2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length A2 = length (A1 \<circ> A2)
[PROOF STEP]
have 8:"mat (row_length B1) (length B2) (B1 \<circ> B2)"
[PROOF STATE]
proof (prove)
using this:
length A2 = length (A1 \<circ> A2)

goal (1 subgoal):
 1. mat (row_length B1) (length B2) (B1 \<circ> B2)
[PROOF STEP]
using assms mat_mult
[PROOF STATE]
proof (prove)
using this:
length A2 = length (A1 \<circ> A2)
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2
\<lbrakk>mat ?nr ?n ?m1.0; mat ?n ?nc ?m2.0\<rbrakk> \<Longrightarrow> mat ?nr ?nc (mat_multI ?ze ?pl ?ti ?nr ?m1.0 ?m2.0)

goal (1 subgoal):
 1. mat (row_length B1) (length B2) (B1 \<circ> B2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
mat (row_length B1) (length B2) (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
mat (row_length B1) (length B2) (B1 \<circ> B2)
[PROOF STEP]
have 9:"mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)"
[PROOF STATE]
proof (prove)
using this:
mat (row_length B1) (length B2) (B1 \<circ> B2)

goal (1 subgoal):
 1. mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)
[PROOF STEP]
using  matrix_row_length
[PROOF STATE]
proof (prove)
using this:
mat (row_length B1) (length B2) (B1 \<circ> B2)
mat ?nr ?nc ?M \<Longrightarrow> mat (row_length ?M) (length ?M) ?M

goal (1 subgoal):
 1. mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)
[PROOF STEP]
by (metis)
[PROOF STATE]
proof (state)
this:
mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
with 7 8
[PROOF STATE]
proof (chain)
picking this:
length A2 = length (A1 \<circ> A2)
mat (row_length B1) (length B2) (B1 \<circ> B2)
mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)
[PROOF STEP]
have 10:"row_length B1 = row_length (B1 \<circ> B2)"
[PROOF STATE]
proof (prove)
using this:
length A2 = length (A1 \<circ> A2)
mat (row_length B1) (length B2) (B1 \<circ> B2)
mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)

goal (1 subgoal):
 1. row_length B1 = row_length (B1 \<circ> B2)
[PROOF STEP]
by (metis "3" "6" assms(8) less_nat_zero_code mult_cancel2 mult_is_0 mult.commute row_length_mat)
[PROOF STATE]
proof (state)
this:
row_length B1 = row_length (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
with 7 8 9
[PROOF STATE]
proof (chain)
picking this:
length A2 = length (A1 \<circ> A2)
mat (row_length B1) (length B2) (B1 \<circ> B2)
mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)
row_length B1 = row_length (B1 \<circ> B2)
[PROOF STEP]
have 11:"length B2 = length (B1 \<circ> B2)"
[PROOF STATE]
proof (prove)
using this:
length A2 = length (A1 \<circ> A2)
mat (row_length B1) (length B2) (B1 \<circ> B2)
mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)
row_length B1 = row_length (B1 \<circ> B2)

goal (1 subgoal):
 1. length B2 = length (B1 \<circ> B2)
[PROOF STEP]
by (metis  mat_empty_column_length unique_row_col(2))
[PROOF STATE]
proof (state)
this:
length B2 = length (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
from 6 10
[PROOF STATE]
proof (chain)
picking this:
row_length A1 = row_length (A1 \<circ> A2)
row_length B1 = row_length (B1 \<circ> B2)
[PROOF STEP]
have 12:
               "(i < ((row_length A1)*(row_length B1)))
                         = (i < (row_length  (A1\<circ>A2))*(row_length (B1\<circ>B2)))"
[PROOF STATE]
proof (prove)
using this:
row_length A1 = row_length (A1 \<circ> A2)
row_length B1 = row_length (B1 \<circ> B2)

goal (1 subgoal):
 1. (i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2))
[PROOF STEP]
have 13:" (i < (row_length  (A1\<circ>A2))*(row_length (B1\<circ>B2)))"
[PROOF STATE]
proof (prove)
using this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2))

goal (1 subgoal):
 1. i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2))
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2

goal (1 subgoal):
 1. i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
from 7 11
[PROOF STATE]
proof (chain)
picking this:
length A2 = length (A1 \<circ> A2)
length B2 = length (B1 \<circ> B2)
[PROOF STEP]
have 14:
            "(j < ((length A2)*(length B2)))
                         = (j < (length  (A1\<circ>A2))*(length (B1\<circ>B2)))"
[PROOF STATE]
proof (prove)
using this:
length A2 = length (A1 \<circ> A2)
length B2 = length (B1 \<circ> B2)

goal (1 subgoal):
 1. (j < length A2 * length B2) = (j < length (A1 \<circ> A2) * length (B1 \<circ> B2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(j < length A2 * length B2) = (j < length (A1 \<circ> A2) * length (B1 \<circ> B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(j < length A2 * length B2) = (j < length (A1 \<circ> A2) * length (B1 \<circ> B2))
[PROOF STEP]
have 15:"(j < (length  (A1\<circ>A2))*(length (B1\<circ>B2)))"
[PROOF STATE]
proof (prove)
using this:
(j < length A2 * length B2) = (j < length (A1 \<circ> A2) * length (B1 \<circ> B2))

goal (1 subgoal):
 1. j < length (A1 \<circ> A2) * length (B1 \<circ> B2)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(j < length A2 * length B2) = (j < length (A1 \<circ> A2) * length (B1 \<circ> B2))
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2

goal (1 subgoal):
 1. j < length (A1 \<circ> A2) * length (B1 \<circ> B2)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j < length (A1 \<circ> A2) * length (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j < length (A1 \<circ> A2) * length (B1 \<circ> B2)
[PROOF STEP]
have step_1:"((A1\<circ>A2)\<otimes>(B1\<circ>B2))!j!i
            =  f ((A1\<circ>A2)!(j div (length (B1\<circ>B2)))
                         !(i div (row_length (B1\<circ>B2))))
                 ((B1\<circ>B2)!(j mod length (B1\<circ>B2))
                         !(i mod (row_length (B1\<circ>B2))))"
[PROOF STATE]
proof (prove)
using this:
j < length (A1 \<circ> A2) * length (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length (B1 \<circ> B2)) ! (i div row_length (B1 \<circ> B2)) * (B1 \<circ> B2) ! (j mod length (B1 \<circ> B2)) ! (i mod row_length (B1 \<circ> B2))
[PROOF STEP]
using 5 9 13 15 effective_matrix_Tensor_elements
[PROOF STATE]
proof (prove)
using this:
j < length (A1 \<circ> A2) * length (B1 \<circ> B2)
mat (row_length (A1 \<circ> A2)) (length (A1 \<circ> A2)) (A1 \<circ> A2)
mat (row_length (B1 \<circ> B2)) (length (B1 \<circ> B2)) (B1 \<circ> B2)
i < row_length (A1 \<circ> A2) * row_length (B1 \<circ> B2)
j < length (A1 \<circ> A2) * length (B1 \<circ> B2)
\<lbrakk>?i < row_length ?M1.0 * row_length ?M2.0; ?j < length ?M1.0 * length ?M2.0; mat (row_length ?M1.0) (length ?M1.0) ?M1.0; mat (row_length ?M2.0) (length ?M2.0) ?M2.0\<rbrakk> \<Longrightarrow> (?M1.0 \<otimes> ?M2.0) ! ?j ! ?i = ?M1.0 ! (?j div length ?M2.0) ! (?i div row_length ?M2.0) * ?M2.0 ! (?j mod length ?M2.0) ! (?i mod row_length ?M2.0)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length (B1 \<circ> B2)) ! (i div row_length (B1 \<circ> B2)) * (B1 \<circ> B2) ! (j mod length (B1 \<circ> B2)) ! (i mod row_length (B1 \<circ> B2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length (B1 \<circ> B2)) ! (i div row_length (B1 \<circ> B2)) * (B1 \<circ> B2) ! (j mod length (B1 \<circ> B2)) ! (i mod row_length (B1 \<circ> B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length (B1 \<circ> B2)) ! (i div row_length (B1 \<circ> B2)) * (B1 \<circ> B2) ! (j mod length (B1 \<circ> B2)) ! (i mod row_length (B1 \<circ> B2))
[PROOF STEP]
have "((A1\<circ>A2)\<otimes>(B1\<circ>B2))!j!i
            =  f ((A1\<circ>A2)!(j div (length B2))!(i div (row_length B1)))
                 ((B1\<circ>B2)!(j mod length B2)!(i mod (row_length B1)))"
[PROOF STATE]
proof (prove)
using this:
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length (B1 \<circ> B2)) ! (i div row_length (B1 \<circ> B2)) * (B1 \<circ> B2) ! (j mod length (B1 \<circ> B2)) ! (i mod row_length (B1 \<circ> B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) * (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1)
[PROOF STEP]
using 10 11
[PROOF STATE]
proof (prove)
using this:
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length (B1 \<circ> B2)) ! (i div row_length (B1 \<circ> B2)) * (B1 \<circ> B2) ! (j mod length (B1 \<circ> B2)) ! (i mod row_length (B1 \<circ> B2))
row_length B1 = row_length (B1 \<circ> B2)
length B2 = length (B1 \<circ> B2)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) * (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) * (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) * (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1)

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have " ((A1\<circ>A2)!(j div (length B2))!(i div (row_length B1)))
               = (scalar_product (row A1 (i div (row_length B1)) ) (col A2 (j div (length B2)) ))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
have "j div (length B2) < (length A2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j div length B2 < length A2
[PROOF STEP]
using div_left_ineq assms
[PROOF STATE]
proof (prove)
using this:
?x < ?y * ?z \<Longrightarrow> ?x div ?z < ?y
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2

goal (1 subgoal):
 1. j div length B2 < length A2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j div length B2 < length A2

goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
j div length B2 < length A2

goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
have "i div (row_length B1) < (row_length A1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i div row_length B1 < row_length A1
[PROOF STEP]
using assms div_left_ineq
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2
?x < ?y * ?z \<Longrightarrow> ?x div ?z < ?y

goal (1 subgoal):
 1. i div row_length B1 < row_length A1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
i div row_length B1 < row_length A1

goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i div row_length B1 < row_length A1

goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
have "mat (length A1) (length A2) A2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (length A1) (length A2) A2
[PROOF STEP]
using wf2 matchAA
[PROOF STATE]
proof (prove)
using this:
mat (row_length A2) (length A2) A2
length A1 = row_length A2

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

goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
j div length B2 < length A2
i div row_length B1 < row_length A1
mat (length A1) (length A2) A2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j div length B2 < length A2
i div row_length B1 < row_length A1
mat (length A1) (length A2) A2

goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
using wf1  non_Nil matrix_mult_index
[PROOF STATE]
proof (prove)
using this:
j div length B2 < length A2
i div row_length B1 < row_length A1
mat (length A1) (length A2) A2
mat (row_length A1) (length A1) A1
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
\<lbrakk>?m1.0 \<noteq> []; mat ?nr ?n ?m1.0; mat ?n ?nc ?m2.0; ?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> (?m1.0 \<circ> ?m2.0) ! ?j ! ?i = scalar_product (row ?m1.0 ?i) (col ?m2.0 ?j)

goal (1 subgoal):
 1. (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have " ((B1\<circ>B2)!(j mod (length B2))!(i mod (row_length B1)))
               = (scalar_product
                                 (row B1 (i mod (row_length B1)) )
                                 (col B2 (j mod (length B2))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have "j <(length A2)*(length B2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. j < length A2 * length B2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
mat (row_length A1) (length A1) A1
mat (row_length A2) (length A2) A2
mat (row_length B1) (length B1) B1
mat (row_length B2) (length B2) B2
length A1 = row_length A2
length B1 = row_length B2
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
i < row_length A1 * row_length B1
j < length A2 * length B2

goal (1 subgoal):
 1. j < length A2 * length B2
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
j < length A2 * length B2

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
j < length A2 * length B2
[PROOF STEP]
have "j mod (length B2) < (length B2)"
[PROOF STATE]
proof (prove)
using this:
j < length A2 * length B2

goal (1 subgoal):
 1. j mod length B2 < length B2
[PROOF STEP]
by (metis calculation less_nat_zero_code mod_less_divisor mult_is_0 neq0_conv)
[PROOF STATE]
proof (state)
this:
j mod length B2 < length B2

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
j mod length B2 < length B2

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have "i mod (row_length B1) < (row_length B1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i mod row_length B1 < row_length B1
[PROOF STEP]
by (metis assms(8) less_nat_zero_code mod_less_divisor mult_is_0 neq0_conv)
[PROOF STATE]
proof (state)
this:
i mod row_length B1 < row_length B1

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
i mod row_length B1 < row_length B1

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
have "mat (length B1) (length B2) B2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (length B1) (length B2) B2
[PROOF STEP]
using wf4 matchBB
[PROOF STATE]
proof (prove)
using this:
mat (row_length B2) (length B2) B2
length B1 = row_length B2

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

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
j mod length B2 < length B2
i mod row_length B1 < row_length B1
mat (length B1) (length B2) B2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
j mod length B2 < length B2
i mod row_length B1 < row_length B1
mat (length B1) (length B2) B2

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
using wf3 non_Nil matrix_mult_index
[PROOF STATE]
proof (prove)
using this:
j mod length B2 < length B2
i mod row_length B1 < row_length B1
mat (length B1) (length B2) B2
mat (row_length B1) (length B1) B1
A1 \<noteq> [] \<and> A2 \<noteq> [] \<and> B1 \<noteq> [] \<and> B2 \<noteq> []
\<lbrakk>?m1.0 \<noteq> []; mat ?nr ?n ?m1.0; mat ?n ?nc ?m2.0; ?i < ?nr; ?j < ?nc\<rbrakk> \<Longrightarrow> (?m1.0 \<circ> ?m2.0) ! ?j ! ?i = scalar_product (row ?m1.0 ?i) (col ?m2.0 ?j)

goal (1 subgoal):
 1. (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) * (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1)
(A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
(B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(i < row_length A1 * row_length B1) = (i < row_length (A1 \<circ> A2 \<otimes> B1 \<circ> B2))
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = (A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) * (B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1)
(A1 \<circ> A2) ! (j div length B2) ! (i div row_length B1) = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2))
(B1 \<circ> B2) ! (j mod length B2) ! (i mod row_length B1) = scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))

goal (1 subgoal):
 1. (A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(A1 \<circ> A2 \<otimes> B1 \<circ> B2) ! j ! i = scalar_product (row A1 (i div row_length B1)) (col A2 (j div length B2)) * scalar_product (row B1 (i mod row_length B1)) (col B2 (j mod length B2))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma tfilter_eq_TConsD:
  "tfilter a P ys = TCons x xs \<Longrightarrow>
   \<exists>us vs. ys = lappendt us (TCons x vs) \<and> lfinite us \<and> (\<forall>u\<in>lset us. \<not> P u) \<and> P x \<and> xs = tfilter a P vs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tfilter a P ys = TCons x xs \<Longrightarrow> \<exists>us vs. ys = lappendt us (TCons x vs) \<and> lfinite us \<and> (\<forall>u\<in>lset us. \<not> P u) \<and> P x \<and> xs = tfilter a P vs
[PROOF STEP]
by transfer(fastforce dest: lfilter_eq_LConsD[OF sym])


[STATEMENT]
lemma intersect_ta_ta_lang:
 "ta_lang (Q\<^sub>\<A> |\<times>| Q\<^sub>\<B>) (prod_ta \<A> \<B>) = ta_lang Q\<^sub>\<A> \<A> \<inter> ta_lang Q\<^sub>\<B> \<B>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ta_lang (Q\<^sub>\<A> |\<times>| Q\<^sub>\<B>) (prod_ta \<A> \<B>) = ta_lang Q\<^sub>\<A> \<A> \<inter> ta_lang Q\<^sub>\<B> \<B>
[PROOF STEP]
using intersect_ta_gta_lang[of Q\<^sub>\<A> Q\<^sub>\<B> \<A> \<B>]
[PROOF STATE]
proof (prove)
using this:
gta_lang (Q\<^sub>\<A> |\<times>| Q\<^sub>\<B>) (prod_ta \<A> \<B>) = gta_lang Q\<^sub>\<A> \<A> \<inter> gta_lang Q\<^sub>\<B> \<B>

goal (1 subgoal):
 1. ta_lang (Q\<^sub>\<A> |\<times>| Q\<^sub>\<B>) (prod_ta \<A> \<B>) = ta_lang Q\<^sub>\<A> \<A> \<inter> ta_lang Q\<^sub>\<B> \<B>
[PROOF STEP]
by auto (metis IntI imageI term_of_gterm_inv)

\<comment>  \<open>Union of tree automata\<close>


[STATEMENT]
lemma fv_ex_all:
  assumes "pos i (fv_fo_fmla_list \<phi>) = None"
  shows "fv_fo_fmla_list (Exists i \<phi>) = fv_fo_fmla_list \<phi>"
    "fv_fo_fmla_list (Forall i \<phi>) = fv_fo_fmla_list \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv_fo_fmla_list (Exists i \<phi>) = fv_fo_fmla_list \<phi> &&& fv_fo_fmla_list (Forall i \<phi>) = fv_fo_fmla_list \<phi>
[PROOF STEP]
using pos_complete[of i "fv_fo_fmla_list \<phi>"] fv_fo_fmla_list_eq[of "Exists i \<phi>" \<phi>]
    fv_fo_fmla_list_eq[of "Forall i \<phi>" \<phi>] assms
[PROOF STATE]
proof (prove)
using this:
pos i (fv_fo_fmla_list \<phi>) = None \<Longrightarrow> i \<notin> set (fv_fo_fmla_list \<phi>)
fv_fo_fmla (Exists i \<phi>) = fv_fo_fmla \<phi> \<Longrightarrow> fv_fo_fmla_list (Exists i \<phi>) = fv_fo_fmla_list \<phi>
fv_fo_fmla (Forall i \<phi>) = fv_fo_fmla \<phi> \<Longrightarrow> fv_fo_fmla_list (Forall i \<phi>) = fv_fo_fmla_list \<phi>
pos i (fv_fo_fmla_list \<phi>) = None

goal (1 subgoal):
 1. fv_fo_fmla_list (Exists i \<phi>) = fv_fo_fmla_list \<phi> &&& fv_fo_fmla_list (Forall i \<phi>) = fv_fo_fmla_list \<phi>
[PROOF STEP]
by (auto simp: fv_fo_fmla_list_set)


[STATEMENT]
lemma indexed_fmember_unique: "x |\<in>|\<^bsub>i\<^esub> s \<Longrightarrow> y |\<in>|\<^bsub>j\<^esub> s \<Longrightarrow> x = y \<longleftrightarrow> i = j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x |\<in>|\<^bsub>i\<^esub> s; y |\<in>|\<^bsub>j\<^esub> s\<rbrakk> \<Longrightarrow> (x = y) = (i = j)
[PROOF STEP]
by (metis distinct_list_of_fset indexed_fmember.cases length_list_of_fset nth_eq_iff_index_eq)


[STATEMENT]
lemma subst_fmla_cnj [simp]: "(A AND B)(i::=x) = (A(i::=x)) AND (B(i::=x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A AND B)(i::=x) = A(i::=x) AND B(i::=x)
[PROOF STEP]
by (auto simp: cnj_def)


[STATEMENT]
lemma gcd_0_left_int [simp]: "gcd 0 x = \<bar>x\<bar>"
  for x :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd 0 x = \<bar>x\<bar>
[PROOF STEP]
by (auto simp: gcd_int_def)


[STATEMENT]
lemma ln_primorial_asymp_equiv [asymp_equiv_intros]:
  "(\<lambda>x. ln (primorial x)) \<sim>[at_top] (\<lambda>x. x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. ln (real (primorial x))) \<sim>[at_top] (\<lambda>x. x)
[PROOF STEP]
by (auto simp: ln_primorial \<theta>_asymptotics)


[STATEMENT]
lemma symcl_insert:
  "symcl (insert (x, y) Qeq) = insert (y, x) (insert (x, y) (symcl Qeq))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. symcl (insert (x, y) Qeq) = insert (y, x) (insert (x, y) (symcl Qeq))
[PROOF STEP]
by (auto simp: symcl_def)


[STATEMENT]
lemma eq_omega_sum_less_iff:
  assumes "length ms = length ns"
  shows "(omega_sum ms, omega_sum ns) \<in> VWF \<longleftrightarrow> (ms,ns) \<in> lenlex less_than"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((omega_sum ms, omega_sum ns) \<in> VWF) = ((ms, ns) \<in> lenlex less_than)
[PROOF STEP]
by (metis assms in_lex_prod less_not_refl less_than_iff omega_sum_less_iff)


[STATEMENT]
lemma surjective_embedding_map:
   "embedding_map X Y f \<and> f ` (topspace X) = topspace Y \<longleftrightarrow> homeomorphic_map X Y f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (embedding_map X Y f \<and> f ` topspace X = topspace Y) = homeomorphic_map X Y f
[PROOF STEP]
by (force simp: embedding_map_def homeomorphic_eq_everything_map)


[STATEMENT]
lemma act_sup_distr: "\<alpha> (x \<squnion> y) p = (\<alpha> x p) \<squnion> (\<alpha> y p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<alpha> (x \<squnion> y) p = \<alpha> x p \<squnion> \<alpha> y p
[PROOF STEP]
by (metis (no_types, lifting) SUP_insert Sup_empty Sup_insert act3 sup_bot_right)


[STATEMENT]
lemma prefixes_Suc:
  "prefixes j (Suc t) =
    e_snoc (e_append_zeros (prefixes j t) (the (eval r_find_k [prefixes j t]))) 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.prefixes j (Suc t) = e_snoc (e_append_zeros (local.prefixes j t) (the (eval r_find_k [local.prefixes j t]))) 1
[PROOF STEP]
unfolding prefixes_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the (eval r_prefixes [Suc t, j]) = e_snoc (e_append_zeros (the (eval r_prefixes [t, j])) (the (eval r_find_k [the (eval r_prefixes [t, j])]))) 1
[PROOF STEP]
using r_prefixes_Suc
[PROOF STATE]
proof (prove)
using this:
eval r_prefixes [Suc ?n, ?j] \<down>= (let b = the (eval r_prefixes [?n, ?j]) in e_snoc (e_append_zeros b (the (eval r_find_k [b]))) 1)

goal (1 subgoal):
 1. the (eval r_prefixes [Suc t, j]) = e_snoc (e_append_zeros (the (eval r_prefixes [t, j])) (the (eval r_find_k [the (eval r_prefixes [t, j])]))) 1
[PROOF STEP]
by (simp_all add: Let_def)


[STATEMENT]
lemma uniformly_continuous_onD:
  "uniformly_continuous_on s f \<Longrightarrow> eventually E uniformity \<Longrightarrow>
    eventually (\<lambda>(x, y). x \<in> s \<longrightarrow> y \<in> s \<longrightarrow> E (f x, f y)) uniformity"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>uniformly_continuous_on s f; eventually E uniformity\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F (x, y) in uniformity. x \<in> s \<longrightarrow> y \<in> s \<longrightarrow> E (f x, f y)
[PROOF STEP]
by (simp add: uniformly_continuous_on_uniformity filterlim_iff
      eventually_inf_principal split_beta' mem_Times_iff imp_conjL)


[STATEMENT]
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open S = (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)
[PROOF STEP]
by (auto intro: openI)