[STATEMENT]
lemma tranclp_imp_stepfun:
  assumes "P\<^sup>+\<^sup>+ x z"
  shows "\<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))"
    (is "\<exists>f n. ?P x z f n")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
P\<^sup>+\<^sup>+ x z

goal (1 subgoal):
 1. \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
proof (induct rule: tranclp_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>y. P x y \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
 2. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
case (base y)
[PROOF STATE]
proof (state)
this:
P x y

goal (2 subgoals):
 1. \<And>y. P x y \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
 2. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
let ?f = "(\<lambda>_. y)(0 := x)"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>y. P x y \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
 2. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
have "?f 0 = x" and "?f (Suc 0) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>_. y)(0::'b := x)) (0::'b) = x &&& ((\<lambda>_. y)(0 := x)) (Suc 0) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
((\<lambda>_. y)(0::?'b1 := x)) (0::?'b1) = x
((\<lambda>_. y)(0 := x)) (Suc 0) = y

goal (2 subgoals):
 1. \<And>y. P x y \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
 2. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
((\<lambda>_. y)(0::?'b1 := x)) (0::?'b1) = x
((\<lambda>_. y)(0 := x)) (Suc 0) = y

goal (2 subgoals):
 1. \<And>y. P x y \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
 2. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
have "\<forall>i\<le>0. P (?f i) (?f (Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<le>0. P (((\<lambda>_. y)(0 := x)) i) (((\<lambda>_. y)(0 := x)) (Suc i))
[PROOF STEP]
using base
[PROOF STATE]
proof (prove)
using this:
P x y

goal (1 subgoal):
 1. \<forall>i\<le>0. P (((\<lambda>_. y)(0 := x)) i) (((\<lambda>_. y)(0 := x)) (Suc i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>0. P (((\<lambda>_. y)(0 := x)) i) (((\<lambda>_. y)(0 := x)) (Suc i))

goal (2 subgoals):
 1. \<And>y. P x y \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
 2. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>_. y)(0::?'b1 := x)) (0::?'b1) = x
((\<lambda>_. y)(0 := x)) (Suc 0) = y
\<forall>i\<le>0. P (((\<lambda>_. y)(0 := x)) i) (((\<lambda>_. y)(0 := x)) (Suc i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
((\<lambda>_. y)(0::?'b1 := x)) (0::?'b1) = x
((\<lambda>_. y)(0 := x)) (Suc 0) = y
\<forall>i\<le>0. P (((\<lambda>_. y)(0 := x)) i) (((\<lambda>_. y)(0 := x)) (Suc i))

goal (1 subgoal):
 1. \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
case (step y z)
[PROOF STATE]
proof (state)
this:
P\<^sup>+\<^sup>+ x y
P y z
\<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
P\<^sup>+\<^sup>+ x y
P y z
\<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
obtain f n where IH: "?P x y f n"
[PROOF STATE]
proof (prove)
using this:
P\<^sup>+\<^sup>+ x y
P y z
\<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))

goal (1 subgoal):
 1. (\<And>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i))) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
have *: "\<forall>i\<le>n. P (f i) (f (Suc i))"
    and [simp]: "f 0 = x" "f (Suc n) = y"
[PROOF STATE]
proof (prove)
using this:
f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))

goal (1 subgoal):
 1. \<forall>i\<le>n. P (f i) (f (Suc i)) &&& f 0 = x &&& f (Suc n) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>n. P (f i) (f (Suc i))
f 0 = x
f (Suc n) = y

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
let ?n = "Suc n"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
let ?f = "f(Suc ?n := z)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
have "?f 0 = x" and "?f (Suc ?n) = z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f(Suc (Suc n) := z)) 0 = x &&& (f(Suc (Suc n) := z)) (Suc (Suc n)) = z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(f(Suc (Suc n) := z)) 0 = x
(f(Suc (Suc n) := z)) (Suc (Suc n)) = z

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(f(Suc (Suc n) := z)) 0 = x
(f(Suc (Suc n) := z)) (Suc (Suc n)) = z

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
have "\<forall>i\<le>?n. P (?f i) (?f (Suc i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>i\<le>Suc n. P ((f(Suc (Suc n) := z)) i) ((f(Suc (Suc n) := z)) (Suc i))
[PROOF STEP]
using \<open>P y z\<close> and *
[PROOF STATE]
proof (prove)
using this:
P y z
\<forall>i\<le>n. P (f i) (f (Suc i))

goal (1 subgoal):
 1. \<forall>i\<le>Suc n. P ((f(Suc (Suc n) := z)) i) ((f(Suc (Suc n) := z)) (Suc i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>i\<le>Suc n. P ((f(Suc (Suc n) := z)) i) ((f(Suc (Suc n) := z)) (Suc i))

goal (1 subgoal):
 1. \<And>y z. \<lbrakk>P\<^sup>+\<^sup>+ x y; P y z; \<exists>f n. f 0 = x \<and> f (Suc n) = y \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))\<rbrakk> \<Longrightarrow> \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(f(Suc (Suc n) := z)) 0 = x
(f(Suc (Suc n) := z)) (Suc (Suc n)) = z
\<forall>i\<le>Suc n. P ((f(Suc (Suc n) := z)) i) ((f(Suc (Suc n) := z)) (Suc i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(f(Suc (Suc n) := z)) 0 = x
(f(Suc (Suc n) := z)) (Suc (Suc n)) = z
\<forall>i\<le>Suc n. P ((f(Suc (Suc n) := z)) i) ((f(Suc (Suc n) := z)) (Suc i))

goal (1 subgoal):
 1. \<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>f n. f 0 = x \<and> f (Suc n) = z \<and> (\<forall>i\<le>n. P (f i) (f (Suc i)))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma last_to_first_eq:
  assumes "length as = n"
  shows "permute_list (last_to_first (n+1)) (a#as)  = (as@[a])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
have 0: "\<And>i. i < (n+1) \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as@[a]) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n + 1 \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n + 1 \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>i. i < n + 1 \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
assume A: "i < n+1"
[PROOF STATE]
proof (state)
this:
i < n + 1

goal (1 subgoal):
 1. \<And>i. i < n + 1 \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
show "permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
proof(cases "i = n")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
i = n

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
have 0: "(as @ [a]) ! i = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (as @ [a]) ! i = a
[PROOF STEP]
by (metis True assms nth_append_length)
[PROOF STATE]
proof (state)
this:
(as @ [a]) ! i = a

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
have 1: "length (a#as) = n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (a # as) = n + 1
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
length (a # as) = n + 1

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
have 2: "i < length (a # as)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < length (a # as)
[PROOF STEP]
using "1" A
[PROOF STATE]
proof (prove)
using this:
length (a # as) = n + 1
i < n + 1

goal (1 subgoal):
 1. i < length (a # as)
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
i < length (a # as)

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
have 3: "last_to_first (n + 1) permutes {..<length (a # as)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. last_to_first (n + 1) permutes {..<length (a # as)}
[PROOF STEP]
by (metis "1" add_gr_0 last_to_first_permutes less_numeral_extra(1))
[PROOF STATE]
proof (state)
this:
last_to_first (n + 1) permutes {..<length (a # as)}

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
have 4: "permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! last_to_first (n + 1) i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! last_to_first (n + 1) i
[PROOF STEP]
using  2 3  permute_list_nth[of "last_to_first (n + 1)" "a#as" i]
[PROOF STATE]
proof (prove)
using this:
i < length (a # as)
last_to_first (n + 1) permutes {..<length (a # as)}
\<lbrakk>last_to_first (n + 1) permutes {..<length (a # as)}; i < length (a # as)\<rbrakk> \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! last_to_first (n + 1) i

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! last_to_first (n + 1) i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! last_to_first (n + 1) i

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
have 5: "permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! 0
[PROOF STEP]
using 4
[PROOF STATE]
proof (prove)
using this:
permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! last_to_first (n + 1) i

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! 0
[PROOF STEP]
unfolding last_to_first_def
[PROOF STATE]
proof (prove)
using this:
permute_list (\<lambda>i. if i = n + 1 - 1 then 0 else if i < n + 1 - 1 then i + 1 else i) (a # as) ! i = (a # as) ! (if i = n + 1 - 1 then 0 else if i < n + 1 - 1 then i + 1 else i)

goal (1 subgoal):
 1. permute_list (\<lambda>i. if i = n + 1 - 1 then 0 else if i < n + 1 - 1 then i + 1 else i) (a # as) ! i = (a # as) ! 0
[PROOF STEP]
by (simp add: True)
[PROOF STATE]
proof (state)
this:
permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! 0

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
have 6: "permute_list (last_to_first (n + 1)) (a # as) ! i = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = a
[PROOF STEP]
using 5
[PROOF STATE]
proof (prove)
using this:
permute_list (last_to_first (n + 1)) (a # as) ! i = (a # as) ! 0

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
permute_list (last_to_first (n + 1)) (a # as) ! i = a

goal (2 subgoals):
 1. i = n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
 2. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
permute_list (last_to_first (n + 1)) (a # as) ! i = a
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
permute_list (last_to_first (n + 1)) (a # as) ! i = a

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
using 0
[PROOF STATE]
proof (prove)
using this:
permute_list (last_to_first (n + 1)) (a # as) ! i = a
(as @ [a]) ! i = a

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
i \<noteq> n

goal (1 subgoal):
 1. i \<noteq> n \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<noteq> n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
i \<noteq> n

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i
[PROOF STEP]
by (smt A add.commute add.right_neutral add_diff_cancel_right' add_gr_0
            add_less_cancel_left append.simps(1) append.simps(2) assms last_to_first_def
            last_to_first_permutes less_SucE less_numeral_extra(1) list.size(3) list.size(4)
            nth_append permute_list_nth plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
permute_list (last_to_first (n + 1)) (a # as) ! i = (as @ [a]) ! i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
?i3 < n + 1 \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! ?i3 = (as @ [a]) ! ?i3

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
have 1: "length (a#as) = n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (a # as) = n + 1
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
length (a # as) = n + 1

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
have 2: "length (permute_list (last_to_first (n+1)) (a#as)) = n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (permute_list (last_to_first (n + 1)) (a # as)) = n + 1
[PROOF STEP]
by (metis "1" length_permute_list)
[PROOF STATE]
proof (state)
this:
length (permute_list (last_to_first (n + 1)) (a # as)) = n + 1

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
have 3: "length (as@[a]) = n + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (as @ [a]) = n + 1
[PROOF STEP]
by (simp add: assms)
[PROOF STATE]
proof (state)
this:
length (as @ [a]) = n + 1

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (as @ [a]) = n + 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (as @ [a]) = n + 1

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
using 0 2
[PROOF STATE]
proof (prove)
using this:
length (as @ [a]) = n + 1
?i3 < n + 1 \<Longrightarrow> permute_list (last_to_first (n + 1)) (a # as) ! ?i3 = (as @ [a]) ! ?i3
length (permute_list (last_to_first (n + 1)) (a # as)) = n + 1

goal (1 subgoal):
 1. permute_list (last_to_first (n + 1)) (a # as) = as @ [a]
[PROOF STEP]
by (metis nth_equalityI)
[PROOF STATE]
proof (state)
this:
permute_list (last_to_first (n + 1)) (a # as) = as @ [a]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma alternating_order2_even_cancel_right:
  assumes st    : "s+s=0" "t+t=0"
  and     even_n: "even n"
  shows   "m \<le> n \<Longrightarrow> sum_list (alternating_list n s t @ alternating_list m t s) =
            sum_list (alternating_list (n-m) s t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. m \<le> n \<Longrightarrow> sum_list (alternating_list n s t @ alternating_list m t s) = sum_list (alternating_list (n - m) s t)
[PROOF STEP]
proof (induct n arbitrary: m rule: nat_even_induct, rule even_n)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>m. m \<le> 0 \<Longrightarrow> sum_list (alternating_list 0 s t @ alternating_list m t s) = sum_list (alternating_list (0 - m) s t)
 2. \<And>m ma. \<lbrakk>even m; \<And>ma. ma \<le> m \<Longrightarrow> sum_list (alternating_list m s t @ alternating_list ma t s) = sum_list (alternating_list (m - ma) s t); ma \<le> Suc (Suc m)\<rbrakk> \<Longrightarrow> sum_list (alternating_list (Suc (Suc m)) s t @ alternating_list ma t s) = sum_list (alternating_list (Suc (Suc m) - ma) s t)
[PROOF STEP]
case (SucSuc k)
[PROOF STATE]
proof (state)
this:
even k
?m \<le> k \<Longrightarrow> sum_list (alternating_list k s t @ alternating_list ?m t s) = sum_list (alternating_list (k - ?m) s t)
m \<le> Suc (Suc k)

goal (2 subgoals):
 1. \<And>m. m \<le> 0 \<Longrightarrow> sum_list (alternating_list 0 s t @ alternating_list m t s) = sum_list (alternating_list (0 - m) s t)
 2. \<And>m ma. \<lbrakk>even m; \<And>ma. ma \<le> m \<Longrightarrow> sum_list (alternating_list m s t @ alternating_list ma t s) = sum_list (alternating_list (m - ma) s t); ma \<le> Suc (Suc m)\<rbrakk> \<Longrightarrow> sum_list (alternating_list (Suc (Suc m)) s t @ alternating_list ma t s) = sum_list (alternating_list (Suc (Suc m) - ma) s t)
[PROOF STEP]
with st
[PROOF STATE]
proof (chain)
picking this:
s + s = (0::'a)
t + t = (0::'a)
even k
?m \<le> k \<Longrightarrow> sum_list (alternating_list k s t @ alternating_list ?m t s) = sum_list (alternating_list (k - ?m) s t)
m \<le> Suc (Suc k)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
s + s = (0::'a)
t + t = (0::'a)
even k
?m \<le> k \<Longrightarrow> sum_list (alternating_list k s t @ alternating_list ?m t s) = sum_list (alternating_list (k - ?m) s t)
m \<le> Suc (Suc k)

goal (1 subgoal):
 1. sum_list (alternating_list (Suc (Suc k)) s t @ alternating_list m t s) = sum_list (alternating_list (Suc (Suc k) - m) s t)
[PROOF STEP]
using alternating_order2_cancel_2left[of t s]
[PROOF STATE]
proof (prove)
using this:
s + s = (0::'a)
t + t = (0::'a)
even k
?m \<le> k \<Longrightarrow> sum_list (alternating_list k s t @ alternating_list ?m t s) = sum_list (alternating_list (k - ?m) s t)
m \<le> Suc (Suc k)
\<lbrakk>t + t = (0::'a); s + s = (0::'a)\<rbrakk> \<Longrightarrow> sum_list (s # t # alternating_list (Suc (Suc ?n)) t s) = sum_list (alternating_list ?n t s)

goal (1 subgoal):
 1. sum_list (alternating_list (Suc (Suc k)) s t @ alternating_list m t s) = sum_list (alternating_list (Suc (Suc k) - m) s t)
[PROOF STEP]
by    (cases m rule: nat_cases_2Suc) auto
[PROOF STATE]
proof (state)
this:
sum_list (alternating_list (Suc (Suc k)) s t @ alternating_list m t s) = sum_list (alternating_list (Suc (Suc k) - m) s t)

goal (1 subgoal):
 1. \<And>m. m \<le> 0 \<Longrightarrow> sum_list (alternating_list 0 s t @ alternating_list m t s) = sum_list (alternating_list (0 - m) s t)
[PROOF STEP]
qed simp


[STATEMENT]
lemma dim_row_of_iter_tensor [simp]:
  fixes A n
  assumes "n \<ge> 1"
  shows "dim_row(A \<otimes>\<^bsup>n\<^esup>) = (dim_row A)^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
1 \<le> n

goal (1 subgoal):
 1. dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n
[PROOF STEP]
proof (rule nat_induct_at_least)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_row (A \<otimes>\<^bsup>1\<^esup>) = dim_row A ^ 1
 2. \<And>n. \<lbrakk>1 \<le> n; dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n\<rbrakk> \<Longrightarrow> dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = dim_row A ^ Suc n
[PROOF STEP]
show "dim_row (A \<otimes>\<^bsup>1\<^esup>) = (dim_row A)^1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (A \<otimes>\<^bsup>1\<^esup>) = dim_row A ^ 1
[PROOF STEP]
using one_tensor_is_id
[PROOF STATE]
proof (prove)
using this:
?A \<otimes>\<^bsup>1\<^esup> = ?A

goal (1 subgoal):
 1. dim_row (A \<otimes>\<^bsup>1\<^esup>) = dim_row A ^ 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (A \<otimes>\<^bsup>1\<^esup>) = dim_row A ^ 1

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n\<rbrakk> \<Longrightarrow> dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = dim_row A ^ Suc n
[PROOF STEP]
fix n:: nat
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n\<rbrakk> \<Longrightarrow> dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = dim_row A ^ Suc n
[PROOF STEP]
assume "n \<ge> 1" and "dim_row (A \<otimes>\<^bsup>n\<^esup>) = (dim_row A)^n"
[PROOF STATE]
proof (state)
this:
1 \<le> n
dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n

goal (1 subgoal):
 1. \<And>n. \<lbrakk>1 \<le> n; dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n\<rbrakk> \<Longrightarrow> dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = dim_row A ^ Suc n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 \<le> n
dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n
[PROOF STEP]
show "dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = (dim_row A)^Suc n"
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n

goal (1 subgoal):
 1. dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = dim_row A ^ Suc n
[PROOF STEP]
using iter_tensor_suc assms dim_row_tensor_mat
[PROOF STATE]
proof (prove)
using this:
1 \<le> n
dim_row (A \<otimes>\<^bsup>n\<^esup>) = dim_row A ^ n
1 \<le> ?n \<Longrightarrow> ?A \<otimes>\<^bsup>Suc ?n\<^esup> = ?A \<Otimes> ?A \<otimes>\<^bsup>?n\<^esup>
1 \<le> n
dim_row (?A \<Otimes> ?B) = dim_row ?A * dim_row ?B

goal (1 subgoal):
 1. dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = dim_row A ^ Suc n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_row (A \<otimes>\<^bsup>Suc n\<^esup>) = dim_row A ^ Suc n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem Ramsey:
  fixes s r :: nat
    and Z :: "'a set"
    and f :: "'a set \<Rightarrow> nat"
  shows
   "\<lbrakk>infinite Z;
      \<forall>X. X \<subseteq> Z \<and> finite X \<and> card X = r \<longrightarrow> f X < s\<rbrakk>
    \<Longrightarrow> \<exists>Y t. Y \<subseteq> Z \<and> infinite Y \<and> t < s
            \<and> (\<forall>X. X \<subseteq> Y \<and> finite X \<and> card X = r \<longrightarrow> f X = t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>infinite Z; \<forall>X. X \<subseteq> Z \<and> finite X \<and> card X = r \<longrightarrow> f X < s\<rbrakk> \<Longrightarrow> \<exists>Y t. Y \<subseteq> Z \<and> infinite Y \<and> t < s \<and> (\<forall>X. X \<subseteq> Y \<and> finite X \<and> card X = r \<longrightarrow> f X = t)
[PROOF STEP]
by (blast intro: Ramsey_induction [unfolded part_fn_def nsets_def])


[STATEMENT]
lemma schwefel:
  "5.8806 / 10 ^ 10 + (x0 - (x1)\<^sup>2)\<^sup>2 + (x1 - 1)\<^sup>2 + (x0 - (x2)\<^sup>2)\<^sup>2 + (x2 - 1)\<^sup>2 =
  interpret_floatarith schwefel [x0, x1, x2]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 58806 / 10 ^ 4 / 10 ^ 10 + (x0 - x1\<^sup>2)\<^sup>2 + (x1 - 1)\<^sup>2 + (x0 - x2\<^sup>2)\<^sup>2 + (x2 - 1)\<^sup>2 = interpret_floatarith schwefel [x0, x1, x2]
[PROOF STEP]
by (simp add: schwefel_def)


[STATEMENT]
lemma numeral_6_eq_6: "6 = Suc (Suc (Suc (Suc (Suc (Suc 0)))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 6 = Suc (Suc (Suc (Suc (Suc (Suc 0)))))
[PROOF STEP]
by (simp add: eval_nat_numeral)


[STATEMENT]
lemma isomorphic_homology_groups_Euclidean_complements:
  assumes "closedin (Euclidean_space n) S" "closedin (Euclidean_space n) T"
           "(subtopology (Euclidean_space n) S) homeomorphic_space (subtopology (Euclidean_space n) T)"
  shows "homology_group p (subtopology (Euclidean_space n) (topspace(Euclidean_space n) - S))
         \<cong> homology_group p (subtopology (Euclidean_space n) (topspace(Euclidean_space n) - T))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. homology_group p (subtopology (Euclidean_space n) (topspace (Euclidean_space n) - S)) \<cong> homology_group p (subtopology (Euclidean_space n) (topspace (Euclidean_space n) - T))
[PROOF STEP]
proof (rule isomorphic_relative_contractible_space_imp_homology_groups)
[PROOF STATE]
proof (state)
goal (6 subgoals):
 1. contractible_space (Euclidean_space n)
 2. contractible_space (Euclidean_space n)
 3. topspace (Euclidean_space n) - S \<subseteq> topspace (Euclidean_space n)
 4. topspace (Euclidean_space n) - T \<subseteq> topspace (Euclidean_space n)
 5. (topspace (Euclidean_space n) - S = {}) = (topspace (Euclidean_space n) - T = {})
 6. \<And>p. relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong> relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)
[PROOF STEP]
show "topspace (Euclidean_space n) - S \<subseteq> topspace (Euclidean_space n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace (Euclidean_space n) - S \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
using assms homeomorphic_space_sym invariance_of_dimension_closedin_Euclidean_space subtopology_superset
[PROOF STATE]
proof (prove)
using this:
closedin (Euclidean_space n) S
closedin (Euclidean_space n) T
subtopology (Euclidean_space n) S homeomorphic_space subtopology (Euclidean_space n) T
(?X homeomorphic_space ?Y) = (?Y homeomorphic_space ?X)
closedin (Euclidean_space ?n) ?S \<Longrightarrow> (subtopology (Euclidean_space ?n) ?S homeomorphic_space Euclidean_space ?n) = (?S = topspace (Euclidean_space ?n))
topspace ?U \<subseteq> ?V \<Longrightarrow> subtopology ?U ?V = ?U

goal (1 subgoal):
 1. topspace (Euclidean_space n) - S \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
topspace (Euclidean_space n) - S \<subseteq> topspace (Euclidean_space n)

goal (5 subgoals):
 1. contractible_space (Euclidean_space n)
 2. contractible_space (Euclidean_space n)
 3. topspace (Euclidean_space n) - T \<subseteq> topspace (Euclidean_space n)
 4. (topspace (Euclidean_space n) - S = {}) = (topspace (Euclidean_space n) - T = {})
 5. \<And>p. relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong> relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)
[PROOF STEP]
show "topspace (Euclidean_space n) - T \<subseteq> topspace (Euclidean_space n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. topspace (Euclidean_space n) - T \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
using assms invariance_of_dimension_closedin_Euclidean_space subtopology_superset
[PROOF STATE]
proof (prove)
using this:
closedin (Euclidean_space n) S
closedin (Euclidean_space n) T
subtopology (Euclidean_space n) S homeomorphic_space subtopology (Euclidean_space n) T
closedin (Euclidean_space ?n) ?S \<Longrightarrow> (subtopology (Euclidean_space ?n) ?S homeomorphic_space Euclidean_space ?n) = (?S = topspace (Euclidean_space ?n))
topspace ?U \<subseteq> ?V \<Longrightarrow> subtopology ?U ?V = ?U

goal (1 subgoal):
 1. topspace (Euclidean_space n) - T \<subseteq> topspace (Euclidean_space n)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
topspace (Euclidean_space n) - T \<subseteq> topspace (Euclidean_space n)

goal (4 subgoals):
 1. contractible_space (Euclidean_space n)
 2. contractible_space (Euclidean_space n)
 3. (topspace (Euclidean_space n) - S = {}) = (topspace (Euclidean_space n) - T = {})
 4. \<And>p. relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong> relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)
[PROOF STEP]
show "(topspace (Euclidean_space n) - S = {}) = (topspace (Euclidean_space n) - T = {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (topspace (Euclidean_space n) - S = {}) = (topspace (Euclidean_space n) - T = {})
[PROOF STEP]
by (metis Diff_eq_empty_iff assms closedin_subset homeomorphic_space_sym invariance_of_dimension_closedin_Euclidean_space subset_antisym subtopology_topspace)
[PROOF STATE]
proof (state)
this:
(topspace (Euclidean_space n) - S = {}) = (topspace (Euclidean_space n) - T = {})

goal (3 subgoals):
 1. contractible_space (Euclidean_space n)
 2. contractible_space (Euclidean_space n)
 3. \<And>p. relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong> relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)
[PROOF STEP]
show "relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong>
        relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)" for p
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong> relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)
[PROOF STEP]
using assms isomorphic_relative_homology_groups_Euclidean_complements
[PROOF STATE]
proof (prove)
using this:
closedin (Euclidean_space n) S
closedin (Euclidean_space n) T
subtopology (Euclidean_space n) S homeomorphic_space subtopology (Euclidean_space n) T
\<lbrakk>closedin (Euclidean_space ?n) ?S; closedin (Euclidean_space ?n) ?T; subtopology (Euclidean_space ?n) ?S homeomorphic_space subtopology (Euclidean_space ?n) ?T\<rbrakk> \<Longrightarrow> relative_homology_group ?p (Euclidean_space ?n) (topspace (Euclidean_space ?n) - ?S) \<cong> relative_homology_group ?p (Euclidean_space ?n) (topspace (Euclidean_space ?n) - ?T)

goal (1 subgoal):
 1. relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong> relative_homology_group p (Euclidean_space n) (topspace (Euclidean_space n) - T)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
relative_homology_group ?p (Euclidean_space n) (topspace (Euclidean_space n) - S) \<cong> relative_homology_group ?p (Euclidean_space n) (topspace (Euclidean_space n) - T)

goal (2 subgoals):
 1. contractible_space (Euclidean_space n)
 2. contractible_space (Euclidean_space n)
[PROOF STEP]
qed auto


[STATEMENT]
lemma rat_number_collapse:
  "Fract 0 k = 0"
  "Fract 1 1 = 1"
  "Fract (numeral w) 1 = numeral w"
  "Fract (- numeral w) 1 = - numeral w"
  "Fract (- 1) 1 = - 1"
  "Fract k 0 = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Fract 0 k = 0 &&& Fract 1 1 = 1 &&& Fract (numeral w) 1 = numeral w) &&& Fract (- numeral w) 1 = - numeral w &&& Fract (- 1) 1 = - 1 &&& Fract k 0 = 0
[PROOF STEP]
using Fract_of_int_eq [of "numeral w"]
    and Fract_of_int_eq [of "- numeral w"]
[PROOF STATE]
proof (prove)
using this:
Fract (numeral w) 1 = of_int (numeral w)
Fract (- numeral w) 1 = of_int (- numeral w)

goal (1 subgoal):
 1. (Fract 0 k = 0 &&& Fract 1 1 = 1 &&& Fract (numeral w) 1 = numeral w) &&& Fract (- numeral w) 1 = - numeral w &&& Fract (- 1) 1 = - 1 &&& Fract k 0 = 0
[PROOF STEP]
by (simp_all add: Zero_rat_def One_rat_def eq_rat)


[STATEMENT]
lemma forall_simp2 [simp]: "(\<forall>a b. \<forall>x\<in>A. \<forall>y. (a  = t x y) \<longrightarrow> (h x y) \<longrightarrow> (g x y) \<or> b \<noteq> u x y) = (\<forall>x\<in>A. \<forall>y. h x y \<longrightarrow> g x y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>a b. \<forall>x\<in>A. \<forall>y. a = t x y \<longrightarrow> h x y \<longrightarrow> g x y \<or> b \<noteq> u x y) = (\<forall>x\<in>A. \<forall>y. h x y \<longrightarrow> g x y)
[PROOF STEP]
by auto


[STATEMENT]
lemma poly_subst_plus: "poly_subst f (p + q) = poly_subst f p + poly_subst f q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_subst f (p + q) = poly_subst f p + poly_subst f q
[PROOF STEP]
by (simp add: poly_subst_alt lookup_add punit.monom_mult_dist_left, rule Sum_any.distrib,
      (fact finite_monom_mult_lookup_not_zero)+)


[STATEMENT]
lemma rightUniqueSetCardinality:
  assumes "x \<in> Domain R" "runiq R"
  shows "card (R``{x})=1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (R `` {x}) = 1
[PROOF STEP]
using assms  lm02 DomainE Image_singleton_iff empty_iff
[PROOF STATE]
proof (prove)
using this:
x \<in> Domain R
runiq R
trivial ?X = (?X = {} \<or> card ?X = 1)
\<lbrakk>?a \<in> Domain ?r; \<And>b. (?a, b) \<in> ?r \<Longrightarrow> ?P\<rbrakk> \<Longrightarrow> ?P
(?b \<in> ?r `` {?a}) = ((?a, ?b) \<in> ?r)
(?c \<in> {}) = False

goal (1 subgoal):
 1. card (R `` {x}) = 1
[PROOF STEP]
by (metis runiq_alt)


[STATEMENT]
lemma choose_row_sum: "(\<Sum>k\<le>n. n choose k) = 2^n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum ((choose) n) {..n} = 2 ^ n
[PROOF STEP]
using binomial [of 1 "1" n]
[PROOF STATE]
proof (prove)
using this:
(1 + 1) ^ n = (\<Sum>k\<le>n. of_nat (n choose k) * 1 ^ k * 1 ^ (n - k))

goal (1 subgoal):
 1. sum ((choose) n) {..n} = 2 ^ n
[PROOF STEP]
by (simp add: numeral_2_eq_2)


[STATEMENT]
lemma span_UNIV[simp]: "span UNIV = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span UNIV = UNIV
[PROOF STEP]
by (auto intro: span_base)


[STATEMENT]
lemma comm_monoid_set_F_and: "comm_monoid_set.F (\<and>) True f s \<longleftrightarrow> (finite s \<longrightarrow> (\<forall>x\<in>s. f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_monoid_set.F (\<and>) True f s = (finite s \<longrightarrow> (\<forall>x\<in>s. f x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. comm_monoid_set.F (\<and>) True f s = (finite s \<longrightarrow> (\<forall>x\<in>s. f x))
[PROOF STEP]
interpret bool: comm_monoid_set \<open>(\<and>)\<close> True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. comm_monoid_set (\<and>) True
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bool.F f s = (finite s \<longrightarrow> (\<forall>x\<in>s. f x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bool.F f s = (finite s \<longrightarrow> (\<forall>x\<in>s. f x))
[PROOF STEP]
by (induction s rule: infinite_finite_induct) auto
[PROOF STATE]
proof (state)
this:
bool.F f s = (finite s \<longrightarrow> (\<forall>x\<in>s. f x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma  X_ZmX_rho_psim[simp]:
  shows "Complex_Matrix.trace (rho_psim * X_ZmX) = 1/ (sqrt 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (rho_psim * X_ZmX) = complex_of_real (1 / sqrt 2)
[PROOF STEP]
apply (auto simp add: ket_10_def ket_1_def X_ZmX_def ZmX_def X_def ket_01_def
      Z_def rho_psim_def ket_psim_def rank_1_proj_def outer_prod_def ket_0_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.trace (Matrix.mat 4 (Suc 0) (\<lambda>(i, j). (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v ((unit_vec 2 0 \<otimes> unit_vec 2 (Suc 0)) - (unit_vec 2 (Suc 0) \<otimes> unit_vec 2 0))) $ i) * Matrix.mat (Suc 0) 4 (\<lambda>(i, j). conjugate (1 / complex_of_real (sqrt 2) \<cdot>\<^sub>v ((unit_vec 2 0 \<otimes> unit_vec 2 (Suc 0)) - (unit_vec 2 (Suc 0) \<otimes> unit_vec 2 0))) $ j) * (Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1) \<Otimes> 1 / complex_of_real (sqrt 2) \<cdot>\<^sub>m (Matrix.mat 2 2 (\<lambda>(i, j). if i \<noteq> j then 0 else if i = 0 then 1 else - 1) - Matrix.mat 2 2 (\<lambda>(i, j). if i = j then 0 else 1)))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (auto simp add: Complex_Matrix.trace_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k<4. (cnj (if k div 2 = 0 then 1 else 0) * cnj (if k mod 2 = Suc 0 then 1 else 0) - cnj (if k div 2 = Suc 0 then 1 else 0) * cnj (if k mod 2 = 0 then 1 else 0)) * ((if k div 2 = 0 then 0 else 1) * ((if k mod 2 = 0 then 0 else if k mod 2 = 0 then 1 else - 1) - (if k mod 2 = Suc 0 then 0 else 1))) / (complex_of_real (sqrt 2) * complex_of_real (sqrt 2) * complex_of_real (sqrt 2))) + (\<Sum>k<4. - ((cnj (if k div 2 = 0 then 1 else 0) * cnj (if k mod 2 = Suc 0 then 1 else 0) - cnj (if k div 2 = Suc 0 then 1 else 0) * cnj (if k mod 2 = 0 then 1 else 0)) * ((if k div 2 = Suc 0 then 0 else 1) * ((if k mod 2 = Suc 0 then 0 else if k mod 2 = 0 then 1 else - 1) - (if k mod 2 = 0 then 0 else 1))) / (complex_of_real (sqrt 2) * complex_of_real (sqrt 2) * complex_of_real (sqrt 2)))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (simp add: sum_4_elems)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 2 / (complex_of_real (sqrt 2) * (complex_of_real (sqrt 2) * complex_of_real (sqrt 2))) = 1 / complex_of_real (sqrt 2)
[PROOF STEP]
apply (simp add: csqrt_2_sq)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma ordLess_or_ordIso:
assumes WELL: "Well_order r" and WELL': "Well_order r'"
shows "r <o r' \<or> r' <o r \<or> r =o r'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. r <o r' \<or> r' <o r \<or> r =o r'
[PROOF STEP]
unfolding ordLess_def ordIso_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r, r') \<in> {(r, r'). Well_order r \<and> Well_order r' \<and> Ex (embedS r r')} \<or> (r', r) \<in> {(r, r'). Well_order r \<and> Well_order r' \<and> Ex (embedS r r')} \<or> (r, r') \<in> {(r, r'). Well_order r \<and> Well_order r' \<and> Ex (iso r r')}
[PROOF STEP]
using assms embedS_or_iso[of r r']
[PROOF STATE]
proof (prove)
using this:
Well_order r
Well_order r'
\<lbrakk>Well_order r; Well_order r'\<rbrakk> \<Longrightarrow> (\<exists>g. embedS r r' g) \<or> (\<exists>h. embedS r' r h) \<or> (\<exists>f. iso r r' f)

goal (1 subgoal):
 1. (r, r') \<in> {(r, r'). Well_order r \<and> Well_order r' \<and> Ex (embedS r r')} \<or> (r', r) \<in> {(r, r'). Well_order r \<and> Well_order r' \<and> Ex (embedS r r')} \<or> (r, r') \<in> {(r, r'). Well_order r \<and> Well_order r' \<and> Ex (iso r r')}
[PROOF STEP]
by auto


[STATEMENT]
lemma mod_in_totatives: "n > 1 \<Longrightarrow> a mod n \<in> totatives n \<longleftrightarrow> coprime a n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < n \<Longrightarrow> (a mod n \<in> totatives n) = coprime a n
[PROOF STEP]
by (auto simp: totatives_def mod_greater_zero_iff_not_dvd dest: coprime_common_divisor_nat)


[STATEMENT]
lemma coeff_higher_pderiv:
  "coeff ((pderiv ^^ m) f) n = pochhammer (of_nat (Suc n)) m * coeff f (n + m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. coeff ((pderiv ^^ m) f) n = pochhammer (of_nat (Suc n)) m * coeff f (n + m)
[PROOF STEP]
by (induction m arbitrary: n) (simp_all add: coeff_pderiv pochhammer_rec algebra_simps)


[STATEMENT]
lemma metric_LIM_compose2:
  fixes a :: "'a::metric_space"
  assumes f: "f \<midarrow>a\<rightarrow> b"
    and g: "g \<midarrow>b\<rightarrow> c"
    and inj: "\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<noteq> b"
  shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c
[PROOF STEP]
using inj
[PROOF STATE]
proof (prove)
using this:
\<exists>d>0. \<forall>x. x \<noteq> a \<and> dist x a < d \<longrightarrow> f x \<noteq> b

goal (1 subgoal):
 1. (\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c
[PROOF STEP]
by (intro tendsto_compose_eventually[OF g f]) (auto simp: eventually_at)


[STATEMENT]
lemma frontier_of_Int_subset: "X frontier_of (S \<inter> T) \<subseteq> X frontier_of S \<union> X frontier_of T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X frontier_of (S \<inter> T) \<subseteq> X frontier_of S \<union> X frontier_of T
[PROOF STEP]
by (simp add: frontier_of_Int)


[STATEMENT]
lemma simply_connected_homotopic_loops:
  "simply_connected S \<longleftrightarrow>
       (\<forall>p q. homotopic_loops S p p \<and> homotopic_loops S q q \<longrightarrow> homotopic_loops S p q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. simply_connected S = (\<forall>p q. homotopic_loops S p p \<and> homotopic_loops S q q \<longrightarrow> homotopic_loops S p q)
[PROOF STEP]
unfolding simply_connected_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>p q. path p \<and> pathfinish p = pathstart p \<and> path_image p \<subseteq> S \<and> path q \<and> pathfinish q = pathstart q \<and> path_image q \<subseteq> S \<longrightarrow> homotopic_loops S p q) = (\<forall>p q. homotopic_loops S p p \<and> homotopic_loops S q q \<longrightarrow> homotopic_loops S p q)
[PROOF STEP]
using homotopic_loops_refl
[PROOF STATE]
proof (prove)
using this:
homotopic_loops ?s ?p ?p = (path ?p \<and> path_image ?p \<subseteq> ?s \<and> pathfinish ?p = pathstart ?p)

goal (1 subgoal):
 1. (\<forall>p q. path p \<and> pathfinish p = pathstart p \<and> path_image p \<subseteq> S \<and> path q \<and> pathfinish q = pathstart q \<and> path_image q \<subseteq> S \<longrightarrow> homotopic_loops S p q) = (\<forall>p q. homotopic_loops S p p \<and> homotopic_loops S q q \<longrightarrow> homotopic_loops S p q)
[PROOF STEP]
by metis


[STATEMENT]
lemma vint_commutative_law_multiplication:
  assumes "x \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>" and "y \<in>\<^sub>\<circ> \<int>\<^sub>\<circ>"
  shows "x *\<^sub>\<int> y = y *\<^sub>\<int> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x *\<^sub>\<int> y = y *\<^sub>\<int> x
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x *\<^sub>\<int> y = y *\<^sub>\<int> x
[PROOF STEP]
have "x' * y' = y' * x'" for x' y' :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x' * y' = y' * x'
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
?x' * ?y' = ?y' * ?x'

goal (1 subgoal):
 1. x *\<^sub>\<int> y = y *\<^sub>\<int> x
[PROOF STEP]
from this[untransferred, OF assms]
[PROOF STATE]
proof (chain)
picking this:
x *\<^sub>\<int> y = y *\<^sub>\<int> x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x *\<^sub>\<int> y = y *\<^sub>\<int> x

goal (1 subgoal):
 1. x *\<^sub>\<int> y = y *\<^sub>\<int> x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x *\<^sub>\<int> y = y *\<^sub>\<int> x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma zero_mat_mult_vector[simp]: "x \<in> carrier_vec nc \<Longrightarrow> 0\<^sub>m nr nc *\<^sub>v x = 0\<^sub>v nr"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier_vec nc \<Longrightarrow> 0\<^sub>m nr nc *\<^sub>v x = 0\<^sub>v nr
[PROOF STEP]
by (intro eq_vecI, auto)


[STATEMENT]
lemma nprv_exi_commute:
assumes [simp]: "x \<in> var" "y \<in> var" "\<phi> \<in> fmla"
shows "nprv {exi x (exi y \<phi>)} (exi y (exi x \<phi>))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {exi x (exi y \<phi>)} (exi y (exi x \<phi>))
[PROOF STEP]
apply(rule nprv_exiE0[of x "exi y \<phi>"], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {exi y \<phi>, exi x (exi y \<phi>)} (exi y (exi x \<phi>))
[PROOF STEP]
apply(rule nprv_clear2_2, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {exi y \<phi>} (exi y (exi x \<phi>))
[PROOF STEP]
apply(rule nprv_exiE0[of y \<phi>], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {\<phi>, exi y \<phi>} (exi y (exi x \<phi>))
[PROOF STEP]
apply(rule nprv_clear2_2, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {\<phi>} (exi y (exi x \<phi>))
[PROOF STEP]
apply(rule nprv_exiI[of _ _ "Var y"], auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nprv {\<phi>} (exi x \<phi>)
[PROOF STEP]
by (rule nprv_exiI[of _ _ "Var x"], auto)


[STATEMENT]
lemma r_comp_is_compose:
  assumes "g \<in> (struct_maps T S)"
  assumes "f \<in> (struct_maps S U)"
  assumes "a \<in> (carrier T)"
  shows "(rcomp (carrier T) f g) a = (f \<circ> g) a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. compose (carrier T) f g a = (f \<circ> g) a
[PROOF STEP]
by (simp add: FuncSet.compose_def assms(3))


[STATEMENT]
lemma realpow_two_binomial_iff: "(f+g::real)\<^sup>2 = f\<^sup>2 + 2*(f*g) + g\<^sup>2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f + g)\<^sup>2 = f\<^sup>2 + 2 * (f * g) + g\<^sup>2
[PROOF STEP]
(*<*)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f + g)\<^sup>2 = f\<^sup>2 + 2 * (f * g) + g\<^sup>2
[PROOF STEP]
by (simp add: power2_eq_square distrib_right distrib_left)


[STATEMENT]
lemma sum_fun_distl:
  fixes f :: "'a \<Rightarrow> 'b::dioid_one_zero"
  assumes "finite (Y :: 'a set)"
  shows "x \<cdot> \<Sum>(f ` Y) = \<Sum>{x \<cdot> f y |y. y \<in> Y}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<cdot> \<Sum> (f ` Y) = \<Sum> {x \<cdot> f y |y. y \<in> Y}
[PROOF STEP]
by (simp add: assms fun_im image_image sum_distl)


[STATEMENT]
lemma (in finite_measure) measure_space_inter:
  assumes events:"s \<in> sets M" "t \<in> sets M"
  assumes "measure M t = measure M (space M)"
  shows "measure M (s \<inter> t) = measure M s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s
[PROOF STEP]
have "measure M ((space M - s) \<union> (space M - t)) = measure M (space M - s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M (space M - s \<union> (space M - t)) = Sigma_Algebra.measure M (space M - s)
[PROOF STEP]
using events assms finite_measure_compl[of "t"]
[PROOF STATE]
proof (prove)
using this:
s \<in> sets M
t \<in> sets M
s \<in> sets M
t \<in> sets M
Sigma_Algebra.measure M t = Sigma_Algebra.measure M (space M)
t \<in> sets M \<Longrightarrow> Sigma_Algebra.measure M (space M - t) = Sigma_Algebra.measure M (space M) - Sigma_Algebra.measure M t

goal (1 subgoal):
 1. Sigma_Algebra.measure M (space M - s \<union> (space M - t)) = Sigma_Algebra.measure M (space M - s)
[PROOF STEP]
by (auto intro!: measure_zero_union)
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (space M - s \<union> (space M - t)) = Sigma_Algebra.measure M (space M - s)

goal (1 subgoal):
 1. Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (space M - s \<union> (space M - t)) = Sigma_Algebra.measure M (space M - s)

goal (1 subgoal):
 1. Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s
[PROOF STEP]
have "(space M - s) \<union> (space M - t) = space M - (s \<inter> t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space M - s \<union> (space M - t) = space M - s \<inter> t
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
space M - s \<union> (space M - t) = space M - s \<inter> t

goal (1 subgoal):
 1. Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Sigma_Algebra.measure M (space M - s \<inter> t) = Sigma_Algebra.measure M (space M - s)
[PROOF STEP]
show "measure M (s \<inter> t) = measure M s"
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (space M - s \<inter> t) = Sigma_Algebra.measure M (space M - s)

goal (1 subgoal):
 1. Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s
[PROOF STEP]
using events
[PROOF STATE]
proof (prove)
using this:
Sigma_Algebra.measure M (space M - s \<inter> t) = Sigma_Algebra.measure M (space M - s)
s \<in> sets M
t \<in> sets M

goal (1 subgoal):
 1. Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s
[PROOF STEP]
by (auto intro!: measure_eq_compl[of "s \<inter> t" s])
[PROOF STATE]
proof (state)
this:
Sigma_Algebra.measure M (s \<inter> t) = Sigma_Algebra.measure M s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma prime_ge_1_nat: "prime p \<Longrightarrow> p \<ge> (1::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prime p \<Longrightarrow> 1 \<le> p
[PROOF STEP]
using prime_ge_2_nat [of p]
[PROOF STATE]
proof (prove)
using this:
prime p \<Longrightarrow> 2 \<le> p

goal (1 subgoal):
 1. prime p \<Longrightarrow> 1 \<le> p
[PROOF STEP]
by simp


[STATEMENT]
lemma interior_rel_interior:
  fixes S :: "'n::euclidean_space set"
  assumes "aff_dim S = int(DIM('n))"
  shows "rel_interior S = interior S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rel_interior S = interior S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rel_interior S = interior S
[PROOF STEP]
have "affine hull S = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. affine hull S = UNIV
[PROOF STEP]
using assms affine_hull_UNIV[of S]
[PROOF STATE]
proof (prove)
using this:
aff_dim S = int DIM('n)
aff_dim S = int DIM('n) \<Longrightarrow> affine hull S = UNIV

goal (1 subgoal):
 1. affine hull S = UNIV
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
affine hull S = UNIV

goal (1 subgoal):
 1. rel_interior S = interior S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
affine hull S = UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
affine hull S = UNIV

goal (1 subgoal):
 1. rel_interior S = interior S
[PROOF STEP]
unfolding rel_interior interior_def
[PROOF STATE]
proof (prove)
using this:
affine hull S = UNIV

goal (1 subgoal):
 1. {x \<in> S. \<exists>T. open T \<and> x \<in> T \<and> T \<inter> affine hull S \<subseteq> S} = \<Union> {T. open T \<and> T \<subseteq> S}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
rel_interior S = interior S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma order_lesseq_imp:
  "(\<forall>z . x \<le> z \<longrightarrow> y \<le> z) \<longleftrightarrow> y \<le> x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>z\<ge>x. y \<le> z) = (y \<le> x)
[PROOF STEP]
using order_trans
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<le> ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x \<le> ?z

goal (1 subgoal):
 1. (\<forall>z\<ge>x. y \<le> z) = (y \<le> x)
[PROOF STEP]
by blast


[STATEMENT]
lemma powr_le1: "0 \<le> a \<Longrightarrow> 0 \<le> x \<Longrightarrow> x \<le> 1 \<Longrightarrow> x powr a \<le> 1"
  for x :: real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; 0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> x powr a \<le> 1
[PROOF STEP]
using powr_mono2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> ?a; 0 \<le> ?x; ?x \<le> ?y\<rbrakk> \<Longrightarrow> ?x powr ?a \<le> ?y powr ?a

goal (1 subgoal):
 1. \<lbrakk>0 \<le> a; 0 \<le> x; x \<le> 1\<rbrakk> \<Longrightarrow> x powr a \<le> 1
[PROOF STEP]
by fastforce


[STATEMENT]
lemma subtopology_eq_discrete_topology_gen_finite:
   "\<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> subtopology X S = discrete_topology(topspace X \<inter> S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t1_space X; finite S\<rbrakk> \<Longrightarrow> subtopology X S = discrete_topology (topspace X \<inter> S)
[PROOF STEP]
by (simp add: subtopology_eq_discrete_topology_gen t1_space_derived_set_of_finite)


[STATEMENT]
lemma cauchy_filter_metric_filtermap:
  fixes f :: "'a \<Rightarrow> 'b::{uniformity_dist,uniform_space}"
  shows "cauchy_filter (filtermap f F) \<longleftrightarrow> (\<forall>e. e>0 \<longrightarrow> (\<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cauchy_filter (filtermap f F) = (\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e))
[PROOF STEP]
proof (subst cauchy_filter_metric, intro iffI allI impI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)
 2. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
assume \<open>\<forall>e>0. \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)\<close>
[PROOF STATE]
proof (state)
this:
\<forall>e>0. \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)

goal (2 subgoals):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)
 2. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>e>0. \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
show \<open>e>0 \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)\<close> for e
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)

goal (1 subgoal):
 1. 0 < e \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)
[PROOF STEP]
unfolding eventually_filtermap
[PROOF STATE]
proof (prove)
using this:
\<forall>e>0. \<exists>P. (\<forall>\<^sub>F x in F. P (f x)) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)

goal (1 subgoal):
 1. 0 < e \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
0 < ?e \<Longrightarrow> \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < ?e)

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
assume asm: \<open>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)\<close>
[PROOF STATE]
proof (state)
this:
\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
fix e::real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
assume \<open>e > 0\<close>
[PROOF STATE]
proof (state)
this:
0 < e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 < e
[PROOF STEP]
obtain P where \<open>eventually P F\<close> and PPe: \<open>P x \<and> P y \<longrightarrow> dist (f x) (f y) < e\<close> for x y
[PROOF STATE]
proof (prove)
using this:
0 < e

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>eventually P F; \<And>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
0 < e
\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e)

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>eventually P F; \<And>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
eventually P F
P ?x \<and> P ?y \<longrightarrow> dist (f ?x) (f ?y) < e

goal (1 subgoal):
 1. \<And>e. \<lbrakk>\<forall>e>0. \<exists>P. eventually P F \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e); 0 < e\<rbrakk> \<Longrightarrow> \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
show \<open>\<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)
[PROOF STEP]
apply (rule exI[of _ \<open>\<lambda>x. \<exists>y. P y \<and> x = f y\<close>])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>\<^sub>F Pa in filtermap f F. \<exists>y. P y \<and> Pa = f y) \<and> (\<forall>x y. (\<exists>y. P y \<and> x = f y) \<and> (\<exists>ya. P ya \<and> y = f ya) \<longrightarrow> dist x y < e)
[PROOF STEP]
using PPe \<open>eventually P F\<close>
[PROOF STATE]
proof (prove)
using this:
P ?x \<and> P ?y \<longrightarrow> dist (f ?x) (f ?y) < e
eventually P F

goal (1 subgoal):
 1. (\<forall>\<^sub>F Pa in filtermap f F. \<exists>y. P y \<and> Pa = f y) \<and> (\<forall>x y. (\<exists>y. P y \<and> x = f y) \<and> (\<exists>ya. P ya \<and> y = f ya) \<longrightarrow> dist x y < e)
[PROOF STEP]
apply (auto simp: eventually_filtermap)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x y. P x \<and> P y \<longrightarrow> dist (f x) (f y) < e; eventually P F\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F x in F. \<exists>y. P y \<and> f x = f y
[PROOF STEP]
by (smt (verit, ccfv_SIG) eventually_elim2)
[PROOF STATE]
proof (state)
this:
\<exists>P. eventually P (filtermap f F) \<and> (\<forall>x y. P x \<and> P y \<longrightarrow> dist x y < e)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma borel_eq_halfspace_ge:
  "borel = sigma UNIV ((\<lambda> (a, i). {x::'a::euclidean_space. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis))"
  (is "_ = ?SIGMA")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. borel = sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis))
[PROOF STEP]
proof (rule borel_eq_sigmaI2[OF borel_eq_halfspace_less])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. x \<bullet> i < a} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))
 2. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. a \<le> x \<bullet> i} \<in> sets borel
[PROOF STEP]
fix a :: real and i :: 'a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. x \<bullet> i < a} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))
 2. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. a \<le> x \<bullet> i} \<in> sets borel
[PROOF STEP]
assume i: "(a, i) \<in> UNIV \<times> Basis"
[PROOF STATE]
proof (state)
this:
(a, i) \<in> UNIV \<times> Basis

goal (2 subgoals):
 1. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. x \<bullet> i < a} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))
 2. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. a \<le> x \<bullet> i} \<in> sets borel
[PROOF STEP]
have *: "{x::'a. x\<bullet>i < a} = space ?SIGMA - {x::'a. a \<le> x\<bullet>i}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x \<bullet> i < a} = space (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis))) - {x. a \<le> x \<bullet> i}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{x. x \<bullet> i < a} = space (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis))) - {x. a \<le> x \<bullet> i}

goal (2 subgoals):
 1. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. x \<bullet> i < a} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))
 2. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. a \<le> x \<bullet> i} \<in> sets borel
[PROOF STEP]
show "{x. x\<bullet>i < a} \<in> ?SIGMA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x. x \<bullet> i < a} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))
[PROOF STEP]
unfolding *
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. space (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis))) - {x. a \<le> x \<bullet> i} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))
[PROOF STEP]
using i
[PROOF STATE]
proof (prove)
using this:
(a, i) \<in> UNIV \<times> Basis

goal (1 subgoal):
 1. space (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis))) - {x. a \<le> x \<bullet> i} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))
