[STATEMENT]
lemma integrable_alt_subset:
  fixes f :: "'a::euclidean_space \<Rightarrow> 'b::banach"
  shows
     "f integrable_on 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 c d.
                      ball 0 B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d
                      \<longrightarrow> norm(integral (cbox a b) (\<lambda>x. if x \<in> S then f x else 0) -
                               integral (cbox c d) (\<lambda>x. if x \<in> S then f x else 0)) < e)"
      (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
let ?g = "\<lambda>x. if x \<in> S then f x else 0"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
have "f integrable_on S \<longleftrightarrow>
        (\<forall>a b. ?g integrable_on cbox a b) \<and>
        (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
           norm (integral (cbox a b) ?g - integral (cbox c d)  ?g) < e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
by (rule integrable_alt)
[PROOF STATE]
proof (state)
this:
(f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))

goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))

goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
have "\<dots> = ?rhs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
fix e :: "real"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
assume e: "\<And>e. e>0 \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball 0 B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow>
                                   norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e"
        and "e > 0"
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < ?e
0 < e

goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
obtain B where "B > 0"
        and B: "\<And>a b c d. \<lbrakk>ball 0 B \<subseteq> cbox a b; cbox a b \<subseteq> cbox c d\<rbrakk> \<Longrightarrow>
                           norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>a b c d. \<lbrakk>ball (0::'a) B \<subseteq> cbox a b; cbox a b \<subseteq> cbox c d\<rbrakk> \<Longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>e > 0\<close> e [of "e/2"]
[PROOF STATE]
proof (prove)
using this:
0 < e
0 < e / 2 \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2

goal (1 subgoal):
 1. (\<And>B. \<lbrakk>0 < B; \<And>a b c d. \<lbrakk>ball (0::'a) B \<subseteq> cbox a b; cbox a b \<subseteq> cbox c d\<rbrakk> \<Longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
0 < B
\<lbrakk>ball (0::'a) B \<subseteq> cbox ?a ?b; cbox ?a ?b \<subseteq> cbox ?c ?d\<rbrakk> \<Longrightarrow> norm (integral (cbox ?a ?b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox ?c ?d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2

goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
have "\<exists>B>0. \<forall>a b c d.
               ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d \<longrightarrow>
               norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
proof (intro exI allI conjI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?B
 2. \<And>a b c d. ball (0::'a) ?B \<subseteq> cbox a b \<and> ball (0::'a) ?B \<subseteq> cbox c d \<Longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
fix a b c d :: "'a"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?B
 2. \<And>a b c d. ball (0::'a) ?B \<subseteq> cbox a b \<and> ball (0::'a) ?B \<subseteq> cbox c d \<Longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
let ?\<alpha> = "\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?B
 2. \<And>a b c d. ball (0::'a) ?B \<subseteq> cbox a b \<and> ball (0::'a) ?B \<subseteq> cbox c d \<Longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
let ?\<beta> = "\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. 0 < ?B
 2. \<And>a b c d. ball (0::'a) ?B \<subseteq> cbox a b \<and> ball (0::'a) ?B \<subseteq> cbox c d \<Longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
show "norm (integral (cbox a b) ?g - integral (cbox c d) ?g) < e"
          if ball: "ball 0 B \<subseteq> cbox a b \<and> ball 0 B \<subseteq> cbox c d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
have B': "norm (integral (cbox a b \<inter> cbox c d) ?g - integral (cbox x y) ?g) < e/2"
            if "cbox a b \<inter> cbox c d \<subseteq> cbox x y" for x y
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral (cbox a b \<inter> cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox x y) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2
[PROOF STEP]
using B [of ?\<alpha> ?\<beta> x y] ball that
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>ball (0::'a) B \<subseteq> cbox (\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i); cbox (\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i) \<subseteq> cbox x y\<rbrakk> \<Longrightarrow> norm (integral (cbox (\<Sum>i\<in>Basis. max (a \<bullet> i) (c \<bullet> i) *\<^sub>R i) (\<Sum>i\<in>Basis. min (b \<bullet> i) (d \<bullet> i) *\<^sub>R i)) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox x y) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2
ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d
cbox a b \<inter> cbox c d \<subseteq> cbox x y

goal (1 subgoal):
 1. norm (integral (cbox a b \<inter> cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox x y) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2
[PROOF STEP]
by (simp add: Int_interval [symmetric])
[PROOF STATE]
proof (state)
this:
cbox a b \<inter> cbox c d \<subseteq> cbox ?x ?y \<Longrightarrow> norm (integral (cbox a b \<inter> cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox ?x ?y) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2

goal (1 subgoal):
 1. norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
using B' [of a b] B' [of c d] norm_triangle_half_r
[PROOF STATE]
proof (prove)
using this:
cbox a b \<inter> cbox c d \<subseteq> cbox a b \<Longrightarrow> norm (integral (cbox a b \<inter> cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2
cbox a b \<inter> cbox c d \<subseteq> cbox c d \<Longrightarrow> norm (integral (cbox a b \<inter> cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e / 2
\<lbrakk>norm (?y - ?x1.0) < ?e / 2; norm (?y - ?x2.0) < ?e / 2\<rbrakk> \<Longrightarrow> norm (?x1.0 - ?x2.0) < ?e

goal (1 subgoal):
 1. norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<Longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e

goal (1 subgoal):
 1. 0 < B
[PROOF STEP]
qed (use \<open>B > 0\<close> in auto)
[PROOF STATE]
proof (state)
this:
\<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e

goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>\<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e; 0 < ?e2\<rbrakk> \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < ?e2

goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>\<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e; 0 < ?e2\<rbrakk> \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < ?e2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>e. 0 < e \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e; 0 < ?e2\<rbrakk> \<Longrightarrow> \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < ?e2

goal (1 subgoal):
 1. ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < 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::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> ball (0::'a) B \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e)) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))

goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))

goal (1 subgoal):
 1. (f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f integrable_on S) = ((\<forall>a b. (\<lambda>x. if x \<in> S then f x else (0::'b)) integrable_on cbox a b) \<and> (\<forall>e>0. \<exists>B>0. \<forall>a b c d. ball (0::'a) B \<subseteq> cbox a b \<and> cbox a b \<subseteq> cbox c d \<longrightarrow> norm (integral (cbox a b) (\<lambda>x. if x \<in> S then f x else (0::'b)) - integral (cbox c d) (\<lambda>x. if x \<in> S then f x else (0::'b))) < e))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma qbs_prob_ennintegral_indep2:
  assumes "q \<in> monadP_qbs_Px Y"
      and "f \<in> Y \<rightarrow>\<^sub>Q \<real>\<^sub>Q\<^sub>\<ge>\<^sub>0"
    shows "(\<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>(p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q)) = (\<integral>\<^sup>+\<^sub>Q y. f y \<partial>q)"
          (is "?lhs = _")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral q f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral q f
[PROOF STEP]
obtain X \<alpha> \<mu> where hp:
    "p = qbs_prob_space (X, \<alpha>, \<mu>)" "qbs_prob X \<alpha> \<mu>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>X \<alpha> \<mu>. \<lbrakk>p = qbs_prob_space (X, \<alpha>, \<mu>); qbs_prob X \<alpha> \<mu>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using rep_qbs_prob_space[of p]
[PROOF STATE]
proof (prove)
using this:
\<exists>X \<alpha> \<mu>. p = qbs_prob_space (X, \<alpha>, \<mu>) \<and> qbs_prob X \<alpha> \<mu>

goal (1 subgoal):
 1. (\<And>X \<alpha> \<mu>. \<lbrakk>p = qbs_prob_space (X, \<alpha>, \<mu>); qbs_prob X \<alpha> \<mu>\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = qbs_prob_space (X, \<alpha>, \<mu>)
qbs_prob X \<alpha> \<mu>

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral q f
[PROOF STEP]
have "?lhs = (\<integral>\<^sup>+\<^sub>Q x. \<integral>\<^sup>+\<^sub>Q y. f y \<partial>q \<partial>p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q x. qbs_prob_ennintegral q f \<partial>p
[PROOF STEP]
using qbs_prob_ennintegral_Fubini_fst[OF qbs_prob.qbs_prob_space_in_Px[OF hp(2)] assms(1) qbs_morphism_snd''[OF assms(2)]]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+\<^sub>Q x. \<integral>\<^sup>+\<^sub>Q y. f (snd (x, y)) \<partial>q \<partial>qbs_prob_space (X, \<alpha>, \<mu>) = \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>qbs_prob_space (X, \<alpha>, \<mu>) \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q x. qbs_prob_ennintegral q f \<partial>p
[PROOF STEP]
by(simp add: hp(1))
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q x. qbs_prob_ennintegral q f \<partial>p

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral q f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = \<integral>\<^sup>+\<^sub>Q x. qbs_prob_ennintegral q f \<partial>p

goal (1 subgoal):
 1. \<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral q f
[PROOF STEP]
by(simp add: qbs_prob_ennintegral_const)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+\<^sub>Q z. f (snd z) \<partial>p \<Otimes>\<^sub>Q\<^sub>m\<^sub>e\<^sub>s q = qbs_prob_ennintegral q f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "\<bar> exp 1.626 - 5.083499996273 \<bar> < (inverse 10 ^ 10 :: real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>exp (1626 / 10 ^ 3) - 5083499996273 / 10 ^ 12\<bar> < inverse 10 ^ 10
[PROOF STEP]
by (approximation 40)


[STATEMENT]
lemma cat_equalizer_ex_is_iso_arr:
  assumes "\<epsilon> : E <\<^sub>C\<^sub>F\<^sub>.\<^sub>e\<^sub>q (\<aa>,\<bb>,F,F') : \<Up>\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
    and "\<epsilon>' : E' <\<^sub>C\<^sub>F\<^sub>.\<^sub>e\<^sub>q (\<aa>,\<bb>,F,F') : \<Up>\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>"
  obtains f where "f : E' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> E"
    and "\<epsilon>' = \<epsilon> \<bullet>\<^sub>N\<^sub>T\<^sub>C\<^sub>F ntcf_const (\<Up>\<^sub>C (\<aa>\<^sub>P\<^sub>L F) (\<bb>\<^sub>P\<^sub>L F) F) \<CC> f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : E' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> E; \<epsilon>' = \<epsilon> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (\<Up>\<^sub>C (\<aa>\<^sub>P\<^sub>L F) (\<bb>\<^sub>P\<^sub>L F) F) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : E' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> E; \<epsilon>' = \<epsilon> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (\<Up>\<^sub>C (\<aa>\<^sub>P\<^sub>L F) (\<bb>\<^sub>P\<^sub>L F) F) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret \<epsilon>: is_cat_equalizer \<alpha> \<aa> \<bb> F F' \<CC> E \<epsilon>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon> : E <\<^sub>C\<^sub>F\<^sub>.\<^sub>e\<^sub>q (\<aa>,\<bb>,F,F') : \<Up>\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : E' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> E; \<epsilon>' = \<epsilon> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (\<Up>\<^sub>C (\<aa>\<^sub>P\<^sub>L F) (\<bb>\<^sub>P\<^sub>L F) F) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
interpret \<epsilon>': is_cat_equalizer \<alpha> \<aa> \<bb> F F' \<CC> E' \<epsilon>'
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<epsilon>' : E' <\<^sub>C\<^sub>F\<^sub>.\<^sub>e\<^sub>q (\<aa>,\<bb>,F,F') : \<Up>\<^sub>C \<mapsto>\<mapsto>\<^sub>C\<^bsub>\<alpha>\<^esub> \<CC>
[PROOF STEP]
by (rule assms(2))
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>f. \<lbrakk>f : E' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> E; \<epsilon>' = \<epsilon> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (\<Up>\<^sub>C (\<aa>\<^sub>P\<^sub>L F) (\<bb>\<^sub>P\<^sub>L F) F) \<CC> f\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?f : E' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> E; \<epsilon>' = \<epsilon> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (\<Up>\<^sub>C (\<aa>\<^sub>P\<^sub>L F) (\<bb>\<^sub>P\<^sub>L F) F) \<CC> ?f\<rbrakk> \<Longrightarrow> thesis
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?f : E' \<mapsto>\<^sub>i\<^sub>s\<^sub>o\<^bsub>\<CC>\<^esub> E; \<epsilon>' = \<epsilon> \<bullet>\<^sub>N\<^sub>T\<^sub>S\<^sub>M\<^sub>C\<^sub>F ntcf_const (\<Up>\<^sub>C (\<aa>\<^sub>P\<^sub>L F) (\<bb>\<^sub>P\<^sub>L F) F) \<CC> ?f\<rbrakk> \<Longrightarrow> thesis

goal (1 subgoal):
 1. thesis
[PROOF STEP]
by
      (
        elim cat_lim_ex_is_iso_arr[
          OF \<epsilon>.is_cat_limit_axioms \<epsilon>'.is_cat_limit_axioms
          ]
      )
[PROOF STATE]
proof (state)
this:
thesis

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem reduce_system_sign_conditions:
  fixes p:: "real poly"
  fixes qs :: "real poly list"
  fixes subsets :: "nat list list"
  fixes signs :: "rat list list"
  assumes nonzero: "p \<noteq> 0"
  assumes welldefined_signs1: "well_def_signs (length qs) signs"
  assumes distinct_signs: "distinct signs"
  assumes all_info: "set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set(signs)"
  assumes match: "satisfy_equation p qs subsets signs"
  assumes invertible_mat: "invertible_mat (matrix_A signs subsets)"
  shows "set (get_signs (reduce_system p (qs, ((matrix_A signs subsets), (subsets, signs))))) = set (characterize_consistent_signs_at_roots_copr p qs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (get_signs (reduce_system p (qs, M_mat signs subsets, subsets, signs))) = set (characterize_consistent_signs_at_roots_copr p qs)
[PROOF STEP]
unfolding get_signs_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (snd (snd (reduce_system p (qs, M_mat signs subsets, subsets, signs)))) = set (characterize_consistent_signs_at_roots_copr p qs)
[PROOF STEP]
using reduction_deletes_bad_sign_conds[of p qs signs subsets]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (reduction_signs p qs signs subsets (M_mat signs subsets))

goal (1 subgoal):
 1. set (snd (snd (reduce_system p (qs, M_mat signs subsets, subsets, signs)))) = set (characterize_consistent_signs_at_roots_copr p qs)
[PROOF STEP]
apply (auto)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (reduction_signs p qs signs subsets (M_mat signs subsets)); x \<in> set (snd (snd (let reduce_cols_A = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); rows_keep = rows_to_keep reduce_cols_A in (take_rows_from_matrix reduce_cols_A rows_keep, take_indices subsets rows_keep, take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))))\<rbrakk> \<Longrightarrow> x \<in> set (characterize_consistent_signs_at_roots_copr p qs)
 2. \<And>x. \<lbrakk>\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (reduction_signs p qs signs subsets (M_mat signs subsets)); x \<in> set (characterize_consistent_signs_at_roots_copr p qs)\<rbrakk> \<Longrightarrow> x \<in> set (snd (snd (let reduce_cols_A = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); rows_keep = rows_to_keep reduce_cols_A in (take_rows_from_matrix reduce_cols_A rows_keep, take_indices subsets rows_keep, take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))))
[PROOF STEP]
apply (simp add: all_info distinct_signs match nonzero reduction_signs_def welldefined_signs1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>invertible_mat (M_mat signs subsets) \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))); x \<in> set (snd (snd (let reduce_cols_A = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); rows_keep = rows_to_keep reduce_cols_A in (take_rows_from_matrix reduce_cols_A rows_keep, take_indices subsets rows_keep, take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))))\<rbrakk> \<Longrightarrow> x \<in> set (characterize_consistent_signs_at_roots_copr p qs)
 2. \<And>x. \<lbrakk>\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (reduction_signs p qs signs subsets (M_mat signs subsets)); x \<in> set (characterize_consistent_signs_at_roots_copr p qs)\<rbrakk> \<Longrightarrow> x \<in> set (snd (snd (let reduce_cols_A = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); rows_keep = rows_to_keep reduce_cols_A in (take_rows_from_matrix reduce_cols_A rows_keep, take_indices subsets rows_keep, take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))))
[PROOF STEP]
using nonzero invertible_mat
[PROOF STATE]
proof (prove)
using this:
p \<noteq> 0
invertible_mat (M_mat signs subsets)

goal (2 subgoals):
 1. \<And>x. \<lbrakk>invertible_mat (M_mat signs subsets) \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))); x \<in> set (snd (snd (let reduce_cols_A = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); rows_keep = rows_to_keep reduce_cols_A in (take_rows_from_matrix reduce_cols_A rows_keep, take_indices subsets rows_keep, take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))))\<rbrakk> \<Longrightarrow> x \<in> set (characterize_consistent_signs_at_roots_copr p qs)
 2. \<And>x. \<lbrakk>\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (reduction_signs p qs signs subsets (M_mat signs subsets)); x \<in> set (characterize_consistent_signs_at_roots_copr p qs)\<rbrakk> \<Longrightarrow> x \<in> set (snd (snd (let reduce_cols_A = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); rows_keep = rows_to_keep reduce_cols_A in (take_rows_from_matrix reduce_cols_A rows_keep, take_indices subsets rows_keep, take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))))
[PROOF STEP]
apply (metis snd_conv)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>\<lbrakk>p \<noteq> 0; well_def_signs (length qs) signs; distinct signs; set (characterize_consistent_signs_at_roots_copr p qs) \<subseteq> set signs; satisfy_equation p qs subsets signs; invertible_mat (M_mat signs subsets)\<rbrakk> \<Longrightarrow> set (characterize_consistent_signs_at_roots_copr p qs) = set (reduction_signs p qs signs subsets (M_mat signs subsets)); x \<in> set (characterize_consistent_signs_at_roots_copr p qs)\<rbrakk> \<Longrightarrow> x \<in> set (snd (snd (let reduce_cols_A = take_cols_from_matrix (M_mat signs subsets) (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets))); rows_keep = rows_to_keep reduce_cols_A in (take_rows_from_matrix reduce_cols_A rows_keep, take_indices subsets rows_keep, take_indices signs (find_nonzeros_from_input_vec (solve_for_lhs p qs subsets (M_mat signs subsets)))))))
[PROOF STEP]
by (metis all_info distinct_signs invertible_mat match nonzero reduction_signs_def snd_conv welldefined_signs1)


[STATEMENT]
lemma lmeasure_integral: "S \<in> lmeasurable \<Longrightarrow> measure lebesgue S = integral S (\<lambda>x. 1::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S \<in> lmeasurable \<Longrightarrow> Sigma_Algebra.measure lebesgue S = integral S (\<lambda>x. 1)
[PROOF STEP]
by (fastforce simp add: lmeasure_integral_UNIV indicator_def [abs_def] of_bool_def lmeasurable_iff_integrable_on)


[STATEMENT]
lemma condensation_nodes_edges: "(condensation_edges g P) \<subseteq> (condensation_nodes g P \<times> condensation_nodes g P)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. condensation_edges g P \<subseteq> condensation_nodes g P \<times> condensation_nodes g P
[PROOF STEP]
unfolding condensation_edges_def condensation_nodes_def induced_phi_graph_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(x, y). (scc_of (Restr {(\<phi>, \<phi>'). phiArg g \<phi> \<phi>'} P) x, scc_of (Restr {(\<phi>, \<phi>'). phiArg g \<phi> \<phi>'} P) y)) ` Restr {(\<phi>, \<phi>'). phiArg g \<phi> \<phi>'} P - Id \<subseteq> scc_of (Restr {(\<phi>, \<phi>'). phiArg g \<phi> \<phi>'} P) ` P \<times> scc_of (Restr {(\<phi>, \<phi>'). phiArg g \<phi> \<phi>'} P) ` P
[PROOF STEP]
by auto


[STATEMENT]
lemma (in wf_digraph) set_awalk_verts_append_cas:
  assumes "cas u p v" "cas v q w"
  shows "set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
cas u p v
cas v q w
[PROOF STEP]
have cas_pq: "cas u (p @ q) w"
[PROOF STATE]
proof (prove)
using this:
cas u p v
cas v q w

goal (1 subgoal):
 1. cas u (p @ q) w
[PROOF STEP]
by (simp add: awlast_if_cas)
[PROOF STATE]
proof (state)
this:
cas u (p @ q) w

goal (1 subgoal):
 1. set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
cas u (p @ q) w

goal (1 subgoal):
 1. set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
cas u p v
cas v q w
[PROOF STEP]
have "v \<in> set (awalk_verts u p)"
[PROOF STATE]
proof (prove)
using this:
cas u p v
cas v q w

goal (1 subgoal):
 1. v \<in> set (awalk_verts u p)
[PROOF STEP]
by (metis awalk_verts_non_Nil awlast_if_cas last_in_set)
[PROOF STATE]
proof (state)
this:
v \<in> set (awalk_verts u p)

goal (1 subgoal):
 1. set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
cas u (p @ q) w
v \<in> set (awalk_verts u p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cas u (p @ q) w
v \<in> set (awalk_verts u p)

goal (1 subgoal):
 1. set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
cas u (p @ q) w
v \<in> set (awalk_verts u p)
cas u p v
cas v q w

goal (1 subgoal):
 1. set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)
[PROOF STEP]
by (auto simp: set_awalk_verts_cas)
[PROOF STATE]
proof (state)
this:
set (awalk_verts u (p @ q)) = set (awalk_verts u p) \<union> set (awalk_verts v q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cnj_scaleR [simp]: "cnj (scaleR r x) = scaleR r (cnj x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Octonions.cnj (r *\<^sub>R x) = r *\<^sub>R Octonions.cnj x
[PROOF STEP]
using octo_eq_iff inner_real_def ln_one of_real_inner_1
[PROOF STATE]
proof (prove)
using this:
(?x = ?y) = (Ree ?x = Ree ?y \<and> Im1 ?x = Im1 ?y \<and> Im2 ?x = Im2 ?y \<and> Im3 ?x = Im3 ?y \<and> Im4 ?x = Im4 ?y \<and> Im5 ?x = Im5 ?y \<and> Im6 ?x = Im6 ?y \<and> Im7 ?x = Im7 ?y)
(\<bullet>) = (*)
ln (1::?'a) = (0::?'a)
of_real ?x \<bullet> (1::?'a) = ?x

goal (1 subgoal):
 1. Octonions.cnj (r *\<^sub>R x) = r *\<^sub>R Octonions.cnj x
[PROOF STEP]
by simp


[STATEMENT]
lemma iT_Minus_iprev2: "
  \<lbrakk> k \<ominus> I \<noteq> {}; n \<le> k \<rbrakk> \<Longrightarrow> iprev n (k \<ominus> I) = k - inext (k - n) (I \<down>\<le> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>k \<ominus> I \<noteq> {}; n \<le> k\<rbrakk> \<Longrightarrow> iprev n (k \<ominus> I) = k - inext (k - n) (I \<down>\<le> k)
[PROOF STEP]
by (insert iT_Minus_iprev[of k I "k - n"], simp)


[STATEMENT]
lemma unlabel_filter_eq:
  assumes "\<forall>(j, p) \<in> set A \<union> B. \<forall>(k, q) \<in> set A \<union> B. p = q \<longrightarrow> j = k" (is "?P (set A)")
  shows "[d\<leftarrow>unlabel A. d \<notin> snd ` B] = unlabel [d\<leftarrow>A. d \<notin> B]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>d. d \<notin> snd ` B) (unlabel A) = unlabel (filter (\<lambda>d. d \<notin> B) A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k

goal (1 subgoal):
 1. filter (\<lambda>d. d \<notin> snd ` B) (unlabel A) = unlabel (filter (\<lambda>d. d \<notin> B) A)
[PROOF STEP]
unfolding unlabel_def
[PROOF STATE]
proof (prove)
using this:
\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k

goal (1 subgoal):
 1. filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A)
