[STATEMENT]
lemma has_integral_alt':
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  shows "(f has_integral i) s \<longleftrightarrow>
          (\<forall>a b. (\<lambda>x. if x \<in> s then f x else 0) integrable_on cbox a b) \<and>
          (\<forall>e>0. \<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
            norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - i) < e)"
  (is "?l = ?r")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral i) s = ((\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
 2. (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e) \<Longrightarrow> (f has_integral i) s
[PROOF STEP]
assume rhs: ?r
[PROOF STATE]
proof (state)
this:
(\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)

goal (2 subgoals):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
 2. (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e) \<Longrightarrow> (f has_integral i) s
[PROOF STEP]
show ?l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral i) s
[PROOF STEP]
proof (subst has_integral', intro allI impI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < e)
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < e)
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < e)
[PROOF STEP]
from rhs[THEN conjunct2,rule_format,OF this]
[PROOF STATE]
proof (chain)
picking this:
\<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
                   (\<exists>z. ((\<lambda>x. if x \<in> s then f x else 0) has_integral z)
                         (cbox a b) \<and> norm (z - i) < e)"
[PROOF STATE]
proof (prove)
using this:
\<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e

goal (1 subgoal):
 1. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < e)
[PROOF STEP]
by (simp add: has_integral_iff rhs)
[PROOF STATE]
proof (state)
this:
\<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < e)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(f has_integral i) s

goal (1 subgoal):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
[PROOF STEP]
let ?\<Phi> = "\<lambda>e a b. \<exists>z. ((\<lambda>x. if x \<in> s then f x else 0) has_integral z) (cbox a b) \<and> norm (z - i) < e"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
[PROOF STEP]
assume ?l
[PROOF STATE]
proof (state)
this:
(f has_integral i) s

goal (1 subgoal):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(f has_integral i) s
[PROOF STEP]
have lhs: "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow> ?\<Phi> e a b" if "e > 0" for e
[PROOF STATE]
proof (prove)
using this:
(f has_integral i) s

goal (1 subgoal):
 1. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < e)
[PROOF STEP]
using that has_integral'[of f]
[PROOF STATE]
proof (prove)
using this:
(f has_integral i) s
0 < e
(f has_integral ?i) ?S = (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> ?S then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - ?i) < e))

goal (1 subgoal):
 1. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < e)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < ?e)