[PROOF STEP]
by (intro sets.compl_sets) auto
[PROOF STATE]
proof (state)
this:
{x. x \<bullet> i < a} \<in> sets (sigma UNIV ((\<lambda>(a, i). {x. a \<le> x \<bullet> i}) ` (UNIV \<times> Basis)))

goal (1 subgoal):
 1. \<And>a i. (a, i) \<in> UNIV \<times> Basis \<Longrightarrow> {x. a \<le> x \<bullet> i} \<in> sets borel
[PROOF STEP]
qed auto


[STATEMENT]
lemma closed_buffon_set [simp, intro, measurable]: "closed Buffon_set"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed Buffon_set
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. closed Buffon_set
[PROOF STEP]
have "Buffon_set = ({-d/2..d/2} \<times> {-pi..pi}) \<inter>
          (\<lambda>z. abs (fst z) + abs (sin (snd z)) * l / 2 - d / 2) -` {0..}"
    (is "_ = ?A")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Buffon_set = {- d / 2..d / 2} \<times> {- pi..pi} \<inter> (\<lambda>z. \<bar>fst z\<bar> + \<bar>sin (snd z)\<bar> * l / 2 - d / 2) -` {0..}
[PROOF STEP]
unfolding Buffon_set_altdef2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(x, \<phi>). (x, \<phi>) \<in> {- d / 2..d / 2} \<times> {- pi..pi} \<and> d / 2 - \<bar>sin \<phi>\<bar> * l / 2 \<le> \<bar>x\<bar>} = {- d / 2..d / 2} \<times> {- pi..pi} \<inter> (\<lambda>z. \<bar>fst z\<bar> + \<bar>sin (snd z)\<bar> * l / 2 - d / 2) -` {0..}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Buffon_set = {- d / 2..d / 2} \<times> {- pi..pi} \<inter> (\<lambda>z. \<bar>fst z\<bar> + \<bar>sin (snd z)\<bar> * l / 2 - d / 2) -` {0..}

goal (1 subgoal):
 1. closed Buffon_set
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Buffon_set = {- d / 2..d / 2} \<times> {- pi..pi} \<inter> (\<lambda>z. \<bar>fst z\<bar> + \<bar>sin (snd z)\<bar> * l / 2 - d / 2) -` {0..}

goal (1 subgoal):
 1. closed Buffon_set
[PROOF STEP]
have "closed \<dots>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed ({- d / 2..d / 2} \<times> {- pi..pi} \<inter> (\<lambda>z. \<bar>fst z\<bar> + \<bar>sin (snd z)\<bar> * l / 2 - d / 2) -` {0..})
[PROOF STEP]
by (intro closed_Int closed_vimage closed_Times) (auto intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
closed ({- d / 2..d / 2} \<times> {- pi..pi} \<inter> (\<lambda>z. \<bar>fst z\<bar> + \<bar>sin (snd z)\<bar> * l / 2 - d / 2) -` {0..})

goal (1 subgoal):
 1. closed Buffon_set
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
closed Buffon_set
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closed Buffon_set

goal (1 subgoal):
 1. closed Buffon_set
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
closed Buffon_set

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Sup_empty [simp]: "\<Squnion>{} = (0::V)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> {} = 0
[PROOF STEP]
using Sup_V_def
[PROOF STATE]
proof (prove)
using this:
\<Squnion> ?X \<equiv> if small ?X then set (\<Union> (elts ` ?X)) else 0

goal (1 subgoal):
 1. \<Squnion> {} = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma numeral_poly: "numeral n = [:numeral n:]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral n = [:numeral n:]
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. numeral n = [:numeral n:]
[PROOF STEP]
have "numeral n = of_nat (numeral n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. numeral n = of_nat (numeral n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
numeral n = of_nat (numeral n)

goal (1 subgoal):
 1. numeral n = [:numeral n:]
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
numeral n = of_nat (numeral n)

goal (1 subgoal):
 1. numeral n = [:numeral n:]
[PROOF STEP]
have "\<dots> = [:of_nat (numeral n):]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. of_nat (numeral n) = [:of_nat (numeral n):]
[PROOF STEP]
by (simp add: of_nat_poly)
[PROOF STATE]
proof (state)
this:
of_nat (numeral n) = [:of_nat (numeral n):]

goal (1 subgoal):
 1. numeral n = [:numeral n:]
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
numeral n = [:of_nat (numeral n):]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
numeral n = [:of_nat (numeral n):]

goal (1 subgoal):
 1. numeral n = [:numeral n:]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
numeral n = [:numeral n:]

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma twice_field_differentiable_at_exp_fun [simp, intro]:
  assumes "f twice_field_differentiable_at x"
  shows "(\<lambda>x. exp (f x)) twice_field_differentiable_at x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. exp (f x)) twice_field_differentiable_at x
[PROOF STEP]
by (simp add: assms twice_field_differentiable_at_compose)


[STATEMENT]
lemma fps_ln_nth: "fps_ln c $ n = (if n = 0 then 0 else 1/c * ((- 1) ^ (n - 1) / of_nat n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_ln c $ n = (if n = 0 then 0::'a else (1::'a) / c * ((- (1::'a)) ^ (n - 1) / of_nat n))
[PROOF STEP]
by (simp add: fps_ln_def field_simps)


[STATEMENT]
lemma expected_utility_weak_preference:
  assumes "p \<in> lotteries_on outcomes"
    and "q \<in> lotteries_on outcomes"
  shows   "p \<succeq>[relation] q \<longleftrightarrow> (\<Sum>z\<in>outcomes. (pmf p z) * (u z)) \<ge> (\<Sum>z\<in>outcomes. (pmf q z) * (u z))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p \<succeq> q = ((\<Sum>z\<in>outcomes. pmf q z * u z) \<le> (\<Sum>z\<in>outcomes. pmf p z * u z))
[PROOF STEP]
using sum_equals_pmf_expectation[of p, OF assms(1)]
        sum_equals_pmf_expectation[of q, OF assms(2)]
   vNM_utility_def assms(1) assms(2) util_def_conf
[PROOF STATE]
proof (prove)
using this:
(\<Sum>z\<in>outcomes. pmf p z * u z) = measure_pmf.expectation p u
(\<Sum>z\<in>outcomes. pmf q z * u z) = measure_pmf.expectation q u
vNM_utility ?outcomes ?relation ?u \<equiv> ?relation \<subseteq> \<P> ?outcomes \<times> \<P> ?outcomes \<and> (\<forall>p q. p \<in> \<P> ?outcomes \<longrightarrow> q \<in> \<P> ?outcomes \<longrightarrow> p \<succeq>[?relation] q = (measure_pmf.expectation q ?u \<le> measure_pmf.expectation p ?u))
p \<in> \<P> outcomes
q \<in> \<P> outcomes
\<lbrakk>?x \<in> \<P> outcomes; ?y \<in> \<P> outcomes\<rbrakk> \<Longrightarrow> (measure_pmf.expectation ?y u \<le> measure_pmf.expectation ?x u) = ?x \<succeq> ?y

goal (1 subgoal):
 1. p \<succeq> q = ((\<Sum>z\<in>outcomes. pmf q z * u z) \<le> (\<Sum>z\<in>outcomes. pmf p z * u z))
[PROOF STEP]
by presburger


[STATEMENT]
theorem complete_infl_mono_imp_ex_qfp:
  assumes comp: "UNIV-complete A (\<sqsubseteq>)" and infl_mono: "\<forall>a\<in>A. a \<sqsubseteq> f a \<or> (\<forall>b\<in>A. b \<sqsubseteq> a \<longrightarrow> f b \<sqsubseteq> f a)"
  shows "\<exists>s\<in>A. f s \<sim> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>s\<in>A. f s \<sim> s
[PROOF STEP]
apply (rule ex_qfp[OF comp _ infl_mono])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. C \<in> UNIV
[PROOF STEP]
by auto


[STATEMENT]
lemma uminus_uminus_vec[simp]: "- (- (v::'a:: group_add vec)) = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (- v) = v
[PROOF STEP]
by auto


[STATEMENT]
lemma atLeastAtMost_singleton':
  assumes "a = b"
  shows "{a\<le>\<^sub>a..\<le>\<^sub>ab} = {a}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a\<le>\<^sub>a..\<le>\<^sub>ab} = {a}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a = b

goal (1 subgoal):
 1. {a\<le>\<^sub>a..\<le>\<^sub>ab} = {a}
[PROOF STEP]
by simp


[STATEMENT]
lemma dg_prod_Dom_app_component_app[dg_cs_simps]:
  assumes "f \<in>\<^sub>\<circ> (\<Prod>\<^sub>D\<^sub>Gi\<in>\<^sub>\<circ>I. \<AA> i)\<lparr>Arr\<rparr>" and "i \<in>\<^sub>\<circ> I"
  shows "(\<Prod>\<^sub>D\<^sub>Gi\<in>\<^sub>\<circ>I. \<AA> i)\<lparr>Dom\<rparr>\<lparr>f\<rparr>\<lparr>i\<rparr> = \<AA> i\<lparr>Dom\<rparr>\<lparr>f\<lparr>i\<rparr>\<rparr>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dg_prod I \<AA>\<lparr>Dom\<rparr>\<lparr>f\<rparr>\<lparr>i\<rparr> = \<AA> i\<lparr>Dom\<rparr>\<lparr>f\<lparr>i\<rparr>\<rparr>
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
i \<in>\<^sub>\<circ> I

goal (1 subgoal):
 1. dg_prod I \<AA>\<lparr>Dom\<rparr>\<lparr>f\<rparr>\<lparr>i\<rparr> = \<AA> i\<lparr>Dom\<rparr>\<lparr>f\<lparr>i\<rparr>\<rparr>
[PROOF STEP]
unfolding dg_prod_Dom_app[OF assms(1)]
[PROOF STATE]
proof (prove)
using this:
i \<in>\<^sub>\<circ> I

goal (1 subgoal):
 1. (\<lambda>i\<in>\<^sub>\<circ>I. \<AA> i\<lparr>Dom\<rparr>\<lparr>f\<lparr>i\<rparr>\<rparr>)\<lparr>i\<rparr> = \<AA> i\<lparr>Dom\<rparr>\<lparr>f\<lparr>i\<rparr>\<rparr>
[PROOF STEP]
by simp


[STATEMENT]
lemma tendsto_enn2real [tendsto_intros]:
  assumes "(u \<longlongrightarrow> ennreal l) F" "l \<ge> 0"
  shows "((\<lambda>n. enn2real (u n)) \<longlongrightarrow> l) F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. enn2real (u n)) \<longlongrightarrow> l) F
[PROOF STEP]
unfolding enn2real_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>n. real_of_ereal (enn2ereal (u n))) \<longlongrightarrow> l) F
[PROOF STEP]
by (metis assms enn2ereal_ennreal lim_real_of_ereal tendsto_enn2erealI)