[PROOF STEP]
proof (induction A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
case (Cons a A)
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>set A \<union> B. case a of (j, p) \<Rightarrow> \<forall>a\<in>set A \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A)
\<forall>b\<in>set (a # A) \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>set (a # A) \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
have "set A \<subseteq> set (a#A)" "{a} \<subseteq> set (a#A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set A \<subseteq> set (a # A) &&& {a} \<subseteq> set (a # A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
set A \<subseteq> set (a # A)
{a} \<subseteq> set (a # A)

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
hence *: "?P (set A)" "?P {a}"
[PROOF STATE]
proof (prove)
using this:
set A \<subseteq> set (a # A)
{a} \<subseteq> set (a # A)

goal (1 subgoal):
 1. \<forall>a\<in>set A \<union> B. case a of (j, p) \<Rightarrow> \<forall>a\<in>set A \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k &&& \<forall>b\<in>{a} \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>{a} \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k
[PROOF STEP]
using Cons.prems
[PROOF STATE]
proof (prove)
using this:
set A \<subseteq> set (a # A)
{a} \<subseteq> set (a # A)
\<forall>b\<in>set (a # A) \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>set (a # A) \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k

goal (1 subgoal):
 1. \<forall>a\<in>set A \<union> B. case a of (j, p) \<Rightarrow> \<forall>a\<in>set A \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k &&& \<forall>b\<in>{a} \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>{a} \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k
[PROOF STEP]
by fast+
[PROOF STATE]
proof (state)
this:
\<forall>a\<in>set A \<union> B. case a of (j, p) \<Rightarrow> \<forall>a\<in>set A \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k
\<forall>b\<in>{a} \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>{a} \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
hence IH: "[d\<leftarrow>map snd A . d \<notin> snd ` B] = map snd [d\<leftarrow>A . d \<notin> B]"
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>set A \<union> B. case a of (j, p) \<Rightarrow> \<forall>a\<in>set A \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k
\<forall>b\<in>{a} \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>{a} \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k

goal (1 subgoal):
 1. filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A)
[PROOF STEP]
using Cons.IH
[PROOF STATE]
proof (prove)
using this:
\<forall>a\<in>set A \<union> B. case a of (j, p) \<Rightarrow> \<forall>a\<in>set A \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k
\<forall>b\<in>{a} \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>{a} \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k
\<forall>a\<in>set A \<union> B. case a of (j, p) \<Rightarrow> \<forall>a\<in>set A \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A)

goal (1 subgoal):
 1. filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A)

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A)

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
assume "snd a \<in> snd ` B"
[PROOF STATE]
proof (state)
this:
snd a \<in> snd ` B

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
snd a \<in> snd ` B
[PROOF STEP]
obtain b where b: "b \<in> B" "snd a = snd b"
[PROOF STATE]
proof (prove)
using this:
snd a \<in> snd ` B

goal (1 subgoal):
 1. (\<And>b. \<lbrakk>b \<in> B; snd a = snd b\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by moura
[PROOF STATE]
proof (state)
this:
b \<in> B
snd a = snd b

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
hence "fst a = fst b"
[PROOF STATE]
proof (prove)
using this:
b \<in> B
snd a = snd b

goal (1 subgoal):
 1. fst a = fst b
[PROOF STEP]
using *(2)
[PROOF STATE]
proof (prove)
using this:
b \<in> B
snd a = snd b
\<forall>b\<in>{a} \<union> B. case b of (j, p) \<Rightarrow> \<forall>a\<in>{a} \<union> B. case a of (k, q) \<Rightarrow> p = q \<longrightarrow> j = k

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

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
hence "a \<in> B"
[PROOF STATE]
proof (prove)
using this:
fst a = fst b

goal (1 subgoal):
 1. a \<in> B
[PROOF STEP]
using b
[PROOF STATE]
proof (prove)
using this:
fst a = fst b
b \<in> B
snd a = snd b

goal (1 subgoal):
 1. a \<in> B
[PROOF STEP]
by (metis surjective_pairing)
[PROOF STATE]
proof (state)
this:
a \<in> B

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
snd a \<in> snd ` B \<Longrightarrow> a \<in> B

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
hence **: "a \<notin> B \<Longrightarrow> snd a \<notin> snd ` B"
[PROOF STATE]
proof (prove)
using this:
snd a \<in> snd ` B \<Longrightarrow> a \<in> B

goal (1 subgoal):
 1. a \<notin> B \<Longrightarrow> snd a \<notin> snd ` B
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
a \<notin> B \<Longrightarrow> snd a \<notin> snd ` B

goal (2 subgoals):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
 2. \<And>a A. \<lbrakk>\<forall>(j, p)\<in>set A \<union> B. \<forall>(k, q)\<in>set A \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd A) = map snd (filter (\<lambda>d. d \<notin> B) A); \<forall>(j, p)\<in>set (a # A) \<union> B. \<forall>(k, q)\<in>set (a # A) \<union> B. p = q \<longrightarrow> j = k\<rbrakk> \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))
[PROOF STEP]
by (cases "a \<in> B") (simp add: ** IH)+
[PROOF STATE]
proof (state)
this:
filter (\<lambda>d. d \<notin> snd ` B) (map snd (a # A)) = map snd (filter (\<lambda>d. d \<notin> B) (a # A))

goal (1 subgoal):
 1. \<forall>(j, p)\<in>set [] \<union> B. \<forall>(k, q)\<in>set [] \<union> B. p = q \<longrightarrow> j = k \<Longrightarrow> filter (\<lambda>d. d \<notin> snd ` B) (map snd []) = map snd (filter (\<lambda>d. d \<notin> B) [])
[PROOF STEP]
qed simp


[STATEMENT]
lemma unvis_insert: "unvisited_verts u (insert x U) = (unvisited_verts u U) - {x}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. unvisited_verts u (insert x U) = unvisited_verts u U - {x}
[PROOF STEP]
unfolding unvisited_verts_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {xa \<in> verts G - insert x U. u \<rightarrow>\<^sup>* xa} = {x \<in> verts G - U. u \<rightarrow>\<^sup>* x} - {x}
[PROOF STEP]
by auto


[STATEMENT]
lemma Qp_int_pow_nonzero:
  assumes "x \<in> nonzero Q\<^sub>p"
  shows "x[^](n::int) \<in> nonzero Q\<^sub>p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x [^] n \<in> nonzero Q\<^sub>p
[PROOF STEP]
using Frac_int_pow_nonzero Q\<^sub>p_def assms
[PROOF STATE]
proof (prove)
using this:
?x \<in> nonzero (Frac Z\<^sub>p) \<Longrightarrow> ?x [^]\<^bsub>Frac Z\<^sub>p\<^esub> ?n \<in> nonzero (Frac Z\<^sub>p)
Q\<^sub>p \<equiv> Frac Z\<^sub>p
x \<in> nonzero Q\<^sub>p

goal (1 subgoal):
 1. x [^] n \<in> nonzero Q\<^sub>p
[PROOF STEP]
by blast


[STATEMENT]
lemma finite_S: "finite S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g})
[PROOF STEP]
using fundchamber_S_fundadjset fundchamber finite_adjacentset
[PROOF STATE]
proof (prove)
using this:
?s \<in> (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g}) \<Longrightarrow> ?s `\<rightarrow> C0 \<in> adjacentset C0 - {C0}
chamber C0
chamber ?C \<Longrightarrow> finite (adjacentset ?C)

goal (1 subgoal):
 1. finite (\<Union>(f, g)\<in>fundfoldpairs. {Abs_induced_automorph f g})
[PROOF STEP]
by    (blast intro: inj_on_finite fundchamber_S_image_inj_on)


[STATEMENT]
lemma i_Exec_Stream_Init_output_strictly_causal: "
  \<lbrakk> input1 \<Down> n = input2 \<Down> n;
    output1 = output_fun \<circ> i_Exec_Comp_Stream_Init trans_fun input1 c;
    output2 = output_fun \<circ> i_Exec_Comp_Stream_Init trans_fun input2 c \<rbrakk> \<Longrightarrow>
  output1 \<Down> Suc n = output2 \<Down> Suc n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>input1 \<Down> n = input2 \<Down> n; output1 = output_fun \<circ> i_Exec_Comp_Stream_Init trans_fun input1 c; output2 = output_fun \<circ> i_Exec_Comp_Stream_Init trans_fun input2 c\<rbrakk> \<Longrightarrow> output1 \<Down> Suc n = output2 \<Down> Suc n
[PROOF STEP]
by (simp add: i_Exec_Stream_Init_strictly_causal[of n input1])


[STATEMENT]
lemma imod_by_0: "(a::enat) mod 0 = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a mod 0 = a
[PROOF STEP]
unfolding mod_enat_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (case a of enat x \<Rightarrow> case 0 of enat y \<Rightarrow> enat (x mod y) | \<infinity> \<Rightarrow> a | \<infinity> \<Rightarrow> \<infinity>) = a
[PROOF STEP]
by (case_tac a, simp_all)


[STATEMENT]
lemma f_minus_ctrm:
  assumes "f \<in> carrier P"
  shows "zcf(f \<ominus>\<^bsub>P\<^esub> ctrm f) = \<zero>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zcf (f \<ominus>\<^bsub>P\<^esub> monom P (f 0) 0) = \<zero>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> carrier P

goal (1 subgoal):
 1. zcf (f \<ominus>\<^bsub>P\<^esub> monom P (f 0) 0) = \<zero>
[PROOF STEP]
by (smt ctrm_is_poly P.add.inv_closed P.minus_closed P_def R.r_neg R.zero_closed zcf_to_fun
        to_fun_minus to_fun_plus UP_cring_axioms zcf_ctrm zcf_def a_minus_def cfs_closed)


[STATEMENT]
lemma "(If x then y else FF) = (x andalso y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. If x then y else FF = (x andalso y)
[PROOF STEP]
by (cases x, auto)


[STATEMENT]
lemma geodesics_nearby:
  assumes "geodesic_segment_between G x y" "geodesic_segment_between H x y"
          "(z::'a) \<in> G"
  shows "infdist z H \<le> 4 * deltaG(TYPE('a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infdist z H \<le> 4 * deltaG TYPE('a)
[PROOF STEP]
using thin_triangles[OF geodesic_segment_between_x_x(1) assms(2) assms(1) assms(3)]
geodesic_segment_endpoints(1)[OF assms(2)] insert_absorb
[PROOF STATE]
proof (prove)
using this:
infdist z ({x} \<union> H) \<le> 4 * deltaG TYPE('a)
x \<in> H
?a \<in> ?A \<Longrightarrow> insert ?a ?A = ?A

goal (1 subgoal):
 1. infdist z H \<le> 4 * deltaG TYPE('a)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma trans_board_correct: "(i,j) \<in> b \<longleftrightarrow> (i+k\<^sub>1,j+k\<^sub>2) \<in> trans_board (k\<^sub>1,k\<^sub>2) b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((i, j) \<in> b) = ((i + k\<^sub>1, j + k\<^sub>2) \<in> trans_board (k\<^sub>1, k\<^sub>2) b)
[PROOF STEP]
unfolding trans_board_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((i, j) \<in> b) = ((i + k\<^sub>1, j + k\<^sub>2) \<in> (case (k\<^sub>1, k\<^sub>2) of (k\<^sub>1, k\<^sub>2) \<Rightarrow> {(i + k\<^sub>1, j + k\<^sub>2) |i j. (i, j) \<in> b}))
[PROOF STEP]
by auto


[STATEMENT]
lemma step_4_remaining_steps_pop_small: "\<lbrakk>
  invar (States dir big small);
  0 < size small;
  Small.pop small = (x, smallP);
  4 \<le> remaining_steps (States dir big smallP);
  (step^^4) (States dir big smallP) = States dir' big' small'
\<rbrakk> \<Longrightarrow> remaining_steps (States dir' big' small') \<le> remaining_steps (States dir big small) - 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>invar (States dir big small); 0 < size small; Small.pop small = (x, smallP); 4 \<le> remaining_steps (States dir big smallP); (step ^^ 4) (States dir big smallP) = States dir' big' small'\<rbrakk> \<Longrightarrow> remaining_steps (States dir' big' small') \<le> remaining_steps (States dir big small) - 4
[PROOF STEP]
by (metis add_le_imp_le_diff invar_pop_small remaining_steps_n_steps_plus remaining_steps_pop_small)


[STATEMENT]
lemma Cauchy_Schwarz_eq_iff:
  shows "(inner x y)\<^sup>2 = inner x x * inner y y \<longleftrightarrow> ((\<exists>k. x = k *\<^sub>R y) \<or> y = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y)) = ((\<exists>k. x = k *\<^sub>R y) \<or> y = (0::'a))
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<lbrakk>(x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y); y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. x = k *\<^sub>R y
 2. \<And>k. x = k *\<^sub>R y \<Longrightarrow> (k *\<^sub>R y \<bullet> y)\<^sup>2 = k *\<^sub>R y \<bullet> k *\<^sub>R y * (y \<bullet> y)
 3. y = (0::'a) \<Longrightarrow> (x \<bullet> (0::'a))\<^sup>2 = x \<bullet> x * ((0::'a) \<bullet> (0::'a))
[PROOF STEP]
assume eq: "(x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y)" and "y \<noteq> 0"
[PROOF STATE]
proof (state)
this:
(x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y)
y \<noteq> (0::'a)

goal (3 subgoals):
 1. \<lbrakk>(x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y); y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. x = k *\<^sub>R y
 2. \<And>k. x = k *\<^sub>R y \<Longrightarrow> (k *\<^sub>R y \<bullet> y)\<^sup>2 = k *\<^sub>R y \<bullet> k *\<^sub>R y * (y \<bullet> y)
 3. y = (0::'a) \<Longrightarrow> (x \<bullet> (0::'a))\<^sup>2 = x \<bullet> x * ((0::'a) \<bullet> (0::'a))
[PROOF STEP]
define f where "f \<equiv> \<lambda>l. inner (x - l *\<^sub>R y) (x - l *\<^sub>R y)"
[PROOF STATE]
proof (state)
this:
f \<equiv> \<lambda>l. (x - l *\<^sub>R y) \<bullet> (x - l *\<^sub>R y)

goal (3 subgoals):
 1. \<lbrakk>(x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y); y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. x = k *\<^sub>R y
 2. \<And>k. x = k *\<^sub>R y \<Longrightarrow> (k *\<^sub>R y \<bullet> y)\<^sup>2 = k *\<^sub>R y \<bullet> k *\<^sub>R y * (y \<bullet> y)
 3. y = (0::'a) \<Longrightarrow> (x \<bullet> (0::'a))\<^sup>2 = x \<bullet> x * ((0::'a) \<bullet> (0::'a))
[PROOF STEP]
have f_quadratic: "f l = inner y y * l\<^sup>2 + - 2 * inner x y * l + inner x x" for l
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f l = y \<bullet> y * l\<^sup>2 + - 2 * (x \<bullet> y) * l + x \<bullet> x
[PROOF STEP]
by (auto simp: f_def algebra_simps power2_eq_square inner_commute)
[PROOF STATE]
proof (state)
this:
f ?l = y \<bullet> y * ?l\<^sup>2 + - 2 * (x \<bullet> y) * ?l + x \<bullet> x

goal (3 subgoals):
 1. \<lbrakk>(x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y); y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. x = k *\<^sub>R y
 2. \<And>k. x = k *\<^sub>R y \<Longrightarrow> (k *\<^sub>R y \<bullet> y)\<^sup>2 = k *\<^sub>R y \<bullet> k *\<^sub>R y * (y \<bullet> y)
 3. y = (0::'a) \<Longrightarrow> (x \<bullet> (0::'a))\<^sup>2 = x \<bullet> x * ((0::'a) \<bullet> (0::'a))
[PROOF STEP]
have "\<exists>l. f l = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>l. f l = 0
[PROOF STEP]
unfolding f_quadratic quadratic_ex_zero_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<bullet> y \<noteq> 0 \<and> 0 \<le> (- 2 * (x \<bullet> y))\<^sup>2 - 4 * (y \<bullet> y) * (x \<bullet> x) \<or> y \<bullet> y = 0 \<and> (- 2 * (x \<bullet> y) = 0 \<longrightarrow> x \<bullet> x = 0)
[PROOF STEP]
using \<open>y \<noteq> 0\<close>
[PROOF STATE]
proof (prove)
using this:
y \<noteq> (0::'a)

goal (1 subgoal):
 1. y \<bullet> y \<noteq> 0 \<and> 0 \<le> (- 2 * (x \<bullet> y))\<^sup>2 - 4 * (y \<bullet> y) * (x \<bullet> x) \<or> y \<bullet> y = 0 \<and> (- 2 * (x \<bullet> y) = 0 \<longrightarrow> x \<bullet> x = 0)
[PROOF STEP]
by (auto simp: eq)
[PROOF STATE]
proof (state)
this:
\<exists>l. f l = 0

goal (3 subgoals):
 1. \<lbrakk>(x \<bullet> y)\<^sup>2 = x \<bullet> x * (y \<bullet> y); y \<noteq> (0::'a)\<rbrakk> \<Longrightarrow> \<exists>k. x = k *\<^sub>R y
 2. \<And>k. x = k *\<^sub>R y \<Longrightarrow> (k *\<^sub>R y \<bullet> y)\<^sup>2 = k *\<^sub>R y \<bullet> k *\<^sub>R y * (y \<bullet> y)
 3. y = (0::'a) \<Longrightarrow> (x \<bullet> (0::'a))\<^sup>2 = x \<bullet> x * ((0::'a) \<bullet> (0::'a))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<exists>l. f l = 0
[PROOF STEP]
show "(\<exists>k. x = k *\<^sub>R y)"
[PROOF STATE]
proof (prove)
using this:
\<exists>l. f l = 0

goal (1 subgoal):
 1. \<exists>k. x = k *\<^sub>R y
[PROOF STEP]
by (auto simp: f_def)
[PROOF STATE]
proof (state)
this:
\<exists>k. x = k *\<^sub>R y

goal (2 subgoals):
 1. \<And>k. x = k *\<^sub>R y \<Longrightarrow> (k *\<^sub>R y \<bullet> y)\<^sup>2 = k *\<^sub>R y \<bullet> k *\<^sub>R y * (y \<bullet> y)
 2. y = (0::'a) \<Longrightarrow> (x \<bullet> (0::'a))\<^sup>2 = x \<bullet> x * ((0::'a) \<bullet> (0::'a))
[PROOF STEP]
qed (auto simp: power2_eq_square)


[STATEMENT]
lemma enn2real_sum:"(\<And>i. i \<in> I \<Longrightarrow> f i < top) \<Longrightarrow> enn2real (sum f I) = sum (enn2real \<circ> f) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>i. i \<in> I \<Longrightarrow> f i < top) \<Longrightarrow> enn2real (sum f I) = sum (enn2real \<circ> f) I
[PROOF STEP]
by (induction I rule: infinite_finite_induct) (auto simp: enn2real_plus)


[STATEMENT]
lemma rel_pmf_code [code]:
  "rel_pmf R p q \<longleftrightarrow>
   (let B = set_pmf q in
    \<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (case_prod R) (A \<times> B)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_pmf R p q = (let B = set_pmf q in \<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> B)))
[PROOF STEP]
unfolding Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_pmf R p q = (\<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q)))
[PROOF STEP]
proof(intro iffI strip)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<lbrakk>rel_pmf R p q; A \<in> Pow (set_pmf p)\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q))
 2. \<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q)) \<Longrightarrow> rel_pmf R p q