goal (1 subgoal):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
[PROOF STEP]
let ?f = "\<lambda>x. if x \<in> s then f x else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral i) s \<Longrightarrow> (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
[PROOF STEP]
show ?r
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)
[PROOF STEP]
proof (intro conjI allI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b
 2. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
fix a b :: 'n
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b
 2. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
from lhs[OF zero_less_one]
[PROOF STATE]
proof (chain)
picking this:
\<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < 1)
[PROOF STEP]
obtain B where "0 < B" and B: "\<And>a b. ball 0 B \<subseteq> cbox a b \<Longrightarrow> ?\<Phi> 1 a b"
[PROOF STATE]
proof (prove)
using this:
\<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < 1)

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>a b. ball (0::'n) B \<subseteq> cbox a b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < 1\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < B
ball (0::'n) B \<subseteq> cbox ?a ?b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox ?a ?b) \<and> norm (z - i) < 1

goal (2 subgoals):
 1. \<And>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b
 2. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
let ?a = "\<Sum>i\<in>Basis. min (a\<bullet>i) (-B) *\<^sub>R i::'n"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b
 2. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
let ?b = "\<Sum>i\<in>Basis. max (b\<bullet>i) B *\<^sub>R i::'n"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b
 2. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
show "?f integrable_on cbox a b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b
[PROOF STEP]
proof (rule integrable_subinterval[of _ ?a ?b])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
 2. cbox a b \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
have "?a \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> ?b \<bullet> i" if "norm (0 - x) < B" "i \<in> Basis" for x i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i) \<bullet> i
[PROOF STEP]
using Basis_le_norm[of i x] that
[PROOF STATE]
proof (prove)
using this:
i \<in> Basis \<Longrightarrow> \<bar>x \<bullet> i\<bar> \<le> norm x
norm ((0::'n) - x) < B
i \<in> Basis

goal (1 subgoal):
 1. (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) \<bullet> i \<le> x \<bullet> i \<and> x \<bullet> i \<le> (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i) \<bullet> i
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
\<lbrakk>norm ((0::'n) - ?x) < B; ?i \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) \<bullet> ?i \<le> ?x \<bullet> ?i \<and> ?x \<bullet> ?i \<le> (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i) \<bullet> ?i

goal (2 subgoals):
 1. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
 2. cbox a b \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>norm ((0::'n) - ?x) < B; ?i \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) \<bullet> ?i \<le> ?x \<bullet> ?i \<and> ?x \<bullet> ?i \<le> (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i) \<bullet> ?i
[PROOF STEP]
have "ball 0 B \<subseteq> cbox ?a ?b"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>norm ((0::'n) - ?x) < B; ?i \<in> Basis\<rbrakk> \<Longrightarrow> (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) \<bullet> ?i \<le> ?x \<bullet> ?i \<and> ?x \<bullet> ?i \<le> (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i) \<bullet> ?i

goal (1 subgoal):
 1. ball (0::'n) B \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
by (auto simp: mem_box dist_norm)
[PROOF STATE]
proof (state)
this:
ball (0::'n) B \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)

goal (2 subgoals):
 1. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
 2. cbox a b \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ball (0::'n) B \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
show "?f integrable_on cbox ?a ?b"
[PROOF STATE]
proof (prove)
using this:
ball (0::'n) B \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)

goal (1 subgoal):
 1. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
unfolding integrable_on_def
[PROOF STATE]
proof (prove)
using this:
ball (0::'n) B \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)

goal (1 subgoal):
 1. \<exists>y. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral y) (cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i))
[PROOF STEP]
using B
[PROOF STATE]
proof (prove)
using this:
ball (0::'n) B \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
ball (0::'n) B \<subseteq> cbox ?a ?b \<Longrightarrow> \<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox ?a ?b) \<and> norm (z - i) < 1

goal (1 subgoal):
 1. \<exists>y. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral y) (cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)

goal (1 subgoal):
 1. cbox a b \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
show "cbox a b \<subseteq> cbox ?a ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cbox a b \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)
[PROOF STEP]
by (force simp: mem_box)
[PROOF STATE]
proof (state)
this:
cbox a b \<subseteq> cbox (\<Sum>i\<in>Basis. min (a \<bullet> i) (- B) *\<^sub>R i) (\<Sum>i\<in>Basis. max (b \<bullet> i) B *\<^sub>R i)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
fix e :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
assume "e > 0"
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
with lhs
[PROOF STATE]
proof (chain)
picking this:
0 < ?e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < ?e)
0 < e
[PROOF STEP]
show "\<exists>B>0. \<forall>a b. ball 0 B \<subseteq> cbox a b \<longrightarrow>
      norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else 0) - i) < e"
[PROOF STATE]
proof (prove)
using this:
0 < ?e \<Longrightarrow> \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> (\<exists>z. ((\<lambda>x. if x \<in> s then f x else (0::'a)) has_integral z) (cbox a b) \<and> norm (z - i) < ?e)
0 < e

goal (1 subgoal):
 1. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e
[PROOF STEP]
by (metis (no_types, lifting) has_integral_integrable_integral)
[PROOF STATE]
proof (state)
this:
\<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<forall>a b. (\<lambda>x. if x \<in> s then f x else (0::'a)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b. ball (0::'n) B \<subseteq> cbox a b \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> s then f x else (0::'a)) - i) < e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem supplement2_Legendre:
  fixes p :: int
  assumes "p > 2" "prime p"
  shows "Legendre 2 p = (-1) ^ (((nat p)^2 - 1) div 8)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
interpret GAUSS "nat p" 2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. GAUSS (nat p) 2
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p

goal (1 subgoal):
 1. GAUSS (nat p) 2
[PROOF STEP]
unfolding GAUSS_def prime_int_nat_transfer
[PROOF STATE]
proof (prove)
using this:
2 < p
0 \<le> p \<and> prime (nat p)

goal (1 subgoal):
 1. (prime (nat p) \<and> 2 < nat p) \<and> [2 \<noteq> 0] (mod int (nat p)) \<and> 0 < 2
[PROOF STEP]
by (simp add: two_cong_0_iff_int)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "card E = card ((\<lambda>x. x * 2 mod p) `
          {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..})" (is "_ = card ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card E = card ((\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..})
[PROOF STEP]
unfolding E_def C_def B_def A_def image_image
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((\<lambda>x. x * 2 mod int (nat p)) ` {0<..(int (nat p) - 1) div 2} \<inter> {(int (nat p) - 1) div 2<..}) = card ((\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p

goal (1 subgoal):
 1. card ((\<lambda>x. x * 2 mod int (nat p)) ` {0<..(int (nat p) - 1) div 2} \<inter> {(int (nat p) - 1) div 2<..}) = card ((\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card E = card ((\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..})

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card E = card ((\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..})

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "(\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} = ((*) 2) ` {0<..(p - 1) div 2}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} = (*) 2 ` {0<..(p - 1) div 2}
[PROOF STEP]
by (intro image_cong) auto
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} = (*) 2 ` {0<..(p - 1) div 2}

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. x * 2 mod p) ` {0<..(p - 1) div 2} = (*) 2 ` {0<..(p - 1) div 2}

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "card (\<dots> \<inter> {(p - 1) div 2<..}) =
               nat ((p - 1) div 2) - card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((*) 2 ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..}) = nat ((p - 1) div 2) - card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..})
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p

goal (1 subgoal):
 1. card ((*) 2 ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..}) = nat ((p - 1) div 2) - card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..})
[PROOF STEP]
by (subst card_Int) (auto simp: card_image inj_onI)
[PROOF STATE]
proof (state)
this:
card ((*) 2 ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..}) = nat ((p - 1) div 2) - card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..})

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((*) 2 ` {0<..(p - 1) div 2} \<inter> {(p - 1) div 2<..}) = nat ((p - 1) div 2) - card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..})

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "card (((*) 2) ` {0<..(p - 1) div 2} - {(p - 1) div 2<..}) = card {0 <.. (p div 4)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..}) = card {0<..p div 4}
[PROOF STEP]
by (rule sym, intro bij_betw_same_card[of "(*) 2"] bij_betw_imageI inj_onI)
       (insert assms prime_odd_int[of p], auto simp: image_def elim!: oddE)
[PROOF STATE]
proof (state)
this:
card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..}) = card {0<..p div 4}

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((*) 2 ` {0<..(p - 1) div 2} - {(p - 1) div 2<..}) = card {0<..p div 4}

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "\<dots> = nat p div 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {0<..p div 4} = nat p div 4
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p

goal (1 subgoal):
 1. card {0<..p div 4} = nat p div 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card {0<..p div 4} = nat p div 4

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {0<..p div 4} = nat p div 4

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "nat ((p - 1) div 2) - nat p div 4 =  nat ((p - 1) div 2 - p div 4)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat ((p - 1) div 2) - nat p div 4 = nat ((p - 1) div 2 - p div 4)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p

goal (1 subgoal):
 1. nat ((p - 1) div 2) - nat p div 4 = nat ((p - 1) div 2 - p div 4)
[PROOF STEP]
by (simp add: nat_diff_distrib nat_div_distrib)
[PROOF STATE]
proof (state)
this:
nat ((p - 1) div 2) - nat p div 4 = nat ((p - 1) div 2 - p div 4)

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card E = nat ((p - 1) div 2 - p div 4)
[PROOF STEP]
have "card E = \<dots>"
[PROOF STATE]
proof (prove)
using this:
card E = nat ((p - 1) div 2 - p div 4)

goal (1 subgoal):
 1. card E = nat ((p - 1) div 2 - p div 4)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card E = nat ((p - 1) div 2 - p div 4)

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
card E = nat ((p - 1) div 2 - p div 4)
[PROOF STEP]
have "Legendre 2 p = (-1) ^ nat ((p - 1) div 2 - p div 4)"
[PROOF STATE]
proof (prove)
using this:
card E = nat ((p - 1) div 2 - p div 4)

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ nat ((p - 1) div 2 - p div 4)
[PROOF STEP]
using gauss_lemma assms
[PROOF STATE]
proof (prove)
using this:
card E = nat ((p - 1) div 2 - p div 4)
Legendre 2 (int (nat p)) = (- 1) ^ card E
2 < p
prime p

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ nat ((p - 1) div 2 - p div 4)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Legendre 2 p = (- 1) ^ nat ((p - 1) div 2 - p div 4)

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Legendre 2 p = (- 1) ^ nat ((p - 1) div 2 - p div 4)

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "nat ((p - 1) div 2 - p div 4) = (nat p - 1) div 2 - nat p div 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat ((p - 1) div 2 - p div 4) = (nat p - 1) div 2 - nat p div 4
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
2 < p
prime p

goal (1 subgoal):
 1. nat ((p - 1) div 2 - p div 4) = (nat p - 1) div 2 - nat p div 4
[PROOF STEP]
by (simp add: nat_div_distrib nat_diff_distrib)
[PROOF STATE]
proof (state)
this:
nat ((p - 1) div 2 - p div 4) = (nat p - 1) div 2 - nat p div 4

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
nat ((p - 1) div 2 - p div 4) = (nat p - 1) div 2 - nat p div 4

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
have "(-1) ^ \<dots> = ((-1) ^ (((nat p)^2 - 1) div 8) :: int)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- 1) ^ ((nat p - 1) div 2 - nat p div 4) = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
using cong_aux_eq_1[of "nat p"] odd_p
[PROOF STATE]
proof (prove)
using this:
odd (nat p) \<Longrightarrow> [(nat p - 1) div 2 - nat p div 4 = ((nat p)\<^sup>2 - 1) div 8] (mod 2)
odd (nat p)

goal (1 subgoal):
 1. (- 1) ^ ((nat p - 1) div 2 - nat p div 4) = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(- 1) ^ ((nat p - 1) div 2 - nat p div 4) = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)

goal (1 subgoal):
 1. Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Legendre 2 p = (- 1) ^ (((nat p)\<^sup>2 - 1) div 8)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma filterlim_tendsto_neg_mult_at_bot:
  fixes c :: real
  assumes c: "(f \<longlongrightarrow> c) F" "c < 0" and g: "filterlim g at_top F"
  shows "LIM x F. f x * g x :> at_bot"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. LIM x F. f x * g x :> at_bot
[PROOF STEP]
using c filterlim_tendsto_pos_mult_at_top[of "\<lambda>x. - f x" "- c" F, OF _ _ g]
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> c) F
c < 0
\<lbrakk>((\<lambda>x. - f x) \<longlongrightarrow> - c) F; 0 < - c\<rbrakk> \<Longrightarrow> LIM x F. - f x * g x :> at_top

goal (1 subgoal):
 1. LIM x F. f x * g x :> at_bot
[PROOF STEP]
unfolding filterlim_uminus_at_bot tendsto_minus_cancel_left
[PROOF STATE]
proof (prove)
using this:
(f \<longlongrightarrow> c) F
c < 0
\<lbrakk>((\<lambda>x. - (- f x)) \<longlongrightarrow> c) F; 0 < - c\<rbrakk> \<Longrightarrow> LIM x F. - f x * g x :> at_top

goal (1 subgoal):
 1. LIM x F. - (f x * g x) :> at_top
[PROOF STEP]
by simp


[STATEMENT]
lemma Keys_init_syzygy_list:
  "Keys (set (init_syzygy_list bs)) =
      map_component (\<lambda>k. k + length bs) ` Keys (set bs) \<union> (\<lambda>i. term_of_pair (0, i)) ` {0..<length bs}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Keys (set (init_syzygy_list bs)) = map_component (\<lambda>k. k + length bs) ` Keys (set bs) \<union> (\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs}
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Keys (set (init_syzygy_list bs)) = map_component (\<lambda>k. k + length bs) ` Keys (set bs) \<union> (\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs}
[PROOF STEP]
have eq1: "(\<Union>b\<in>set bs. map_component (\<lambda>k. k + length bs) ` keys b) =
              (\<Union>i\<in>{0..<length bs}. map_component (\<lambda>k. k + length bs) ` keys (bs ! i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>b\<in>set bs. map_component (\<lambda>k. k + length bs) ` keys b) = (\<Union>i\<in>{0..<length bs}. map_component (\<lambda>k. k + length bs) ` keys (bs ! i))
[PROOF STEP]
by (fact UN_upt[symmetric])
[PROOF STATE]
proof (state)
this:
(\<Union>b\<in>set bs. map_component (\<lambda>k. k + length bs) ` keys b) = (\<Union>i\<in>{0..<length bs}. map_component (\<lambda>k. k + length bs) ` keys (bs ! i))

goal (1 subgoal):
 1. Keys (set (init_syzygy_list bs)) = map_component (\<lambda>k. k + length bs) ` Keys (set bs) \<union> (\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs}
[PROOF STEP]
have eq2: "(\<lambda>i. term_of_pair (0, i)) ` {0..<length bs} = (\<Union>i\<in>{0..<length bs}. {term_of_pair (0, i)})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs} = (\<Union>i\<in>{0..<length bs}. {term_of_pair (0::'a, i)})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs} = (\<Union>i\<in>{0..<length bs}. {term_of_pair (0::'a, i)})

goal (1 subgoal):
 1. Keys (set (init_syzygy_list bs)) = map_component (\<lambda>k. k + length bs) ` Keys (set bs) \<union> (\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Keys (set (init_syzygy_list bs)) = map_component (\<lambda>k. k + length bs) ` Keys (set bs) \<union> (\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs}
[PROOF STEP]
by (simp add: init_syzygy_list_def set_map_idx Keys_def keys_lift_poly_syz image_UN
        eq1 eq2 UN_Un_distrib[symmetric])
[PROOF STATE]
proof (state)
this:
Keys (set (init_syzygy_list bs)) = map_component (\<lambda>k. k + length bs) ` Keys (set bs) \<union> (\<lambda>i. term_of_pair (0::'a, i)) ` {0..<length bs}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mat_t_mult_sm [simp]:
  shows "mat_transpose (k *\<^sub>s\<^sub>m A) = k *\<^sub>s\<^sub>m (mat_transpose A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat_transpose (k *\<^sub>s\<^sub>m A) = k *\<^sub>s\<^sub>m mat_transpose A
[PROOF STEP]
by (cases A) simp


[STATEMENT]
lemma lookup_size[termination_simp]:
  fixes t :: "('a::linorder * 'a trie_map) rbt"
  shows "lookup t a = Some b \<Longrightarrow> size b < Suc (size_tree (\<lambda>ab. Suc(Suc (size (snd(fst ab))))) t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lookup t a = Some b \<Longrightarrow> size b < Suc (size_tree (\<lambda>ab. Suc (Suc (size (snd (fst ab))))) t)
[PROOF STEP]
apply(induction t a rule: lookup.induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. lookup \<langle>\<rangle> x = Some b \<Longrightarrow> size b < Suc (size_tree (\<lambda>ab. Suc (Suc (size (snd (fst ab))))) \<langle>\<rangle>)
 2. \<And>l a ba uu_ r x. \<lbrakk>\<lbrakk>cmp x a = LT; lookup l x = Some b\<rbrakk> \<Longrightarrow> size b < Suc (size_tree (\<lambda>ab. Suc (Suc (size (snd (fst ab))))) l); \<lbrakk>cmp x a = GT; lookup r x = Some b\<rbrakk> \<Longrightarrow> size b < Suc (size_tree (\<lambda>ab. Suc (Suc (size (snd (fst ab))))) r); lookup \<langle>l, ((a, ba), uu_), r\<rangle> x = Some b\<rbrakk> \<Longrightarrow> size b < Suc (size_tree (\<lambda>ab. Suc (Suc (size (snd (fst ab))))) \<langle>l, ((a, ba), uu_), r\<rangle>)
[PROOF STEP]
apply(auto split: if_splits)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma reals_complete: "\<exists>X. X \<in> S \<Longrightarrow> \<exists>Y. isUb (UNIV::real set) S Y \<Longrightarrow> \<exists>t. isLub (UNIV :: real set) S t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<exists>X. X \<in> S; \<exists>Y. isUb UNIV S Y\<rbrakk> \<Longrightarrow> \<exists>t. isLub UNIV S t
[PROOF STEP]
by (intro exI[of _ "Sup S"] isLub_cSup) (auto simp: setle_def isUb_def intro!: cSup_upper)


[STATEMENT]
lemma (in Gromov_hyperbolic_space_geodesic) proj_along_geodesic_contraction':
  assumes "geodesic_segment G" "px \<in> proj_set x G" "py \<in> proj_set y G"
  shows "dist px py \<le> dist x y + 4 * deltaG(TYPE('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist px py \<le> dist x y + 4 * deltaG TYPE('a)
[PROOF STEP]
using proj_along_quasiconvex_contraction'[OF quasiconvex_of_geodesic[OF assms(1)] assms(2) assms(3)]
[PROOF STATE]
proof (prove)
using this:
dist px py \<le> dist x y + 4 * deltaG TYPE('a) + 2 * 0

goal (1 subgoal):
 1. dist px py \<le> dist x y + 4 * deltaG TYPE('a)
[PROOF STEP]
by auto


[STATEMENT]
lemma (in is_ntcf) is_ntcf_op'[cat_op_intros]:
  assumes "\<GG>' = op_cf \<GG>"
    and "\<FF>' = op_cf \<FF>"
    and "\<AA>' = op_cat \<AA>"
    and "\<BB>' = op_cat \<BB>"
  shows "op_ntcf \<NN> : \<GG>' \<mapsto>\<^sub>C\<^sub>F \<FF>' : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_ntcf \<NN> : \<GG>' \<mapsto>\<^sub>C\<^sub>F \<FF>' : \<AA>' \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<BB>'
[PROOF STEP]
unfolding assms
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. op_ntcf \<NN> : op_cf \<GG> \<mapsto>\<^sub>C\<^sub>F op_cf \<FF> : op_cat \<AA> \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> op_cat \<BB>
[PROOF STEP]
by (rule is_ntcf_op)


[STATEMENT]
lemma (in CRR_market) delta_hedging_cls_val_process:
  shows "cls_val_process Mkt (delta_hedging N der matur) (Suc n) w =
    geom_proc (Suc n) w * delta_price N der matur n w +
    (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
define X where "X = delta_hedging N der matur"
[PROOF STATE]
proof (state)
this:
X = delta_hedging N der matur

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
define init where "init = integral\<^sup>L N (discounted_value r (\<lambda>m. der) matur)"
[PROOF STATE]
proof (state)
this:
init = integral\<^sup>L N (discounted_value r (\<lambda>m. der) matur)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
have "cls_val_process Mkt X (Suc n) w = cls_val_process Mkt (delta_pf N der matur) (Suc n) w +
    (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cls_val_process Mkt X (Suc n) w = cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)
[PROOF STEP]
unfolding X_def delta_hedging_def self_fin_delta_pf_def init_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cls_val_process Mkt (self_finance Mkt (integral\<^sup>L N (discounted_value r (\<lambda>m. der) matur)) (delta_pf N der matur) risk_free_asset) (Suc n) w = cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt (self_finance Mkt (integral\<^sup>L N (discounted_value r (\<lambda>m. der) matur)) (delta_pf N der matur) risk_free_asset) n w - val_process Mkt (delta_pf N der matur) n w)
[PROOF STEP]
proof (rule self_finance_risk_free_update_ind)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. portfolio (delta_pf N der matur)
[PROOF STEP]
show "portfolio (delta_pf N der matur)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. portfolio (delta_pf N der matur)
[PROOF STEP]
unfolding  portfolio_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (support_set (delta_pf N der matur))
[PROOF STEP]
using delta_pf_support
[PROOF STATE]
proof (prove)
using this:
support_set (delta_pf ?N ?der ?matur) \<subseteq> {stk}

goal (1 subgoal):
 1. finite (support_set (delta_pf N der matur))
[PROOF STEP]
by (meson finite.simps infinite_super)
[PROOF STATE]
proof (state)
this:
portfolio (delta_pf N der matur)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt X (Suc n) w = cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt X (Suc n) w = cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
have "... = geom_proc (Suc n) w * delta_price N der matur n w +
    (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w) = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)
[PROOF STEP]
using delta_pf_updated
[PROOF STATE]
proof (prove)
using this:
cls_val_process Mkt (delta_pf ?N ?der ?matur) (Suc ?n) ?w = geom_proc (Suc ?n) ?w * delta_price ?N ?der ?matur ?n ?w

goal (1 subgoal):
 1. cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w) = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w) = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt (delta_pf N der matur) (Suc n) w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w) = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
have "... = geom_proc (Suc n) w * delta_price N der matur n w +
    (1 + r) * (val_process Mkt X n w - geom_proc n w * delta_price N der matur n w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w) = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
using delta_pf_val_process
[PROOF STATE]
proof (prove)
using this:
val_process Mkt (delta_pf ?N ?der ?matur) ?n ?w = geom_proc ?n ?w * delta_price ?N ?der ?matur ?n ?w

goal (1 subgoal):
 1. geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w) = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - val_process Mkt (delta_pf N der matur) n w) = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - geom_proc n w * delta_price N der matur n w)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cls_val_process Mkt X (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cls_val_process Mkt X (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt X n w - geom_proc n w * delta_price N der matur n w)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
unfolding X_def
[PROOF STATE]
proof (prove)
using this:
cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)

goal (1 subgoal):
 1. cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cls_val_process Mkt (delta_hedging N der matur) (Suc n) w = geom_proc (Suc n) w * delta_price N der matur n w + (1 + r) * (val_process Mkt (delta_hedging N der matur) n w - geom_proc n w * delta_price N der matur n w)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ex_distrib_star: "(\<exists>\<^sub>Ax. P x * Q) = (\<exists>\<^sub>Ax. P x) * Q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>\<^sub>Ax. P x * Q) = (\<exists>\<^sub>Ax. P x) * Q
[PROOF STEP]
unfolding ex_assn_def times_assn_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Abs_assn (\<lambda>h. \<exists>x. h \<Turnstile> Abs_assn (times_assn_raw (Rep_assn (P x)) (Rep_assn Q))) = Abs_assn (times_assn_raw (Rep_assn (Abs_assn (\<lambda>h. \<exists>x. h \<Turnstile> P x))) (Rep_assn Q))
[PROOF STEP]
apply rule
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>h. times_assn_raw (Rep_assn (Abs_assn (\<lambda>h. \<exists>x. h \<Turnstile> P x))) (Rep_assn Q) h = (h \<Turnstile> Abs_assn (\<lambda>h. \<exists>x. h \<Turnstile> Abs_assn (times_assn_raw (Rep_assn (P x)) (Rep_assn Q))))
[PROOF STEP]
apply (simp add: Abs_assn_inverse)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>h. times_assn_raw (\<lambda>h. \<exists>x. h \<Turnstile> P x) (Rep_assn Q) h = (\<exists>x. times_assn_raw (Rep_assn (P x)) (Rep_assn Q) h)
[PROOF STEP]
apply fastforce
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma min_height_size_log:
  "min_height kdt \<le> log 2 (size_kdt kdt)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real (min_height kdt) \<le> log 2 (real (KD_Tree.size_kdt kdt))
[PROOF STEP]
by (simp add: le_log2_of_power min_height_size)


[STATEMENT]
lemma aadd_two_pos:"\<lbrakk>0 \<le> (x::ant); 0 \<le> y\<rbrakk> \<Longrightarrow> 0 \<le> x + y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> x; 0 \<le> y\<rbrakk> \<Longrightarrow> 0 \<le> x + y
[PROOF STEP]
apply (cut_tac Zero_in_aug_inf,
       cut_tac pos_in_aug_inf[of "x"],
       cut_tac pos_in_aug_inf[of "y"])
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>0 \<le> x; 0 \<le> y; 0 \<in> Z\<^sub>\<infinity>; x \<in> Z\<^sub>\<infinity>; y \<in> Z\<^sub>\<infinity>\<rbrakk> \<Longrightarrow> 0 \<le> x + y
 2. \<lbrakk>0 \<le> x; 0 \<le> y; 0 \<in> Z\<^sub>\<infinity>; x \<in> Z\<^sub>\<infinity>\<rbrakk> \<Longrightarrow> 0 \<le> y
 3. \<lbrakk>0 \<le> x; 0 \<le> y; 0 \<in> Z\<^sub>\<infinity>\<rbrakk> \<Longrightarrow> 0 \<le> x
[PROOF STEP]
apply (cut_tac aadd_le_mono[of "0" "x" "y"], simp add:aadd_0_l,
       assumption+)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ttree_join_is_either:
   "t \<squnion> t' = t \<oplus>\<oplus> t'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<squnion> t' = t \<oplus>\<oplus> t'
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. t \<squnion> t' = t \<oplus>\<oplus> t'
[PROOF STEP]
have "t \<oplus>\<oplus> t' = Either {t, t'}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<oplus>\<oplus> t' = Either {t, t'}
[PROOF STEP]
by transfer auto
[PROOF STATE]
proof (state)
this:
t \<oplus>\<oplus> t' = Either {t, t'}

goal (1 subgoal):
 1. t \<squnion> t' = t \<oplus>\<oplus> t'
[PROOF STEP]
thus "t \<squnion> t' = t \<oplus>\<oplus> t'"
[PROOF STATE]
proof (prove)
using this:
t \<oplus>\<oplus> t' = Either {t, t'}

goal (1 subgoal):
 1. t \<squnion> t' = t \<oplus>\<oplus> t'
[PROOF STEP]
by (metis lub_is_join is_lub_ttree)
[PROOF STATE]
proof (state)
this:
t \<squnion> t' = t \<oplus>\<oplus> t'

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma projection_in_image[simp]:
  fixes M :: \<open>'a::chilbert_space set\<close>
  assumes \<open>convex M\<close> and \<open>closed M\<close> and \<open>M \<noteq> {}\<close>
  shows \<open>projection M h \<in> M\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. projection M h \<in> M
[PROOF STEP]
by (simp add: assms(1) assms(2) assms(3) is_projection_on_in_image projection_is_projection_on)


[STATEMENT]
lemma Suc_sqrt_power2_gt: "n < (Suc (Discrete.sqrt n))^2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. n < (Suc (local.sqrt n))\<^sup>2
[PROOF STEP]
using Max_ge[OF Discrete.sqrt_aux(1), of "Discrete.sqrt n + 1" n]
[PROOF STATE]
proof (prove)
using this:
local.sqrt n + 1 \<in> {m. m\<^sup>2 \<le> n} \<Longrightarrow> local.sqrt n + 1 \<le> Max {m. m\<^sup>2 \<le> n}

goal (1 subgoal):
 1. n < (Suc (local.sqrt n))\<^sup>2
[PROOF STEP]
by (cases "n < (Suc (Discrete.sqrt n))^2") (simp_all add: Discrete.sqrt_def)


[STATEMENT]
lemma selectlike_equal_cocond_rule: "(\<And>\<mu>. Uvariation \<mu> \<nu> (-V) \<Longrightarrow> (\<mu>\<in>X) = (\<mu>\<in>Y))
  \<Longrightarrow> (selectlike X \<nu> V = selectlike Y \<nu> V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>\<mu>. Uvariation \<mu> \<nu> (- V) \<Longrightarrow> (\<mu> \<in> X) = (\<mu> \<in> Y)) \<Longrightarrow> selectlike X \<nu> V = selectlike Y \<nu> V
[PROOF STEP]
using selectlike_equal_cond[where V=\<open>V\<close>]
[PROOF STATE]
proof (prove)
using this:
(selectlike ?X ?\<nu> V = selectlike ?Y ?\<nu> V) = (\<forall>\<mu>. Uvariation \<mu> ?\<nu> (- V) \<longrightarrow> (\<mu> \<in> ?X) = (\<mu> \<in> ?Y))

goal (1 subgoal):
 1. (\<And>\<mu>. Uvariation \<mu> \<nu> (- V) \<Longrightarrow> (\<mu> \<in> X) = (\<mu> \<in> Y)) \<Longrightarrow> selectlike X \<nu> V = selectlike Y \<nu> V
[PROOF STEP]
by simp


[STATEMENT]
lemma SA_nat_pow':
  assumes "x \<notin> carrier (Q\<^sub>p\<^bsup>n\<^esup>)"
  shows "(f [^]\<^bsub>SA n\<^esub> (k::nat)) x = undefined"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f [^]\<^bsub>SA n\<^esub> k) x = undefined
[PROOF STEP]
apply(induction k)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (f [^]\<^bsub>SA n\<^esub> 0) x = undefined
 2. \<And>k. (f [^]\<^bsub>SA n\<^esub> k) x = undefined \<Longrightarrow> (f [^]\<^bsub>SA n\<^esub> Suc k) x = undefined
[PROOF STEP]
using assms nat_pow_def[of "SA n" f]
[PROOF STATE]
proof (prove)
using this:
x \<notin> carrier (Q\<^sub>p\<^bsup>n\<^esup>)
f [^]\<^bsub>SA n\<^esub> ?n = rec_nat \<one>\<^bsub>SA n\<^esub> (\<lambda>u b. b \<otimes>\<^bsub>SA n\<^esub> f) ?n

goal (2 subgoals):
 1. (f [^]\<^bsub>SA n\<^esub> 0) x = undefined
 2. \<And>k. (f [^]\<^bsub>SA n\<^esub> k) x = undefined \<Longrightarrow> (f [^]\<^bsub>SA n\<^esub> Suc k) x = undefined
[PROOF STEP]
apply (metis (no_types, lifting) Group.nat_pow_0 Qp_funs_one SA_one restrict_apply)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. (f [^]\<^bsub>SA n\<^esub> k) x = undefined \<Longrightarrow> (f [^]\<^bsub>SA n\<^esub> Suc k) x = undefined
[PROOF STEP]
by (metis Group.nat_pow_Suc SA_mult' assms)


[STATEMENT]
lemma (in ring) ideal_prod_zero:
  assumes "ideal I R"
  shows "I \<cdot> { \<zero> } = { \<zero> }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<cdot> {\<zero>} = {\<zero>}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. I \<cdot> {\<zero>} \<subseteq> {\<zero>}
 2. {\<zero>} \<subseteq> I \<cdot> {\<zero>}
[PROOF STEP]
show "I \<cdot> { \<zero> } \<subseteq> { \<zero> }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<cdot> {\<zero>} \<subseteq> {\<zero>}
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> I \<cdot> {\<zero>} \<Longrightarrow> x \<in> {\<zero>}
[PROOF STEP]
fix s
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> I \<cdot> {\<zero>} \<Longrightarrow> x \<in> {\<zero>}
[PROOF STEP]
assume "s \<in> I \<cdot> {\<zero>}"
[PROOF STATE]
proof (state)
this:
s \<in> I \<cdot> {\<zero>}

goal (1 subgoal):
 1. \<And>x. x \<in> I \<cdot> {\<zero>} \<Longrightarrow> x \<in> {\<zero>}
[PROOF STEP]
thus "s \<in> { \<zero> }"
[PROOF STATE]
proof (prove)
using this:
s \<in> I \<cdot> {\<zero>}

goal (1 subgoal):
 1. s \<in> {\<zero>}
[PROOF STEP]
using assms ideal.Icarr
[PROOF STATE]
proof (prove)
using this:
s \<in> I \<cdot> {\<zero>}
ideal I R
\<lbrakk>ideal ?I ?R; ?i \<in> ?I\<rbrakk> \<Longrightarrow> ?i \<in> carrier ?R

goal (1 subgoal):
 1. s \<in> {\<zero>}
[PROOF STEP]
by (induct s rule: ideal_prod.induct) (fastforce, simp)
[PROOF STATE]
proof (state)
this:
s \<in> {\<zero>}

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
I \<cdot> {\<zero>} \<subseteq> {\<zero>}

goal (1 subgoal):
 1. {\<zero>} \<subseteq> I \<cdot> {\<zero>}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. {\<zero>} \<subseteq> I \<cdot> {\<zero>}
[PROOF STEP]
show "{ \<zero> } \<subseteq> I \<cdot> { \<zero> }"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {\<zero>} \<subseteq> I \<cdot> {\<zero>}
[PROOF STEP]
by (simp add: additive_subgroup.zero_closed assms
                  ideal.axioms(1) ideal_prod_is_ideal zeroideal)
[PROOF STATE]
proof (state)
this:
{\<zero>} \<subseteq> I \<cdot> {\<zero>}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma measurable_translation:
   "S \<in> lmeasurable \<Longrightarrow> ((+) a ` S) \<in> lmeasurable"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<in> lmeasurable \<Longrightarrow> (+) a ` S \<in> lmeasurable
[PROOF STEP]
using emeasure_lebesgue_affine [of 1 a S]
[PROOF STATE]
proof (prove)
using this:
emeasure lebesgue ((\<lambda>x. 1 *\<^sub>R x + a) ` S) = ennreal (\<bar>1\<bar> ^ DIM('a)) * emeasure lebesgue S

goal (1 subgoal):
 1. S \<in> lmeasurable \<Longrightarrow> (+) a ` S \<in> lmeasurable
[PROOF STEP]
apply (auto intro: lebesgue_sets_translation simp add: fmeasurable_def cong: image_cong_simp)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>emeasure lebesgue ((\<lambda>x. x + a) ` S) = emeasure lborel (main_part lborel S); S \<in> sets lebesgue; emeasure lborel (main_part lborel S) < top\<rbrakk> \<Longrightarrow> emeasure lebesgue ((+) a ` S) < top
[PROOF STEP]
apply (simp add: ac_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma param_case_list':
  "\<lbrakk> (l,l')\<in>\<langle>Rb\<rangle>list_rel;
     \<lbrakk>l=[]; l'=[]\<rbrakk> \<Longrightarrow> (n,n')\<in>Ra;
     \<And>x xs x' xs'. \<lbrakk> l=x#xs; l'=x'#xs'; (x,x')\<in>Rb; (xs,xs')\<in>\<langle>Rb\<rangle>list_rel \<rbrakk>
     \<Longrightarrow> (c x xs, c' x' xs')\<in>Ra
   \<rbrakk> \<Longrightarrow> (case_list n c l, case_list n' c' l') \<in> Ra"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(l, l') \<in> \<langle>Rb\<rangle>list_rel; \<lbrakk>l = []; l' = []\<rbrakk> \<Longrightarrow> (n, n') \<in> Ra; \<And>x xs x' xs'. \<lbrakk>l = x # xs; l' = x' # xs'; (x, x') \<in> Rb; (xs, xs') \<in> \<langle>Rb\<rangle>list_rel\<rbrakk> \<Longrightarrow> (c x xs, c' x' xs') \<in> Ra\<rbrakk> \<Longrightarrow> (case l of [] \<Rightarrow> n | x # xa \<Rightarrow> c x xa, case l' of [] \<Rightarrow> n' | x # xa \<Rightarrow> c' x xa) \<in> Ra
[PROOF STEP]
by (auto split: list.split)


[STATEMENT]
lemma mult_root_eq_root2:
  "n>0 \<Longrightarrow> y \<ge> 0 \<Longrightarrow> y * root n x = root n ((y ^ n) * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; 0 \<le> y\<rbrakk> \<Longrightarrow> y * root n x = root n (y ^ n * x)
[PROOF STEP]
by(simp add: real_root_mult real_root_pos2)


[STATEMENT]
lemma measurable_pair_measure_countable1:
  assumes "countable A"
  and [measurable]: "\<And>x. x \<in> A \<Longrightarrow> (\<lambda>y. f (x, y)) \<in> measurable N K"
  shows "f \<in> measurable (count_space A \<Otimes>\<^sub>M N) K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<in> count_space A \<Otimes>\<^sub>M N \<rightarrow>\<^sub>M K
[PROOF STEP]
using _ _ assms(1)
[PROOF STATE]
proof (prove)
using this:
PROP ?psi \<Longrightarrow> PROP ?psi
PROP ?psi \<Longrightarrow> PROP ?psi
countable A

goal (1 subgoal):
 1. f \<in> count_space A \<Otimes>\<^sub>M N \<rightarrow>\<^sub>M K
[PROOF STEP]
by(rule measurable_compose_countable'[where f="\<lambda>a b. f (a, snd b)" and g=fst and I=A, simplified])simp_all


[STATEMENT]
lemma P_ring_ldistr:
  assumes "carrier_coeff a"
  assumes "carrier_coeff b"
  assumes "carrier_coeff c"
  shows "  (b \<Oplus> c) \<Otimes>\<^sub>p  a = (b \<Otimes>\<^sub>p a)\<Oplus> (c \<Otimes>\<^sub>p a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. b \<Oplus> c \<Otimes>\<^sub>p a = b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (b \<Oplus> c \<Otimes>\<^sub>p a) x = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) x
[PROOF STEP]
fix m
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (b \<Oplus> c \<Otimes>\<^sub>p a) x = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) x
[PROOF STEP]
show "((b \<Oplus> c) \<Otimes>\<^sub>p  a) m = ((b \<Otimes>\<^sub>p a)\<Oplus> (c \<Otimes>\<^sub>p a)) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m
[PROOF STEP]
have RHS: "((b \<Otimes>\<^sub>p a)\<Oplus> (c \<Otimes>\<^sub>p a)) m =
                  (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x)) \<oplus> (\<Oplus>x\<in>mset_factors m. c x \<otimes> a (m - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x)) \<oplus> (\<Oplus>x\<in>mset_factors m. c x \<otimes> a (m - x))
[PROOF STEP]
unfolding indexed_padd_def P_ring_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x)) \<oplus> (\<Oplus>x\<in>mset_factors m. c x \<otimes> a (m - x)) = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x)) \<oplus> (\<Oplus>x\<in>mset_factors m. c x \<otimes> a (m - x))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x)) \<oplus> (\<Oplus>x\<in>mset_factors m. c x \<otimes> a (m - x))

goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m
[PROOF STEP]
have LHS: "((b \<Oplus> c) \<Otimes>\<^sub>p  a)  m=
                  ( \<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
unfolding indexed_padd_def  P_ring_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. (b x \<oplus> c x) \<otimes> a (m - x)) = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
by (meson assms(1) assms(2) assms(3) l_distr local.ring_axioms ring.carrier_coeff_def)
[PROOF STATE]
proof (state)
this:
(b \<Oplus> c \<Otimes>\<^sub>p a) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))

goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m
[PROOF STEP]
have RHS': "((b \<Otimes>\<^sub>p a)\<Oplus> (c \<Otimes>\<^sub>p a)) m =
                  (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
have 0: "(\<lambda>x. b x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. b x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> b x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> b x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
assume "x \<in> mset_factors m"
[PROOF STATE]
proof (state)
this:
x \<in> mset_factors m

goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> b x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> mset_factors m
[PROOF STEP]
show "b x \<otimes> a (m - x) \<in> carrier R"
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m

goal (1 subgoal):
 1. b x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
using assms carrier_coeffE
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m
carrier_coeff a
carrier_coeff b
carrier_coeff c
carrier_coeff ?P \<Longrightarrow> ?P ?m \<in> carrier R

goal (1 subgoal):
 1. b x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
b x \<otimes> a (m - x) \<in> carrier R

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. b x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R

goal (1 subgoal):
 1. (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
have 1: "(\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> c x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> c x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
assume "x \<in> mset_factors m"
[PROOF STATE]
proof (state)
this:
x \<in> mset_factors m

goal (1 subgoal):
 1. \<And>x. x \<in> mset_factors m \<Longrightarrow> c x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x \<in> mset_factors m
[PROOF STEP]
show "c x \<otimes> a (m - x) \<in> carrier R"
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m

goal (1 subgoal):
 1. c x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
using assms carrier_coeffE
[PROOF STATE]
proof (prove)
using this:
x \<in> mset_factors m
carrier_coeff a
carrier_coeff b
carrier_coeff c
carrier_coeff ?P \<Longrightarrow> ?P ?m \<in> carrier R

goal (1 subgoal):
 1. c x \<otimes> a (m - x) \<in> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
c x \<otimes> a (m - x) \<in> carrier R

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R

goal (1 subgoal):
 1. (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R

goal (1 subgoal):
 1. (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
using 0 1 RHS assms finsum_addf[of "\<lambda>x. b x \<otimes> a (m - x)" "mset_factors m"
                                                    "\<lambda>x. c x \<otimes> a (m - x)"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R
(\<lambda>x. b x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R
(\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R
(b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x)) \<oplus> (\<Oplus>x\<in>mset_factors m. c x \<otimes> a (m - x))
carrier_coeff a
carrier_coeff b
carrier_coeff c
\<lbrakk>(\<lambda>x. b x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R; (\<lambda>x. c x \<otimes> a (m - x)) \<in> mset_factors m \<rightarrow> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x)) = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x)) \<oplus> (\<Oplus>x\<in>mset_factors m. c x \<otimes> a (m - x))

goal (1 subgoal):
 1. (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
(b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))

goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m
[PROOF STEP]
using LHS RHS'
[PROOF STATE]
proof (prove)
using this:
(b \<Oplus> c \<Otimes>\<^sub>p a) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))
(b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m = (\<Oplus>x\<in>mset_factors m. b x \<otimes> a (m - x) \<oplus> c x \<otimes> a (m - x))

goal (1 subgoal):
 1. (b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(b \<Oplus> c \<Otimes>\<^sub>p a) m = (b \<Otimes>\<^sub>p a \<Oplus> (c \<Otimes>\<^sub>p a)) m

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Im3_tendsto_upperbound:
   "\<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im3 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im3 limit \<le> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f \<longlongrightarrow> limit) net; \<forall>\<^sub>F x in net. Im3 (f x) \<le> b; net \<noteq> bot\<rbrakk> \<Longrightarrow> Im3 limit \<le> b
[PROOF STEP]
by (blast intro: tendsto_upperbound [OF tendsto_Im3])


[STATEMENT]
lemma compact_eq_openin_cover:
  "compact S \<longleftrightarrow>
    (\<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow>
      (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact S = (\<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C. \<lbrakk>compact S; \<forall>c\<in>C. openin (top_of_set S) c; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
 2. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
fix C
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>C. \<lbrakk>compact S; \<forall>c\<in>C. openin (top_of_set S) c; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
 2. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
assume "compact S" and "\<forall>c\<in>C. openin (top_of_set S) c" and "S \<subseteq> \<Union>C"
[PROOF STATE]
proof (state)
this:
compact S
\<forall>c\<in>C. openin (top_of_set S) c
S \<subseteq> \<Union> C

goal (2 subgoals):
 1. \<And>C. \<lbrakk>compact S; \<forall>c\<in>C. openin (top_of_set S) c; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
 2. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
compact S
\<forall>c\<in>C. openin (top_of_set S) c
S \<subseteq> \<Union> C
[PROOF STEP]
have "\<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c" and "S \<subseteq> \<Union>{T. open T \<and> S \<inter> T \<in> C}"
[PROOF STATE]
proof (prove)
using this:
compact S
\<forall>c\<in>C. openin (top_of_set S) c
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. \<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c &&& S \<subseteq> \<Union> {T. open T \<and> S \<inter> T \<in> C}
[PROOF STEP]
unfolding openin_open
[PROOF STATE]
proof (prove)
using this:
compact S
\<forall>c\<in>C. \<exists>T. open T \<and> c = S \<inter> T
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. \<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c &&& S \<subseteq> \<Union> {T. open T \<and> S \<inter> T \<in> C}
[PROOF STEP]
by force+
[PROOF STATE]
proof (state)
this:
\<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c
S \<subseteq> \<Union> {T. open T \<and> S \<inter> T \<in> C}

goal (2 subgoals):
 1. \<And>C. \<lbrakk>compact S; \<forall>c\<in>C. openin (top_of_set S) c; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
 2. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
with \<open>compact S\<close>
[PROOF STATE]
proof (chain)
picking this:
compact S
\<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c
S \<subseteq> \<Union> {T. open T \<and> S \<inter> T \<in> C}
[PROOF STEP]
obtain D where "D \<subseteq> {T. open T \<and> S \<inter> T \<in> C}" and "finite D" and "S \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
compact S
\<forall>c\<in>{T. open T \<and> S \<inter> T \<in> C}. open c
S \<subseteq> \<Union> {T. open T \<and> S \<inter> T \<in> C}

goal (1 subgoal):
 1. (\<And>D. \<lbrakk>D \<subseteq> {T. open T \<and> S \<inter> T \<in> C}; finite D; S \<subseteq> \<Union> D\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (meson compactE)
[PROOF STATE]
proof (state)
this:
D \<subseteq> {T. open T \<and> S \<inter> T \<in> C}
finite D
S \<subseteq> \<Union> D

goal (2 subgoals):
 1. \<And>C. \<lbrakk>compact S; \<forall>c\<in>C. openin (top_of_set S) c; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
 2. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
D \<subseteq> {T. open T \<and> S \<inter> T \<in> C}
finite D
S \<subseteq> \<Union> D
[PROOF STEP]
have "image (\<lambda>T. S \<inter> T) D \<subseteq> C \<and> finite (image (\<lambda>T. S \<inter> T) D) \<and> S \<subseteq> \<Union>(image (\<lambda>T. S \<inter> T) D)"
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> {T. open T \<and> S \<inter> T \<in> C}
finite D
S \<subseteq> \<Union> D

goal (1 subgoal):
 1. (\<inter>) S ` D \<subseteq> C \<and> finite ((\<inter>) S ` D) \<and> S \<subseteq> \<Union> ((\<inter>) S ` D)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<inter>) S ` D \<subseteq> C \<and> finite ((\<inter>) S ` D) \<and> S \<subseteq> \<Union> ((\<inter>) S ` D)

goal (2 subgoals):
 1. \<And>C. \<lbrakk>compact S; \<forall>c\<in>C. openin (top_of_set S) c; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
 2. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<inter>) S ` D \<subseteq> C \<and> finite ((\<inter>) S ` D) \<and> S \<subseteq> \<Union> ((\<inter>) S ` D)
[PROOF STEP]
show "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
(\<inter>) S ` D \<subseteq> C \<and> finite ((\<inter>) S ` D) \<and> S \<subseteq> \<Union> ((\<inter>) S ` D)

goal (1 subgoal):
 1. \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
assume 1: "\<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union>C \<longrightarrow>
        (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D)"
[PROOF STATE]
proof (state)
this:
\<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D)

goal (1 subgoal):
 1. \<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D) \<Longrightarrow> compact S
[PROOF STEP]
show "compact S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compact S
[PROOF STEP]
proof (rule compactI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
fix C
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
let ?C = "image (\<lambda>T. S \<inter> T) C"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
assume "\<forall>t\<in>C. open t" and "S \<subseteq> \<Union>C"
[PROOF STATE]
proof (state)
this:
\<forall>t\<in>C. open t
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>t\<in>C. open t
S \<subseteq> \<Union> C
[PROOF STEP]
have "(\<forall>c\<in>?C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union>?C"
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>C. open t
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. (\<forall>c\<in>(\<inter>) S ` C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> ((\<inter>) S ` C)
[PROOF STEP]
unfolding openin_open
[PROOF STATE]
proof (prove)
using this:
\<forall>t\<in>C. open t
S \<subseteq> \<Union> C

goal (1 subgoal):
 1. (\<forall>c\<in>(\<inter>) S ` C. \<exists>T. open T \<and> c = S \<inter> T) \<and> S \<subseteq> \<Union> ((\<inter>) S ` C)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<forall>c\<in>(\<inter>) S ` C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> ((\<inter>) S ` C)

goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
with 1
[PROOF STATE]
proof (chain)
picking this:
\<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D)
(\<forall>c\<in>(\<inter>) S ` C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> ((\<inter>) S ` C)
[PROOF STEP]
obtain D where "D \<subseteq> ?C" and "finite D" and "S \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
\<forall>C. (\<forall>c\<in>C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D)
(\<forall>c\<in>(\<inter>) S ` C. openin (top_of_set S) c) \<and> S \<subseteq> \<Union> ((\<inter>) S ` C)

goal (1 subgoal):
 1. (\<And>D. \<lbrakk>D \<subseteq> (\<inter>) S ` C; finite D; S \<subseteq> \<Union> D\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
D \<subseteq> (\<inter>) S ` C
finite D
S \<subseteq> \<Union> D

goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
let ?D = "inv_into C (\<lambda>T. S \<inter> T) ` D"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
have "?D \<subseteq> C \<and> finite ?D \<and> S \<subseteq> \<Union>?D"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inv_into C ((\<inter>) S) ` D \<subseteq> C \<and> finite (inv_into C ((\<inter>) S) ` D) \<and> S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
proof (intro conjI)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. inv_into C ((\<inter>) S) ` D \<subseteq> C
 2. finite (inv_into C ((\<inter>) S) ` D)
 3. S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
from \<open>D \<subseteq> ?C\<close>
[PROOF STATE]
proof (chain)
picking this:
D \<subseteq> (\<inter>) S ` C
[PROOF STEP]
show "?D \<subseteq> C"
[PROOF STATE]
proof (prove)
using this:
D \<subseteq> (\<inter>) S ` C

goal (1 subgoal):
 1. inv_into C ((\<inter>) S) ` D \<subseteq> C
[PROOF STEP]
by (fast intro: inv_into_into)
[PROOF STATE]
proof (state)
this:
inv_into C ((\<inter>) S) ` D \<subseteq> C

goal (2 subgoals):
 1. finite (inv_into C ((\<inter>) S) ` D)
 2. S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
from \<open>finite D\<close>
[PROOF STATE]
proof (chain)
picking this:
finite D
[PROOF STEP]
show "finite ?D"
[PROOF STATE]
proof (prove)
using this:
finite D

goal (1 subgoal):
 1. finite (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
by (rule finite_imageI)
[PROOF STATE]
proof (state)
this:
finite (inv_into C ((\<inter>) S) ` D)

goal (1 subgoal):
 1. S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
from \<open>S \<subseteq> \<Union>D\<close>
[PROOF STATE]
proof (chain)
picking this:
S \<subseteq> \<Union> D
[PROOF STEP]
show "S \<subseteq> \<Union>?D"
[PROOF STATE]
proof (prove)
using this:
S \<subseteq> \<Union> D

goal (1 subgoal):
 1. S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
apply (rule subset_trans)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Union> D \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
by (metis Int_Union Int_lower2 \<open>D \<subseteq> (\<inter>) S ` C\<close> image_inv_into_cancel)
[PROOF STATE]
proof (state)
this:
S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
inv_into C ((\<inter>) S) ` D \<subseteq> C \<and> finite (inv_into C ((\<inter>) S) ` D) \<and> S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)

goal (1 subgoal):
 1. \<And>C. \<lbrakk>\<forall>t\<in>C. open t; S \<subseteq> \<Union> C\<rbrakk> \<Longrightarrow> \<exists>C'\<subseteq>C. finite C' \<and> S \<subseteq> \<Union> C'
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
inv_into C ((\<inter>) S) ` D \<subseteq> C \<and> finite (inv_into C ((\<inter>) S) ` D) \<and> S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)
[PROOF STEP]
show "\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D"
[PROOF STATE]
proof (prove)
using this:
inv_into C ((\<inter>) S) ` D \<subseteq> C \<and> finite (inv_into C ((\<inter>) S) ` D) \<and> S \<subseteq> \<Union> (inv_into C ((\<inter>) S) ` D)

goal (1 subgoal):
 1. \<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union> D

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
compact S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cancel_separate_4:
  assumes "z * y \<le> 1"
      and "w \<le> y \<squnion> z"
      and "x \<le> y \<squnion> z"
    shows "w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
have "w\<^sup>\<star> * x\<^sup>\<star> = ((w \<sqinter> y) \<squnion> (w \<sqinter> z))\<^sup>\<star> * ((x \<sqinter> y) \<squnion> (x \<sqinter> z))\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y \<squnion> w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y \<squnion> x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
by (metis assms(2,3) inf.orderE inf_sup_distrib1)
[PROOF STATE]
proof (state)
this:
w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y \<squnion> w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y \<squnion> x \<sqinter> z)\<^sup>\<star>

goal (1 subgoal):
 1. w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y \<squnion> w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y \<squnion> x \<sqinter> z)\<^sup>\<star>

goal (1 subgoal):
 1. w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
have "... = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (w \<sqinter> y \<squnion> w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y \<squnion> x \<sqinter> z)\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
by (metis assms(1) cancel_separate_2 sup_commute mult_assoc)
[PROOF STATE]
proof (state)
this:
(w \<sqinter> y \<squnion> w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y \<squnion> x \<sqinter> z)\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>

goal (1 subgoal):
 1. w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> * (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>

goal (1 subgoal):
 1. w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>
[PROOF STEP]
by (simp add: assms(1) cancel_separate_3)
[PROOF STATE]
proof (state)
this:
w\<^sup>\<star> * x\<^sup>\<star> = (w \<sqinter> y)\<^sup>\<star> * ((w \<sqinter> z)\<^sup>\<star> \<squnion> (x \<sqinter> y)\<^sup>\<star>) * (x \<sqinter> z)\<^sup>\<star>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma List_app: "\<And>x. List h x (as@bs) = (\<exists>y. Path h x as y \<and> List h y bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. List h x (as @ bs) = (\<exists>y. Path h x as y \<and> List h y bs)
[PROOF STEP]
by (induct as) auto


[STATEMENT]
lemma ICp_Suc:
assumes corr_p: "correct p (te p (i+1))"
shows "IC p (i+1) (te p (i+1)) = cfn p (\<theta> p (i+1)) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. IC p (i + 1) (te p (i + 1)) = cfn p (\<theta> p (i + 1))
[PROOF STEP]
using corr_p IClock
[PROOF STATE]
proof (prove)
using this:
correct p (te p (i + 1))
\<forall>p t i. correct p t \<longrightarrow> IC p i t = PC p t + Adj p i

goal (1 subgoal):
 1. IC p (i + 1) (te p (i + 1)) = cfn p (\<theta> p (i + 1))
[PROOF STEP]
by(simp add: Adj_def)


[STATEMENT]
lemma sat_the_restrict: "fv \<phi> \<subseteq> A \<Longrightarrow> MFOTL.sat \<sigma> (map the (restrict A v)) i \<phi> = MFOTL.sat \<sigma> (map the v) i \<phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv \<phi> \<subseteq> A \<Longrightarrow> MFOTL.sat \<sigma> (map the (restrict A v)) i \<phi> = MFOTL.sat \<sigma> (map the v) i \<phi>
[PROOF STEP]
by (rule sat_fvi_cong) (auto intro!: map_the_restrict)


[STATEMENT]
lemma start_of_suc_inc:
  "\<lbrakk>k < length ap; ap ! k = Inc n\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc k) =
                        start_of (layout_of ap) k + 2 * n + 9"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k < length ap; ap ! k = Inc n\<rbrakk> \<Longrightarrow> start_of (layout_of ap) (Suc k) = start_of (layout_of ap) k + 2 * n + 9
[PROOF STEP]
apply(rule_tac start_of_Suc1, auto simp: abc_fetch.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inj_distr:
  assumes "is_inj z"
    shows "(x\<cdot>y);z = (x;z)\<cdot>(y;z)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<cdot> y) ; z = x ; z \<cdot> y ; z
[PROOF STEP]
apply (rule order.antisym)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
 2. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
[PROOF STEP]
using mult_subdistr_var
[PROOF STATE]
proof (prove)
using this:
(?x \<cdot> ?y) ; ?z \<le> ?x ; ?z \<cdot> ?y ; ?z

goal (2 subgoals):
 1. (x \<cdot> y) ; z \<le> x ; z \<cdot> y ; z
 2. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
[PROOF STEP]
using assms conv_iso inj_p_fun p_fun_distl
[PROOF STATE]
proof (prove)
using this:
is_inj z
(?x \<le> ?y) = (?x\<^sup>T \<le> ?y\<^sup>T)
is_inj ?x = is_p_fun (?x\<^sup>T)
is_p_fun ?x \<Longrightarrow> ?x ; (?y \<cdot> ?z) = ?x ; ?y \<cdot> ?x ; ?z

goal (1 subgoal):
 1. x ; z \<cdot> y ; z \<le> (x \<cdot> y) ; z
[PROOF STEP]
by fastforce


[STATEMENT]
lemma
  iFROM_E [elim]:  "x \<in> [n\<dots>] \<Longrightarrow> (n \<le> x \<Longrightarrow> P) \<Longrightarrow> P" and
  iTILL_E [elim]:  "x \<in> [\<dots>n] \<Longrightarrow> (x \<le> n \<Longrightarrow> P) \<Longrightarrow> P" and
  iIN_E [elim]:    "x \<in> [n\<dots>,d] \<Longrightarrow> (n \<le> x \<Longrightarrow> x \<le> n + d \<Longrightarrow> P) \<Longrightarrow> P" and
  iMOD_E [elim]:   "x \<in> [r, mod m] \<Longrightarrow> (x mod m = r mod m \<Longrightarrow> r \<le> x \<Longrightarrow> P) \<Longrightarrow> P" and
  iMODb_E [elim]:   "x \<in> [r, mod m, c] \<Longrightarrow> (x mod m = r mod m \<Longrightarrow> r \<le> x \<Longrightarrow> x \<le> r + m * c \<Longrightarrow> P) \<Longrightarrow> P"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lbrakk>x \<in> [n\<dots>]; n \<le> x \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P) &&& (\<lbrakk>x \<in> [\<dots>n]; x \<le> n \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P)) &&& (\<lbrakk>x \<in> [n\<dots>,d]; \<lbrakk>n \<le> x; x \<le> n + d\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P) &&& (\<lbrakk>x \<in> [ r, mod m ]; \<lbrakk>x mod m = r mod m; r \<le> x\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P) &&& (\<lbrakk>x \<in> [ r, mod m, c ]; \<lbrakk>x mod m = r mod m; r \<le> x; x \<le> r + m * c\<rbrakk> \<Longrightarrow> P\<rbrakk> \<Longrightarrow> P)
[PROOF STEP]
by (simp add: iT_iff)+


[STATEMENT]
lemma is_bounded_hashcodeI[intro]:
  "((eq,(=)) \<in> R \<rightarrow> R \<rightarrow> bool_rel) \<Longrightarrow>
   (\<And>x y n. x \<in> Domain R \<Longrightarrow> y \<in> Domain R \<Longrightarrow> eq x y \<Longrightarrow> bhc n x = bhc n y) \<Longrightarrow>
   (\<And>x n. 1 < n \<Longrightarrow> bhc n x < n) \<Longrightarrow> is_bounded_hashcode R eq bhc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(eq, (=)) \<in> R \<rightarrow> R \<rightarrow> bool_rel; \<And>x y n. \<lbrakk>x \<in> Domain R; y \<in> Domain R; eq x y\<rbrakk> \<Longrightarrow> bhc n x = bhc n y; \<And>x n. 1 < n \<Longrightarrow> bhc n x < n\<rbrakk> \<Longrightarrow> is_bounded_hashcode R eq bhc
[PROOF STEP]
unfolding is_bounded_hashcode_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(eq, (=)) \<in> R \<rightarrow> R \<rightarrow> bool_rel; \<And>x y n. \<lbrakk>x \<in> Domain R; y \<in> Domain R; eq x y\<rbrakk> \<Longrightarrow> bhc n x = bhc n y; \<And>x n. 1 < n \<Longrightarrow> bhc n x < n\<rbrakk> \<Longrightarrow> (eq, (=)) \<in> R \<rightarrow> R \<rightarrow> bool_rel \<and> (\<forall>n. \<forall>x\<in>Domain R. \<forall>y\<in>Domain R. eq x y \<longrightarrow> bhc n x = bhc n y) \<and> (\<forall>n x. 1 < n \<longrightarrow> bhc n x < n)
[PROOF STEP]
by force


[STATEMENT]
lemma timpl_closure_set_mono_timpl_closure_set:
  assumes N: "N \<subseteq> timpl_closure_set M TI"
  shows "timpl_closure_set N TI \<subseteq> timpl_closure_set M TI"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. timpl_closure_set N TI \<subseteq> timpl_closure_set M TI
[PROOF STEP]
using timpl_closure_set_mono[OF N, of TI TI] timpl_closure_set_idem[of M TI]
[PROOF STATE]
proof (prove)
using this:
TI \<subseteq> TI \<Longrightarrow> timpl_closure_set N TI \<subseteq> timpl_closure_set (timpl_closure_set M TI) TI
timpl_closure_set (timpl_closure_set M TI) TI = timpl_closure_set M TI

goal (1 subgoal):
 1. timpl_closure_set N TI \<subseteq> timpl_closure_set M TI
[PROOF STEP]
by simp


[STATEMENT]
lemma exp_Reals_eq:
  assumes "z \<in> \<real>"
  shows   "exp z = of_real (exp (Re z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. exp z = complex_of_real (exp (Re z))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z \<in> \<real>

goal (1 subgoal):
 1. exp z = complex_of_real (exp (Re z))
[PROOF STEP]
by (auto elim!: Reals_cases simp: exp_of_real)


[STATEMENT]
lemma (in is_cf_adjunction) cf_adjunction_counit_NTMap_is_arr':
  assumes "x \<in>\<^sub>\<circ> \<DD>\<lparr>Obj\<rparr>"
    and "a = \<FF>\<lparr>ObjMap\<rparr>\<lparr>\<GG>\<lparr>ObjMap\<rparr>\<lparr>x\<rparr>\<rparr>"
    and "b = x"
    and "\<DD>' = \<DD>"
  shows "\<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> : a \<mapsto>\<^bsub>\<DD>'\<^esub> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> : a \<mapsto>\<^bsub>\<DD>'\<^esub> b
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> \<DD>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> : a \<mapsto>\<^bsub>\<DD>'\<^esub> b
[PROOF STEP]
unfolding assms(2-4)
[PROOF STATE]
proof (prove)
using this:
x \<in>\<^sub>\<circ> \<DD>\<lparr>Obj\<rparr>

goal (1 subgoal):
 1. \<epsilon>\<^sub>C \<Phi>\<lparr>NTMap\<rparr>\<lparr>x\<rparr> : \<FF>\<lparr>ObjMap\<rparr>\<lparr>\<GG>\<lparr>ObjMap\<rparr>\<lparr>x\<rparr>\<rparr> \<mapsto>\<^bsub>\<DD>\<^esub> x
[PROOF STEP]
by (rule cf_adjunction_counit_NTMap_is_arr)


[STATEMENT]
lemma fds_nth_plus [simp]:
  "fds_nth (f + g) = (\<lambda>n. fds_nth f n + fds_nth g n :: 'a :: monoid_add)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fds_nth (f + g) = (\<lambda>n. fds_nth f n + fds_nth g n)
[PROOF STEP]
by (simp add: plus_fds_def fds_nth_fds fun_eq_iff)


[STATEMENT]
lemma Pos_atm_of_iff[simp]: "Pos (atm_of L) = L \<longleftrightarrow> is_pos L"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Pos (atm_of L) = L) = is_pos L
[PROOF STEP]
by (cases L) simp+


[STATEMENT]
lemma total_correctness: "`p\<cdot>x\<cdot>!q = 0` \<longleftrightarrow> `x\<cdot>!q \<le> !p\<cdot>\<top>`"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<iota> p \<cdot> x \<cdot> ! (\<iota> q) = (0::'b)) = (x \<cdot> ! (\<iota> q) \<le> ! (\<iota> p) \<cdot> \<top>)
[PROOF STEP]
apply standard
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<iota> p \<cdot> x \<cdot> ! (\<iota> q) = (0::'b) \<Longrightarrow> x \<cdot> ! (\<iota> q) \<le> ! (\<iota> p) \<cdot> \<top>
 2. x \<cdot> ! (\<iota> q) \<le> ! (\<iota> p) \<cdot> \<top> \<Longrightarrow> \<iota> p \<cdot> x \<cdot> ! (\<iota> q) = (0::'b)
[PROOF STEP]
apply (metis join.bot.extremum mult.assoc test_eq1 top_elim)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> ! (\<iota> q) \<le> ! (\<iota> p) \<cdot> \<top> \<Longrightarrow> \<iota> p \<cdot> x \<cdot> ! (\<iota> q) = (0::'b)
[PROOF STEP]
by (metis (no_types, opaque_lifting) add_zeror annil less_eq_def mult.assoc mult_isol test_comp_mult2)


[STATEMENT]
lemma List_app: "\<And>x. List h x (as@bs) = (\<exists>y. Path h x as y \<and> List h y bs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. List h x (as @ bs) = (\<exists>y. Path h x as y \<and> List h y bs)
[PROOF STEP]
by(induct as, simp, clarsimp)


[STATEMENT]
lemma real_root_decreasing: "0 < n \<Longrightarrow> n \<le> N \<Longrightarrow> 1 \<le> x \<Longrightarrow> root N x \<le> root n x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < n; n \<le> N; 1 \<le> x\<rbrakk> \<Longrightarrow> root N x \<le> root n x
[PROOF STEP]
by (auto simp add: order_le_less real_root_strict_decreasing)


[STATEMENT]
lemma prod_emb_PiE: "J \<subseteq> I \<Longrightarrow> (\<And>i. i \<in> J \<Longrightarrow> E i \<subseteq> space (M i)) \<Longrightarrow>
    prod_emb I M J (\<Pi>\<^sub>E i\<in>J. E i) = (\<Pi>\<^sub>E i\<in>I. if i \<in> J then E i else space (M i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>J \<subseteq> I; \<And>i. i \<in> J \<Longrightarrow> E i \<subseteq> space (M i)\<rbrakk> \<Longrightarrow> prod_emb I M J (Pi\<^sub>E J E) = (\<Pi>\<^sub>E i\<in>I. if i \<in> J then E i else space (M i))
[PROOF STEP]
by (force simp: prod_emb_def PiE_iff if_split_mem2)


[STATEMENT]
lemma contour_integral_sum:
    "\<lbrakk>finite s; \<And>a. a \<in> s \<Longrightarrow> (f a) contour_integrable_on p\<rbrakk>
     \<Longrightarrow> contour_integral p (\<lambda>x. sum (\<lambda>a. f a x) s) = sum (\<lambda>a. contour_integral p (f a)) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite s; \<And>a. a \<in> s \<Longrightarrow> f a contour_integrable_on p\<rbrakk> \<Longrightarrow> contour_integral p (\<lambda>x. \<Sum>a\<in>s. f a x) = (\<Sum>a\<in>s. contour_integral p (f a))
[PROOF STEP]
by (auto simp: contour_integral_unique has_contour_integral_sum has_contour_integral_integral)


[STATEMENT]
lemma bij_perm_swap_iff[simp]: "bij (perm_swap a b f) \<longleftrightarrow> bij f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij (perm_swap a b f) = bij f
[PROOF STEP]
by (simp add: bij_swap_compose bij_swap_iff perm_swap_def)