[STATEMENT]
lemma monomial_power: "(monomial c t) ^ n = monomial (c ^ n) (\<Sum>i=0..<n. t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomial c t ^ n = monomial (c ^ n) (\<Sum>i = 0..<n. t)
[PROOF STEP]
by (induct n, simp_all add: mult_single monom_mult_monomial add.commute)


[STATEMENT]
lemma FV_and_cofinite: "\<lbrakk> \<forall>x. x \<notin> L \<longrightarrow> P x; finite L \<rbrakk>
  \<Longrightarrow> \<exists>L'. (finite L' \<and> FV t \<subseteq> L' \<and> (\<forall> x. x \<notin> L' \<longrightarrow> P x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>x. x \<notin> L \<longrightarrow> P x; finite L\<rbrakk> \<Longrightarrow> \<exists>L'. finite L' \<and> FV t \<subseteq> L' \<and> (\<forall>x. x \<notin> L' \<longrightarrow> P x)
[PROOF STEP]
by (rule_tac x = "L \<union> FV t" in exI, auto)


[STATEMENT]
lemma span_closed_sum_list: "(\<And>x. x \<in> set xs \<Longrightarrow> x \<in> span B) \<Longrightarrow> sum_list xs \<in> span B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> x \<in> span B) \<Longrightarrow> sum_list xs \<in> span B
[PROOF STEP]
by (induct xs) (auto intro: span_zero span_add)