[PROOF STEP]
have eq: "snd ` Set.filter (case_prod R) (A \<times> set_pmf q) = {y. \<exists>x\<in>A. R x y} \<inter> set_pmf q" for A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q) = {y. \<exists>x\<in>A. R x y} \<inter> set_pmf q
[PROOF STEP]
by(auto intro: rev_image_eqI simp add: Set.filter_def)
[PROOF STATE]
proof (state)
this:
snd ` Set.filter (\<lambda>(x, y). R x y) (?A \<times> set_pmf q) = {y. \<exists>x\<in>?A. R x y} \<inter> set_pmf q

goal (2 subgoals):
 1. \<And>A. \<lbrakk>rel_pmf R p q; A \<in> Pow (set_pmf p)\<rbrakk> \<Longrightarrow> measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q))
 2. \<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q)) \<Longrightarrow> rel_pmf R p q
[PROOF STEP]
show "measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (case_prod R) (A \<times> set_pmf q))"
    if "rel_pmf R p q" and "A \<in> Pow (set_pmf p)" for A
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
rel_pmf R p q
A \<in> Pow (set_pmf p)

goal (1 subgoal):
 1. measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q))
[PROOF STEP]
by(auto dest: rel_pmf_measureD simp add: eq measure_Int_set_pmf)
[PROOF STATE]
proof (state)
this:
\<lbrakk>rel_pmf R p q; ?A \<in> Pow (set_pmf p)\<rbrakk> \<Longrightarrow> measure_pmf.prob p ?A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (?A \<times> set_pmf q))

goal (1 subgoal):
 1. \<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q)) \<Longrightarrow> rel_pmf R p q
[PROOF STEP]
show "rel_pmf R p q" if "\<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (case_prod R) (A \<times> set_pmf q))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_pmf R p q
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
\<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q))

goal (1 subgoal):
 1. rel_pmf R p q
[PROOF STEP]
by(intro rel_pmf_measureI')(auto intro: ord_le_eq_trans arg_cong2[where f=measure] simp add: eq)
[PROOF STATE]
proof (state)
this:
\<forall>A\<in>Pow (set_pmf p). measure_pmf.prob p A \<le> measure_pmf.prob q (snd ` Set.filter (\<lambda>(x, y). R x y) (A \<times> set_pmf q)) \<Longrightarrow> rel_pmf R p q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma fv_Alts[simp]: "fv (Alts e1 e2) = fv e1 \<union> fv e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fv (Alts e1 e2) = fv e1 \<union> fv e2
[PROOF STEP]
unfolding fv_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {v. atom v \<in> supp (Alts e1 e2)} = {v. atom v \<in> supp e1} \<union> {v. atom v \<in> supp e2}
[PROOF STEP]
by auto


[STATEMENT]
lemma hlog_as_starfun: "\<And>a x. 0 < a \<Longrightarrow> a \<noteq> 1 \<Longrightarrow> hlog a x = ( *f* ln) x / ( *f* ln) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a x. \<lbrakk>0 < a; a \<noteq> 1\<rbrakk> \<Longrightarrow> hlog a x = (*f* real_ln) x / (*f* real_ln) a
[PROOF STEP]
by transfer (simp add: log_def)


[STATEMENT]
lemma wtE_o:
assumes 1: "wtE \<xi>" and 2: "wtSB \<rho>"
shows "wtE (int \<xi> o \<rho>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wtE (int \<xi> \<circ> \<rho>)
[PROOF STEP]
unfolding wtE_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. D ((int \<xi> \<circ> \<rho>) x)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. D ((int \<xi> \<circ> \<rho>) x)
[PROOF STEP]
unfolding comp_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. D (int \<xi> (\<rho> x))
[PROOF STEP]
apply(rule wt_int[OF 1])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. wt (\<rho> x)
[PROOF STEP]
using 2
[PROOF STATE]
proof (prove)
using this:
wtSB \<rho>

goal (1 subgoal):
 1. \<And>x. wt (\<rho> x)
[PROOF STEP]
by auto


[STATEMENT]
lemma signed_take_bit_int_less_self_iff:
  \<open>signed_take_bit n k < k \<longleftrightarrow> 2 ^ n \<le> k\<close>
  for k :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (signed_take_bit n k < k) = (2 ^ n \<le> k)