[STATEMENT]
lemma columns_Gram_Schmidt_matrix_rw:
  "{column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}
  = {column i (Gram_Schmidt_upt_k A (ncols A - 1)) |i. to_nat i\<le> (ncols A - 1)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV} = {column i (Gram_Schmidt_upt_k A (ncols A - 1)) |i. mod_type_class.to_nat i \<le> ncols A - 1}
[PROOF STEP]
proof (auto)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. \<exists>ia. column i (Gram_Schmidt_matrix A) = column ia (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> mod_type_class.to_nat ia \<le> ncols A - Suc 0
 2. \<And>i. mod_type_class.to_nat i \<le> ncols A - Suc 0 \<Longrightarrow> \<exists>ia. column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) = column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
fix i
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>i. \<exists>ia. column i (Gram_Schmidt_matrix A) = column ia (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> mod_type_class.to_nat ia \<le> ncols A - Suc 0
 2. \<And>i. mod_type_class.to_nat i \<le> ncols A - Suc 0 \<Longrightarrow> \<exists>ia. column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) = column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
show "\<exists>ia. column i (Gram_Schmidt_matrix A)
    = column ia (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> to_nat ia \<le> ncols A - Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ia. column i (Gram_Schmidt_matrix A) = column ia (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> mod_type_class.to_nat ia \<le> ncols A - Suc 0
[PROOF STEP]
apply (rule exI[of _ i])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (Gram_Schmidt_matrix A) = column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> mod_type_class.to_nat i \<le> ncols A - Suc 0
[PROOF STEP]
unfolding Gram_Schmidt_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (ncols A - 1)) = column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> mod_type_class.to_nat i \<le> ncols A - Suc 0
[PROOF STEP]
using to_nat_less_card[of i]
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat i < CARD('c)

goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (ncols A - 1)) = column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> mod_type_class.to_nat i \<le> ncols A - Suc 0
[PROOF STEP]
unfolding ncols_def
[PROOF STATE]
proof (prove)
using this:
mod_type_class.to_nat i < CARD('c)

goal (1 subgoal):
 1. column i (Gram_Schmidt_upt_k A (CARD('c) - 1)) = column i (Gram_Schmidt_upt_k A (CARD('c) - Suc 0)) \<and> mod_type_class.to_nat i \<le> CARD('c) - Suc 0
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>ia. column i (Gram_Schmidt_matrix A) = column ia (Gram_Schmidt_upt_k A (ncols A - Suc 0)) \<and> mod_type_class.to_nat ia \<le> ncols A - Suc 0

goal (1 subgoal):
 1. \<And>i. mod_type_class.to_nat i \<le> ncols A - Suc 0 \<Longrightarrow> \<exists>ia. column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) = column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
show "\<exists>ia. column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) = column ia (Gram_Schmidt_matrix A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ia. column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) = column ia (Gram_Schmidt_matrix A)
[PROOF STEP]
unfolding Gram_Schmidt_matrix_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>ia. column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) = column ia (Gram_Schmidt_upt_k A (ncols A - 1))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>ia. column i (Gram_Schmidt_upt_k A (ncols A - Suc 0)) = column ia (Gram_Schmidt_matrix A)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma senior_states_card_less:
  "card (senior_states p n) \<le> card (senior_states q n) \<longleftrightarrow> senior_states p n \<subseteq> senior_states q n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (card (senior_states p n) \<le> card (senior_states q n)) = (senior_states p n \<subseteq> senior_states q n)
[PROOF STEP]
by (metis card_mono card_seteq senior_states_cases_subseteq senior_states_finite)


[STATEMENT]
lemma has_measure_differentiable_image:
  fixes f :: "real^'n::{finite,wellorder} \<Rightarrow> real^'n::_"
  assumes "S \<in> sets lebesgue"
      and "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f' x) (at x within S)"
      and "inj_on f S"
  shows "f ` S \<in> lmeasurable \<and> measure lebesgue (f ` S) = m
     \<longleftrightarrow> ((\<lambda>x. \<bar>det (matrix (f' x))\<bar>) has_integral m) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f ` S \<in> lmeasurable \<and> Sigma_Algebra.measure lebesgue (f ` S) = m) = ((\<lambda>x. \<bar>det (matrix (f' x))\<bar>) has_integral m) S
[PROOF STEP]
using has_absolute_integral_change_of_variables [OF assms, of "\<lambda>x. (1::real^1)" "vec m"]
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> S \<Longrightarrow> x \<in> S) \<Longrightarrow> ((\<lambda>x. \<bar>det (matrix (f' x))\<bar> *\<^sub>R 1) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>det (matrix (f' x))\<bar> *\<^sub>R 1) = vec m) = ((\<lambda>x. 1) absolutely_integrable_on f ` S \<and> integral (f ` S) (\<lambda>x. 1) = vec m)