[PROOF STEP]
by (simp add: signed_take_bit_eq_take_bit_shift take_bit_int_less_self_iff algebra_simps)


[STATEMENT]
lemma mem_restr_IntD: "mem_restr (A \<inter> B) v \<Longrightarrow> mem_restr A v \<and> mem_restr B v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mem_restr (A \<inter> B) v \<Longrightarrow> mem_restr A v \<and> mem_restr B v
[PROOF STEP]
unfolding mem_restr_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Bex (A \<inter> B) (list_all2 (\<lambda>a b. a \<noteq> None \<longrightarrow> a = Some b) v) \<Longrightarrow> Bex A (list_all2 (\<lambda>a b. a \<noteq> None \<longrightarrow> a = Some b) v) \<and> Bex B (list_all2 (\<lambda>a b. a \<noteq> None \<longrightarrow> a = Some b) v)
[PROOF STEP]
by auto


[STATEMENT]
lemma sym_mod_abs: "y > 0 \<Longrightarrow> \<bar>x symmod y\<bar> < y"
  "y \<ge> 1 \<Longrightarrow> \<bar>x symmod y\<bar> \<le> y div 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < y \<Longrightarrow> \<bar>x symmod y\<bar> < y) &&& (1 \<le> y \<Longrightarrow> \<bar>x symmod y\<bar> \<le> y div 2)
[PROOF STEP]
using sym_mod_range[of y x]
[PROOF STATE]
proof (prove)
using this:
0 < y \<Longrightarrow> x symmod y \<in> {- ((y - 1) div 2)..y div 2}

goal (1 subgoal):
 1. (0 < y \<Longrightarrow> \<bar>x symmod y\<bar> < y) &&& (1 \<le> y \<Longrightarrow> \<bar>x symmod y\<bar> \<le> y div 2)
[PROOF STEP]
by auto


[STATEMENT]
lemma transpose_apply_commute:
  \<open>transpose a b (f c) = f (transpose (inv f a) (inv f b) c)\<close>
  if \<open>bij f\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Transposition.transpose a b (f c) = f (Transposition.transpose (inv f a) (inv f b) c)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Transposition.transpose a b (f c) = f (Transposition.transpose (inv f a) (inv f b) c)
[PROOF STEP]
from that
[PROOF STATE]
proof (chain)
picking this:
bij f
[PROOF STEP]
have \<open>surj f\<close>
[PROOF STATE]
proof (prove)
using this:
bij f

goal (1 subgoal):
 1. surj f
[PROOF STEP]
by (rule bij_is_surj)
[PROOF STATE]
proof (state)
this:
surj f

goal (1 subgoal):
 1. Transposition.transpose a b (f c) = f (Transposition.transpose (inv f a) (inv f b) c)