goal (1 subgoal):
 1. (f ` S \<in> lmeasurable \<and> Sigma_Algebra.measure lebesgue (f ` S) = m) = ((\<lambda>x. \<bar>det (matrix (f' x))\<bar>) has_integral m) S
[PROOF STEP]
unfolding absolutely_integrable_on_1_iff integral_on_1_eq integrable_on_1_iff absolutely_integrable_on_def
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> S \<Longrightarrow> x \<in> S) \<Longrightarrow> (((\<lambda>x. (\<bar>det (matrix (f' x))\<bar> *\<^sub>R 1) $ 1) integrable_on S \<and> (\<lambda>x. norm ((\<bar>det (matrix (f' x))\<bar> *\<^sub>R 1) $ 1)) integrable_on S) \<and> vec (integral S (\<lambda>x. (\<bar>det (matrix (f' x))\<bar> *\<^sub>R 1) $ 1)) = vec m) = (((\<lambda>x. 1 $ 1) integrable_on f ` S \<and> (\<lambda>x. norm (1 $ 1)) integrable_on f ` S) \<and> vec (integral (f ` S) (\<lambda>x. 1 $ 1)) = vec m)

goal (1 subgoal):
 1. (f ` S \<in> lmeasurable \<and> Sigma_Algebra.measure lebesgue (f ` S) = m) = ((\<lambda>x. \<bar>det (matrix (f' x))\<bar>) has_integral m) S
[PROOF STEP]
by (auto simp: has_integral_iff lmeasurable_iff_integrable_on lmeasure_integral)


[STATEMENT]
lemma scalar_prod_inc_vec_inter_num:
  assumes "j1 < \<b>" "j2 < \<b>"
  shows "(col N j1) \<bullet> (col N j2) = (\<B>s ! j1) |\<inter>| (\<B>s ! j2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. col N j1 \<bullet> col N j2 = int (\<B>s ! j1 |\<inter>| \<B>s ! j2)
[PROOF STEP]
using scalar_prod_inc_vec_mat_inter_num assms N_carrier_mat
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?j1.0 < dim_col N; ?j2.0 < dim_col N\<rbrakk> \<Longrightarrow> col N ?j1.0 \<bullet> col N ?j2.0 = int (mat_inter_num N ?j1.0 ?j2.0)
j1 < \<b>
j2 < \<b>
N \<in> carrier_mat \<v> \<b>

goal (1 subgoal):
 1. col N j1 \<bullet> col N j2 = int (\<B>s ! j1 |\<inter>| \<B>s ! j2)
[PROOF STEP]
by (simp add: mat_inter_num_conv)


[STATEMENT]
lemma mul_eq_trans: assumes "trans r" and "(M,N) \<in> mul_eq r" and "(N,P) \<in> mul_eq r" shows "(M,P) \<in> mul_eq r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (M, P) \<in> mul_eq r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
trans r
(M, N) \<in> mul_eq r
(N, P) \<in> mul_eq r

goal (1 subgoal):
 1. (M, P) \<in> mul_eq r
[PROOF STEP]
unfolding mult_eq_is_mul_eq[symmetric,OF assms(1)] mult_eq_def
[PROOF STATE]
proof (prove)
using this:
trans r
(M, N) \<in> (mult1 r)\<^sup>*
(N, P) \<in> (mult1 r)\<^sup>*

goal (1 subgoal):
 1. (M, P) \<in> (mult1 r)\<^sup>*
[PROOF STEP]
by auto


[STATEMENT]
lemma isometry_preserves_infdist:
  "infdist (f x) (f`A) = infdist x A"
  if "isometry_on X f" "A \<subseteq> X" "x \<in> X"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infdist (f x) (f ` A) = infdist x A
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
isometry_on X f
A \<subseteq> X
x \<in> X

goal (1 subgoal):
 1. infdist (f x) (f ` A) = infdist x A
[PROOF STEP]
by (simp add: infdist_def image_comp isometry_on_def subset_iff)


[STATEMENT]
lemma ennreal_sum: shows "finite A \<Longrightarrow> (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in> A. ennreal (f a)) = ennreal (\<Sum>a\<in> A. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>A. ennreal (f a)) = ennreal (sum f A)
[PROOF STEP]
proof (induct rule:finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>{}. ennreal (f a)) = ennreal (sum f {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
0 \<le> f ?a

goal (2 subgoals):
 1. (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>{}. ennreal (f a)) = ennreal (sum f {})
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
0 \<le> f ?a

goal (1 subgoal):
 1. (\<Sum>a\<in>{}. ennreal (f a)) = ennreal (sum f {})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>{}. ennreal (f a)) = ennreal (sum f {})

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
(\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>A. ennreal (f a)) = ennreal (sum f A)
0 \<le> f ?a

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
have "(\<Sum>a\<in> (insert a A). ennreal (f a)) = ennreal (f a) + (\<Sum>a\<in> A. ennreal (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>a\<in>insert a A. ennreal (f a)) = ennreal (f a) + (\<Sum>a\<in>A. ennreal (f a))
[PROOF STEP]
by (simp add: insert.hyps(1) insert.hyps(2))
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>insert a A. ennreal (f a)) = ennreal (f a) + (\<Sum>a\<in>A. ennreal (f a))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>insert a A. ennreal (f a)) = ennreal (f a) + (\<Sum>a\<in>A. ennreal (f a))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
have "... = ennreal (f a) + ennreal (\<Sum>a\<in> A. f a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (f a) + (\<Sum>a\<in>A. ennreal (f a)) = ennreal (f a) + ennreal (sum f A)
[PROOF STEP]
by (simp add: insert.prems)
[PROOF STATE]
proof (state)
this:
ennreal (f a) + (\<Sum>a\<in>A. ennreal (f a)) = ennreal (f a) + ennreal (sum f A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (f a) + (\<Sum>a\<in>A. ennreal (f a)) = ennreal (f a) + ennreal (sum f A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
have "... = ennreal (f a + (\<Sum>a\<in> A. f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (f a) + ennreal (sum f A) = ennreal (f a + sum f A)
[PROOF STEP]
by (simp add: insert.prems sum_nonneg)
[PROOF STATE]
proof (state)
this:
ennreal (f a) + ennreal (sum f A) = ennreal (f a + sum f A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
ennreal (f a) + ennreal (sum f A) = ennreal (f a + sum f A)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
have "... = ennreal (\<Sum>a\<in> (insert a A). (f a))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ennreal (f a + sum f A) = ennreal (sum f (insert a A))
[PROOF STEP]
using insert.hyps(1) insert.hyps(2)
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A

goal (1 subgoal):
 1. ennreal (f a + sum f A) = ennreal (sum f (insert a A))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
ennreal (f a + sum f A) = ennreal (sum f (insert a A))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>a. 0 \<le> f a) \<Longrightarrow> (\<Sum>a\<in>F. ennreal (f a)) = ennreal (sum f F); \<And>a. 0 \<le> f a\<rbrakk> \<Longrightarrow> (\<Sum>a\<in>insert x F. ennreal (f a)) = ennreal (sum f (insert x F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>a\<in>insert a A. ennreal (f a)) = ennreal (sum f (insert a A))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(\<Sum>a\<in>insert a A. ennreal (f a)) = ennreal (sum f (insert a A))

goal (1 subgoal):
 1. (\<Sum>a\<in>insert a A. ennreal (f a)) = ennreal (sum f (insert a A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<Sum>a\<in>insert a A. ennreal (f a)) = ennreal (sum f (insert a A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cindex_poly_mod:
  fixes p q::"real poly"
  shows "cindex_poly a b q p =  cindex_poly a b (q mod p) p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cindex_poly a b q p = cindex_poly a b (q mod p) p
[PROOF STEP]
unfolding cindex_poly_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly q p x) = (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly (q mod p) p x)
[PROOF STEP]
using jump_poly_mod
[PROOF STATE]
proof (prove)
using this:
jump_poly ?q ?p ?x = jump_poly (?q mod ?p) ?p ?x

goal (1 subgoal):
 1. (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly q p x) = (\<Sum>x | poly p x = 0 \<and> a < x \<and> x < b. jump_poly (q mod p) p x)
[PROOF STEP]
by auto


[STATEMENT]
lemma not_equiv_funI:
  assumes "\<And>c\<^sub>1 c\<^sub>2 n. c\<^sub>1 > 0 \<Longrightarrow> c\<^sub>2 > 0 \<Longrightarrow>
    \<exists>m>n. c\<^sub>1 * f m < g m \<or> c\<^sub>2 * g m < f m"
  shows "\<not> f \<cong> g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> f \<cong> g
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?c\<^sub>1; 0 < ?c\<^sub>2\<rbrakk> \<Longrightarrow> \<exists>m>?n. ?c\<^sub>1 * f m < g m \<or> ?c\<^sub>2 * g m < f m

goal (1 subgoal):
 1. \<not> f \<cong> g
[PROOF STEP]
unfolding equiv_fun_def linorder_not_le [symmetric]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<not> ?c\<^sub>1 \<le> 0; \<not> ?c\<^sub>2 \<le> 0\<rbrakk> \<Longrightarrow> \<exists>m. \<not> m \<le> ?n \<and> (\<not> g m \<le> ?c\<^sub>1 * f m \<or> \<not> f m \<le> ?c\<^sub>2 * g m)

goal (1 subgoal):
 1. \<nexists>c\<^sub>1. \<not> c\<^sub>1 \<le> 0 \<and> (\<exists>c\<^sub>2. \<not> c\<^sub>2 \<le> 0 \<and> (\<exists>n. \<forall>m. \<not> m \<le> n \<longrightarrow> f m \<le> c\<^sub>1 * g m \<and> g m \<le> c\<^sub>2 * f m))
[PROOF STEP]
by blast


[STATEMENT]
lemma sin_expansion_lemma: "sin (x + real (Suc m) * pi / 2) = cos (x + real m * pi / 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin (x + real (Suc m) * pi / 2) = cos (x + real m * pi / 2)
[PROOF STEP]
by (auto simp: cos_add sin_add add_divide_distrib distrib_right)


[STATEMENT]
lemma fps_conv_radius_add: "fps_conv_radius (f + g) \<ge> min (fps_conv_radius f) (fps_conv_radius g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (fps_conv_radius f) (fps_conv_radius g) \<le> fps_conv_radius (f + g)
[PROOF STEP]
unfolding fps_conv_radius_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (conv_radius (fps_nth f)) (conv_radius (fps_nth g)) \<le> conv_radius (fps_nth (f + g))
[PROOF STEP]
using conv_radius_add_ge[of "fps_nth f" "fps_nth g"]
[PROOF STATE]
proof (prove)
using this:
min (conv_radius (fps_nth f)) (conv_radius (fps_nth g)) \<le> conv_radius (\<lambda>x. fps_nth f x + fps_nth g x)

goal (1 subgoal):
 1. min (conv_radius (fps_nth f)) (conv_radius (fps_nth g)) \<le> conv_radius (fps_nth (f + g))
[PROOF STEP]
by simp


[STATEMENT]
lemma (in finite_measure) finite_measure_eq_sum_singleton:
  assumes "finite S" and *: "\<And>x. x \<in> S \<Longrightarrow> {x} \<in> sets M"
  shows "measure M S = (\<Sum>x\<in>S. measure M {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Sigma_Algebra.measure M S = (\<Sum>x\<in>S. Sigma_Algebra.measure M {x})
[PROOF STEP]
using measure_eq_sum_singleton[OF assms]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> S \<Longrightarrow> x \<in> S; \<And>x. x \<in> S \<Longrightarrow> emeasure M {x} \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> Sigma_Algebra.measure M S = (\<Sum>x\<in>S. Sigma_Algebra.measure M {x})

goal (1 subgoal):
 1. Sigma_Algebra.measure M S = (\<Sum>x\<in>S. Sigma_Algebra.measure M {x})
[PROOF STEP]
by simp


[STATEMENT]
lemma subset_Collect_iff: "B \<subseteq> A \<Longrightarrow> (B \<subseteq> {x \<in> A. P x}) = (\<forall>x \<in> B. P x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B \<subseteq> A \<Longrightarrow> (B \<subseteq> {x \<in> A. P x}) = (\<forall>x\<in>B. P x)
[PROOF STEP]
by blast


[STATEMENT]
lemma Suci_div_s_2:"\<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i mod s < s - Suc 0\<rbrakk>
         \<Longrightarrow> Suc i div s = i div s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i mod s < s - Suc 0\<rbrakk> \<Longrightarrow> Suc i div s = i div s
[PROOF STEP]
apply (rule div_Tr3_2 [THEN sym], assumption+)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < r; 0 < s; i \<le> r * s - Suc 0; i mod s < s - Suc 0\<rbrakk> \<Longrightarrow> i mod s < s - 1
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma esqrt_eq_iff_square [simp]:
  assumes "x \<ge> 0" "y \<ge> 0"
  shows "esqrt x = y \<longleftrightarrow> x = y * y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (esqrt x = y) = (x = y * y)
[PROOF STEP]
using esqrt_def esqrt_square assms
[PROOF STATE]
proof (prove)
using this:
esqrt ?x = enn2ereal (ennsqrt (e2ennreal ?x))
0 \<le> ?x \<Longrightarrow> esqrt ?x * esqrt ?x = ?x
0 \<le> x
0 \<le> y

goal (1 subgoal):
 1. (esqrt x = y) = (x = y * y)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<And>x. esqrt x = enn2ereal (ennsqrt (e2ennreal x)); \<And>x. 0 \<le> x \<Longrightarrow> enn2ereal (ennsqrt (e2ennreal x)) * enn2ereal (ennsqrt (e2ennreal x)) = x; 0 \<le> y; x = y * y\<rbrakk> \<Longrightarrow> enn2ereal (ennsqrt (e2ennreal (y * y))) = y
[PROOF STEP]
by (metis e2ennreal_enn2ereal ennsqrt_square2 eq_onp_same_args ereal_ennreal_cases leD times_ennreal.abs_eq)


[STATEMENT]
lemma columns_transpose [simp]: "columns(transpose A) = rows A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. columns (Finite_Cartesian_Product.transpose A) = rows A
[PROOF STEP]
by (metis transpose_transpose rows_transpose)