[PROOF STEP]
with that
[PROOF STATE]
proof (chain)
picking this:
bij f
surj f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bij f
surj f

goal (1 subgoal):
 1. Transposition.transpose a b (f c) = f (Transposition.transpose (inv f a) (inv f b) c)
[PROOF STEP]
by (simp add: transpose_def bij_inv_eq_iff surj_f_inv_f)
[PROOF STATE]
proof (state)
this:
Transposition.transpose a b (f c) = f (Transposition.transpose (inv f a) (inv f b) c)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma count_drop: "count_list (drop n cs) x \<le> count_list cs x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
have "count_list cs x = count_list (take n cs @ drop n cs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list cs x = count_list (take n cs @ drop n cs) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
count_list cs x = count_list (take n cs @ drop n cs) x

goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_list cs x = count_list (take n cs @ drop n cs) x

goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
have "\<dots> = count_list (take n cs) x + count_list (drop n cs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (take n cs @ drop n cs) x = count_list (take n cs) x + count_list (drop n cs) x
[PROOF STEP]
by (rule count_list_append)
[PROOF STATE]
proof (state)
this:
count_list (take n cs @ drop n cs) x = count_list (take n cs) x + count_list (drop n cs) x

goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
count_list (take n cs @ drop n cs) x = count_list (take n cs) x + count_list (drop n cs) x

goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
have "\<dots> \<ge> count_list (drop n cs) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list (take n cs) x + count_list (drop n cs) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
count_list (drop n cs) x \<le> count_list (take n cs) x + count_list (drop n cs) x

goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
count_list (drop n cs) x \<le> count_list cs x

goal (1 subgoal):
 1. count_list (drop n cs) x \<le> count_list cs x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
count_list (drop n cs) x \<le> count_list cs x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma convolution_symm_eq_sum_over_supp_left :
  fixes   f g :: "'a::group_add \<Rightarrow> 'b::{comm_monoid_add,mult_zero}"
  assumes "f \<in> aezfun_set"
  shows   "convolution f g = (\<lambda>x. \<Sum>y\<in>supp f. (f y) * g (-y + x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convolution f g = (\<lambda>x. \<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
fix x::'a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
define SS where "SS = {y. y \<in> supp f \<and> -y + x \<in> supp g}"
[PROOF STATE]
proof (state)
this:
SS = {y \<in> supp f. - y + x \<in> supp g}

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
have "finite (supp f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite (supp f)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f \<in> aezfun_set

goal (1 subgoal):
 1. finite (supp f)
[PROOF STEP]
unfolding aezfun_set_def
[PROOF STATE]
proof (prove)
using this:
f \<in> {f. finite (supp f)}

goal (1 subgoal):
 1. finite (supp f)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
finite (supp f)

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (supp f)

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
have "SS \<subseteq> supp f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SS \<subseteq> supp f
[PROOF STEP]
using SS_def
[PROOF STATE]
proof (prove)
using this:
SS = {y \<in> supp f. - y + x \<in> supp g}

goal (1 subgoal):
 1. SS \<subseteq> supp f
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
SS \<subseteq> supp f

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
SS \<subseteq> supp f

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
have "\<And>y. y \<in> supp f - SS \<Longrightarrow> (f y) * g (-y + x) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>y. y \<in> supp f - SS \<Longrightarrow> f y * g (- y + x) = (0::'b)
[PROOF STEP]
using SS_def
[PROOF STATE]
proof (prove)
using this:
SS = {y \<in> supp f. - y + x \<in> supp g}

goal (1 subgoal):
 1. \<And>y. y \<in> supp f - SS \<Longrightarrow> f y * g (- y + x) = (0::'b)
[PROOF STEP]
unfolding supp_def
[PROOF STATE]
proof (prove)
using this:
SS = {y \<in> {x. f x \<noteq> (0::'b)}. - y + x \<in> {x. g x \<noteq> (0::'b)}}

goal (1 subgoal):
 1. \<And>y. y \<in> {x. f x \<noteq> (0::'b)} - SS \<Longrightarrow> f y * g (- y + x) = (0::'b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?y \<in> supp f - SS \<Longrightarrow> f ?y * g (- ?y + x) = (0::'b)

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (supp f)
SS \<subseteq> supp f
?y \<in> supp f - SS \<Longrightarrow> f ?y * g (- ?y + x) = (0::'b)
[PROOF STEP]
have "(\<Sum>y\<in>SS. (f y) * g (-y + x)) = (\<Sum>y\<in>supp f. (f y) * g (-y + x) )"
[PROOF STATE]
proof (prove)
using this:
finite (supp f)
SS \<subseteq> supp f
?y \<in> supp f - SS \<Longrightarrow> f ?y * g (- ?y + x) = (0::'b)

goal (1 subgoal):
 1. (\<Sum>y\<in>SS. f y * g (- y + x)) = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
unfolding convolution_def
[PROOF STATE]
proof (prove)
using this:
finite (supp f)
SS \<subseteq> supp f
?y \<in> supp f - SS \<Longrightarrow> f ?y * g (- ?y + x) = (0::'b)

goal (1 subgoal):
 1. (\<Sum>y\<in>SS. f y * g (- y + x)) = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
using     SS_def sum.mono_neutral_left[of "supp f" SS "\<lambda>y. (f y) * g (-y + x)"]
[PROOF STATE]
proof (prove)
using this:
finite (supp f)
SS \<subseteq> supp f
?y \<in> supp f - SS \<Longrightarrow> f ?y * g (- ?y + x) = (0::'b)
SS = {y \<in> supp f. - y + x \<in> supp g}
\<lbrakk>finite (supp f); SS \<subseteq> supp f; \<forall>i\<in>supp f - SS. f i * g (- i + x) = (0::'b)\<rbrakk> \<Longrightarrow> (\<Sum>y\<in>SS. f y * g (- y + x)) = (\<Sum>y\<in>supp f. f y * g (- y + x))

goal (1 subgoal):
 1. (\<Sum>y\<in>SS. f y * g (- y + x)) = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
by        fast
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>SS. f y * g (- y + x)) = (\<Sum>y\<in>supp f. f y * g (- y + x))

goal (1 subgoal):
 1. \<And>x. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
thus "convolution f g x = (\<Sum>y\<in>supp f. (f y) * g (-y + x) )"
[PROOF STATE]
proof (prove)
using this:
(\<Sum>y\<in>SS. f y * g (- y + x)) = (\<Sum>y\<in>supp f. f y * g (- y + x))

goal (1 subgoal):
 1. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
using SS_def convolution_symm[of f g]
[PROOF STATE]
proof (prove)
using this:
(\<Sum>y\<in>SS. f y * g (- y + x)) = (\<Sum>y\<in>supp f. f y * g (- y + x))
SS = {y \<in> supp f. - y + x \<in> supp g}
convolution f g = (\<lambda>x. \<Sum>y | y \<in> supp f \<and> - y + x \<in> supp g. f y * g (- y + x))

goal (1 subgoal):
 1. convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
convolution f g x = (\<Sum>y\<in>supp f. f y * g (- y + x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iso_verts_eq_iff[simp]:
  assumes "digraph_isomorphism hom" "u \<in> verts G" "v \<in> verts G"
  shows "iso_verts hom u = iso_verts hom v \<longleftrightarrow> u = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (iso_verts hom u = iso_verts hom v) = (u = v)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
digraph_isomorphism hom
u \<in> verts G
v \<in> verts G

goal (1 subgoal):
 1. (iso_verts hom u = iso_verts hom v) = (u = v)
[PROOF STEP]
by (auto simp: digraph_isomorphism_def dest: inj_onD)


[STATEMENT]
lemma emeasure_T_space[simp]: "emeasure (T s) (space R.S) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure (T s) (space (stream_space (count_space UNIV))) = 1
[PROOF STEP]
using T.emeasure_space_1
[PROOF STATE]
proof (prove)
using this:
emeasure (T ?s) (space (T ?s)) = 1

goal (1 subgoal):
 1. emeasure (T s) (space (stream_space (count_space UNIV))) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma fun_eq_on_subset_and_diff_imp_eq_on:
  assumes "A\<subseteq>B" "fun_eq_on f g A" "fun_eq_on f g (B-A)"
  shows   "fun_eq_on f g B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fun_eq_on f g B
[PROOF STEP]
proof (rule fun_eq_onI)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> B \<Longrightarrow> f a = g a
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. a \<in> B \<Longrightarrow> f a = g a
[PROOF STEP]
assume "x\<in>B"
[PROOF STATE]
proof (state)
this:
x \<in> B

goal (1 subgoal):
 1. \<And>a. a \<in> B \<Longrightarrow> f a = g a
[PROOF STEP]
with assms(1)
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> B
x \<in> B
[PROOF STEP]
show "f x = g x"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B
x \<in> B

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
using fun_eq_onD[OF assms(2)] fun_eq_onD[OF assms(3)]
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> B
x \<in> B
?a \<in> A \<Longrightarrow> f ?a = g ?a
?a \<in> B - A \<Longrightarrow> f ?a = g ?a

goal (1 subgoal):
 1. f x = g x
[PROOF STEP]
by    (cases "x\<in>A") auto
[PROOF STATE]
proof (state)
this:
f x = g x

goal:
No subgoals!
[PROOF STEP]
qed