[STATEMENT]
lemma (in first_countable_topology) eventually_nhds_within_iff_sequentially:
  "eventually P (inf (nhds a) (principal s)) \<longleftrightarrow>
    (\<forall>f. (\<forall>n. f n \<in> s) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eventually P (inf (nhds a) (principal s)) = (\<forall>f. (\<forall>n. f n \<in> s) \<and> f \<longlonglongrightarrow> a \<longrightarrow> (\<forall>\<^sub>F n in sequentially. P (f n)))
[PROOF STEP]
proof (safe intro!: sequentially_imp_eventually_nhds_within)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<lbrakk>eventually P (inf (nhds a) (principal s)); \<forall>n. f n \<in> s; f \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. P (f n)
[PROOF STEP]
assume "eventually P (inf (nhds a) (principal s))"
[PROOF STATE]
proof (state)
this:
eventually P (inf (nhds a) (principal s))

goal (1 subgoal):
 1. \<And>f. \<lbrakk>eventually P (inf (nhds a) (principal s)); \<forall>n. f n \<in> s; f \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. P (f n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
eventually P (inf (nhds a) (principal s))
[PROOF STEP]
obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. x \<in> s \<longrightarrow> P x"
[PROOF STATE]
proof (prove)
using this:
eventually P (inf (nhds a) (principal s))

goal (1 subgoal):
 1. (\<And>S. \<lbrakk>open S; a \<in> S; \<forall>x\<in>S. x \<in> s \<longrightarrow> P x\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: eventually_inf_principal eventually_nhds)
[PROOF STATE]
proof (state)
this:
open S
a \<in> S
\<forall>x\<in>S. x \<in> s \<longrightarrow> P x

goal (1 subgoal):
 1. \<And>f. \<lbrakk>eventually P (inf (nhds a) (principal s)); \<forall>n. f n \<in> s; f \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. P (f n)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open S
a \<in> S
\<forall>x\<in>S. x \<in> s \<longrightarrow> P x

goal (1 subgoal):
 1. \<And>f. \<lbrakk>eventually P (inf (nhds a) (principal s)); \<forall>n. f n \<in> s; f \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. P (f n)
[PROOF STEP]
fix f
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>f. \<lbrakk>eventually P (inf (nhds a) (principal s)); \<forall>n. f n \<in> s; f \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. P (f n)
[PROOF STEP]
assume "\<forall>n. f n \<in> s" "f \<longlonglongrightarrow> a"
[PROOF STATE]
proof (state)
this:
\<forall>n. f n \<in> s
f \<longlonglongrightarrow> a

goal (1 subgoal):
 1. \<And>f. \<lbrakk>eventually P (inf (nhds a) (principal s)); \<forall>n. f n \<in> s; f \<longlonglongrightarrow> a\<rbrakk> \<Longrightarrow> \<forall>\<^sub>F n in sequentially. P (f n)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
open S
a \<in> S
\<forall>x\<in>S. x \<in> s \<longrightarrow> P x
\<forall>n. f n \<in> s
f \<longlonglongrightarrow> a
[PROOF STEP]
show "eventually (\<lambda>n. P (f n)) sequentially"
[PROOF STATE]
proof (prove)
using this:
open S
a \<in> S
\<forall>x\<in>S. x \<in> s \<longrightarrow> P x
\<forall>n. f n \<in> s
f \<longlonglongrightarrow> a

goal (1 subgoal):
 1. \<forall>\<^sub>F n in sequentially. P (f n)
[PROOF STEP]
by (auto dest!: topological_tendstoD elim: eventually_mono)
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F n in sequentially. P (f n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eq_cbox: "cbox a b = cbox c d \<longleftrightarrow> cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d"
      (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cbox a b = cbox c d) = (cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cbox a b = cbox c d \<Longrightarrow> cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d
 2. cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d \<Longrightarrow> cbox a b = cbox c d
[PROOF STEP]
assume ?lhs
[PROOF STATE]
proof (state)
this:
cbox a b = cbox c d

goal (2 subgoals):
 1. cbox a b = cbox c d \<Longrightarrow> cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d
 2. cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d \<Longrightarrow> cbox a b = cbox c d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cbox a b = cbox c d
[PROOF STEP]
have "cbox a b \<subseteq> cbox c d" "cbox c d \<subseteq> cbox a b"
[PROOF STATE]
proof (prove)
using this:
cbox a b = cbox c d

goal (1 subgoal):
 1. cbox a b \<subseteq> cbox c d &&& cbox c d \<subseteq> cbox a b
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cbox a b \<subseteq> cbox c d
cbox c d \<subseteq> cbox a b

goal (2 subgoals):
 1. cbox a b = cbox c d \<Longrightarrow> cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d
 2. cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d \<Longrightarrow> cbox a b = cbox c d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cbox a b \<subseteq> cbox c d
cbox c d \<subseteq> cbox a b
[PROOF STEP]
show ?rhs
[PROOF STATE]
proof (prove)
using this:
cbox a b \<subseteq> cbox c d
cbox c d \<subseteq> cbox a b

goal (1 subgoal):
 1. cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d
[PROOF STEP]
by (force simp: subset_box box_eq_empty intro: antisym euclidean_eqI)
[PROOF STATE]
proof (state)
this:
cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d

goal (1 subgoal):
 1. cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d \<Longrightarrow> cbox a b = cbox c d
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d \<Longrightarrow> cbox a b = cbox c d
[PROOF STEP]
assume ?rhs
[PROOF STATE]
proof (state)
this:
cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d

goal (1 subgoal):
 1. cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d \<Longrightarrow> cbox a b = cbox c d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d
[PROOF STEP]
show ?lhs
[PROOF STATE]
proof (prove)
using this:
cbox a b = {} \<and> cbox c d = {} \<or> a = c \<and> b = d

goal (1 subgoal):
 1. cbox a b = cbox c d
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
cbox a b = cbox c d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_rank_nth_elem_inv:
  assumes "finite S"
  assumes "i < card S"
  shows "set_rank S (nth_elem S i) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_rank S (nth_elem S i) = i
[PROOF STEP]
using the_equality  set_rank_unique set_rank_exist assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P ?a; \<And>x. ?P x \<Longrightarrow> x = ?a\<rbrakk> \<Longrightarrow> (THE x. ?P x) = ?a
\<lbrakk>finite ?S; ?x \<in> ?S; ?i < card ?S \<and> ?x = nth_elem ?S ?i; ?j < card ?S \<and> ?x = nth_elem ?S ?j\<rbrakk> \<Longrightarrow> ?i = ?j
\<lbrakk>finite ?S; ?x \<in> ?S\<rbrakk> \<Longrightarrow> \<exists>i<card ?S. ?x = nth_elem ?S i
finite S
i < card S

goal (1 subgoal):
 1. set_rank S (nth_elem S i) = i
[PROOF STEP]
unfolding set_rank_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?P ?a; \<And>x. ?P x \<Longrightarrow> x = ?a\<rbrakk> \<Longrightarrow> (THE x. ?P x) = ?a
\<lbrakk>finite ?S; ?x \<in> ?S; ?i < card ?S \<and> ?x = nth_elem ?S ?i; ?j < card ?S \<and> ?x = nth_elem ?S ?j\<rbrakk> \<Longrightarrow> ?i = ?j
\<lbrakk>finite ?S; ?x \<in> ?S\<rbrakk> \<Longrightarrow> \<exists>i<card ?S. ?x = nth_elem ?S i
finite S
i < card S

goal (1 subgoal):
 1. (THE ia. ia < card S \<and> nth_elem S i = nth_elem S ia) = i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>\<And>P a. \<lbrakk>P a; \<And>x. P x \<Longrightarrow> x = a\<rbrakk> \<Longrightarrow> (THE x. P x) = a; \<And>S x i j. \<lbrakk>finite S; x \<in> S; i < card S \<and> x = nth_elem S i; j < card S \<and> x = nth_elem S j\<rbrakk> \<Longrightarrow> i = j; \<And>S x. \<lbrakk>finite S; x \<in> S\<rbrakk> \<Longrightarrow> \<exists>i<card S. x = nth_elem S i; finite S; i < card S\<rbrakk> \<Longrightarrow> (THE ia. ia < card S \<and> nth_elem S i = nth_elem S ia) = i
[PROOF STEP]
show "(THE n. n < card S \<and> nth_elem S i = nth_elem S n) = i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (THE n. n < card S \<and> nth_elem S i = nth_elem S n) = i
[PROOF STEP]
using assms(1) assms(2) nth_elem_closed set_rank_unique
[PROOF STATE]
proof (prove)
using this:
finite S
i < card S
?i < card ?S \<Longrightarrow> nth_elem ?S ?i \<in> ?S
\<lbrakk>finite ?S; ?x \<in> ?S; ?i < card ?S \<and> ?x = nth_elem ?S ?i; ?j < card ?S \<and> ?x = nth_elem ?S ?j\<rbrakk> \<Longrightarrow> ?i = ?j

goal (1 subgoal):
 1. (THE n. n < card S \<and> nth_elem S i = nth_elem S n) = i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(THE n. n < card S \<and> nth_elem S i = nth_elem S n) = i

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pderivs_lang_union:
  shows "pderivs_lang (A \<union> B) r = (pderivs_lang A r \<union> pderivs_lang B r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pderivs_lang (A \<union> B) r = pderivs_lang A r \<union> pderivs_lang B r
[PROOF STEP]
by (simp add: pderivs_lang_def)


[STATEMENT]
lemma nat_k_induct:
  fixes k::nat
  assumes "\<forall>i<k. P i" and "\<forall>n\<^sub>0. (\<forall>i<k. P (n\<^sub>0+i)) \<longrightarrow> P (n\<^sub>0+k)"
  shows "P (n::nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P n
[PROOF STEP]
proof(induct rule:nat_less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. \<forall>m<n. P m \<Longrightarrow> P n
[PROOF STEP]
case (1 n)
[PROOF STATE]
proof (state)
this:
\<forall>m<n. P m

goal (1 subgoal):
 1. \<And>n. \<forall>m<n. P m \<Longrightarrow> P n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<forall>m<n. P m
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<forall>m<n. P m

goal (1 subgoal):
 1. P n
[PROOF STEP]
apply(cases "n < k")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<lbrakk>\<forall>m<n. P m; n < k\<rbrakk> \<Longrightarrow> P n
 2. \<lbrakk>\<forall>m<n. P m; \<not> n < k\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
\<forall>i<k. P i

goal (2 subgoals):
 1. \<lbrakk>\<forall>m<n. P m; n < k\<rbrakk> \<Longrightarrow> P n
 2. \<lbrakk>\<forall>m<n. P m; \<not> n < k\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
apply blast
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>m<n. P m; \<not> n < k\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
using assms(2)[rule_format, of "n-k"]
[PROOF STATE]
proof (prove)
using this:
(\<And>i. i < k \<Longrightarrow> P (n - k + i)) \<Longrightarrow> P (n - k + k)

goal (1 subgoal):
 1. \<lbrakk>\<forall>m<n. P m; \<not> n < k\<rbrakk> \<Longrightarrow> P n
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
P n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lincomb_vec_index [simp]:
  assumes "finite F" and a2:"i < n" and "F \<subseteq> carrier_vec n" and "f: F \<rightarrow> UNIV"
  shows "module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * (v $ i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite F
i < n
F \<subseteq> carrier_vec n
f \<in> F \<rightarrow> UNIV

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i)
[PROOF STEP]
proof(induct F)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<lbrakk>i < n; {} \<subseteq> carrier_vec n; f \<in> {} \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f {} $ i = (\<Sum>v\<in>{}. f v * v $ i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
i < n
{} \<subseteq> carrier_vec n
f \<in> {} \<rightarrow> UNIV

goal (2 subgoals):
 1. \<lbrakk>i < n; {} \<subseteq> carrier_vec n; f \<in> {} \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f {} $ i = (\<Sum>v\<in>{}. f v * v $ i)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < n
{} \<subseteq> carrier_vec n
f \<in> {} \<rightarrow> UNIV
[PROOF STEP]
show "module.lincomb (module_cpx_vec n) f {} $ i = (\<Sum>v\<in>{}. f v * v $ i)"
[PROOF STATE]
proof (prove)
using this:
i < n
{} \<subseteq> carrier_vec n
f \<in> {} \<rightarrow> UNIV

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f {} $ i = (\<Sum>v\<in>{}. f v * v $ i)
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i < n \<Longrightarrow> module.lincomb (module_cpx_vec n) f {} $ i = 0
[PROOF STEP]
using a2 module.lincomb_def abelian_monoid.finsum_empty module_cpx_vec_def
[PROOF STATE]
proof (prove)
using this:
i < n
Module.module ?R ?M \<Longrightarrow> module.lincomb ?M ?a ?A = (\<Oplus>\<^bsub>?M\<^esub>v\<in>?A. ?a v \<odot>\<^bsub>?M\<^esub> v)
abelian_monoid ?G \<Longrightarrow> finsum ?G ?f {} = \<zero>\<^bsub>?G\<^esub>
module_cpx_vec ?n \<equiv> module_vec TYPE(complex) ?n

goal (1 subgoal):
 1. i < n \<Longrightarrow> module.lincomb (module_cpx_vec n) f {} $ i = 0
[PROOF STEP]
by (metis (mono_tags) abelian_group_def index_zero_vec(1) module_cpx_vec Module.module_def module_vec_simps(2))
[PROOF STATE]
proof (state)
this:
module.lincomb (module_cpx_vec n) f {} $ i = (\<Sum>v\<in>{}. f v * v $ i)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
case(insert x F)
[PROOF STATE]
proof (state)
this:
finite F
x \<notin> F
\<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i)
i < n
insert x F \<subseteq> carrier_vec n
f \<in> insert x F \<rightarrow> UNIV

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
have "module.lincomb (module_cpx_vec n) f (insert x F) =
      f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F
[PROOF STEP]
using module.lincomb_insert module_cpx_vec insert.hyps(1) module_cpx_vec_def module_vec_def
      insert.prems(2) insert.hyps(2) insert.prems(3) insert_def
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>Module.module ?R ?M; finite ?S; ?S \<subseteq> carrier ?M; ?a \<in> ?S \<union> {?v} \<rightarrow> carrier ?R; ?v \<notin> ?S; ?v \<in> carrier ?M\<rbrakk> \<Longrightarrow> module.lincomb ?M ?a (?S \<union> {?v}) = ?a ?v \<odot>\<^bsub>?M\<^esub> ?v \<oplus>\<^bsub>?M\<^esub> module.lincomb ?M ?a ?S
Module.module cpx_rng (module_cpx_vec ?n)
finite F
module_cpx_vec ?n \<equiv> module_vec TYPE(complex) ?n
module_vec ?ty ?n \<equiv> \<lparr>carrier = carrier_vec ?n, monoid.mult = undefined, one = undefined, zero = 0\<^sub>v ?n, add = (+), module.smult = (\<cdot>\<^sub>v)\<rparr>
insert x F \<subseteq> carrier_vec n
x \<notin> F
f \<in> insert x F \<rightarrow> UNIV
insert ?a ?B = {x. x = ?a} \<union> ?B

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F
[PROOF STEP]
by (smt Pi_I' UNIV_I Un_insert_right cpx_rng_def insert_subset module_vec_simps(4)
        partial_object.select_convs(1) sup_bot.comm_neutral)
[PROOF STATE]
proof (state)
this:
module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F
[PROOF STEP]
have "module.lincomb (module_cpx_vec n) f (insert x F) $ i =
      (f x \<cdot>\<^sub>v x) $ i + module.lincomb (module_cpx_vec n) f F $ i"
[PROOF STATE]
proof (prove)
using this:
module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) $ i = (f x \<cdot>\<^sub>v x) $ i + module.lincomb (module_cpx_vec n) f F $ i
[PROOF STEP]
using index_add_vec(1) a2 dim_vec_lincomb
[PROOF STATE]
proof (prove)
using this:
module.lincomb (module_cpx_vec n) f (insert x F) = f x \<cdot>\<^sub>v x \<oplus>\<^bsub>module_cpx_vec n\<^esub> module.lincomb (module_cpx_vec n) f F
?i < dim_vec ?v\<^sub>2 \<Longrightarrow> (?v\<^sub>1 + ?v\<^sub>2) $ ?i = ?v\<^sub>1 $ ?i + ?v\<^sub>2 $ ?i
i < n
\<lbrakk>finite ?F; ?f \<in> ?F \<rightarrow> UNIV; ?F \<subseteq> carrier_vec ?n\<rbrakk> \<Longrightarrow> dim_vec (module.lincomb (module_cpx_vec ?n) ?f ?F) = ?n

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) $ i = (f x \<cdot>\<^sub>v x) $ i + module.lincomb (module_cpx_vec n) f F $ i
[PROOF STEP]
by (metis Pi_split_insert_domain  insert.hyps(1) insert.prems(2) insert.prems(3) insert_subset
        module_cpx_vec_def module_vec_simps(1))
[PROOF STATE]
proof (state)
this:
module.lincomb (module_cpx_vec n) f (insert x F) $ i = (f x \<cdot>\<^sub>v x) $ i + module.lincomb (module_cpx_vec n) f F $ i

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
hence "module.lincomb (module_cpx_vec n) f (insert x F) $ i = f x * x $ i + (\<Sum>v\<in>F. f v * v $ i)"
[PROOF STATE]
proof (prove)
using this:
module.lincomb (module_cpx_vec n) f (insert x F) $ i = (f x \<cdot>\<^sub>v x) $ i + module.lincomb (module_cpx_vec n) f F $ i

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) $ i = f x * x $ i + (\<Sum>v\<in>F. f v * v $ i)
[PROOF STEP]
using index_smult_vec a2 insert.prems(2) insert_def insert.hyps(3)
[PROOF STATE]
proof (prove)
using this:
module.lincomb (module_cpx_vec n) f (insert x F) $ i = (f x \<cdot>\<^sub>v x) $ i + module.lincomb (module_cpx_vec n) f F $ i
?i < dim_vec ?v \<Longrightarrow> (?a \<cdot>\<^sub>v ?v) $ ?i = ?a * ?v $ ?i
dim_vec (?a \<cdot>\<^sub>v ?v) = dim_vec ?v
i < n
insert x F \<subseteq> carrier_vec n
insert ?a ?B = {x. x = ?a} \<union> ?B
\<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i)

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) $ i = f x * x $ i + (\<Sum>v\<in>F. f v * v $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
module.lincomb (module_cpx_vec n) f (insert x F) $ i = f x * x $ i + (\<Sum>v\<in>F. f v * v $ i)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; \<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i); i < n; insert x F \<subseteq> carrier_vec n; f \<in> insert x F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
with insert
[PROOF STATE]
proof (chain)
picking this:
finite F
x \<notin> F
\<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i)
i < n
insert x F \<subseteq> carrier_vec n
f \<in> insert x F \<rightarrow> UNIV
module.lincomb (module_cpx_vec n) f (insert x F) $ i = f x * x $ i + (\<Sum>v\<in>F. f v * v $ i)
[PROOF STEP]
show "module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)"
[PROOF STATE]
proof (prove)
using this:
finite F
x \<notin> F
\<lbrakk>i < n; F \<subseteq> carrier_vec n; f \<in> F \<rightarrow> UNIV\<rbrakk> \<Longrightarrow> module.lincomb (module_cpx_vec n) f F $ i = (\<Sum>v\<in>F. f v * v $ i)
i < n
insert x F \<subseteq> carrier_vec n
f \<in> insert x F \<rightarrow> UNIV
module.lincomb (module_cpx_vec n) f (insert x F) $ i = f x * x $ i + (\<Sum>v\<in>F. f v * v $ i)

goal (1 subgoal):
 1. module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
module.lincomb (module_cpx_vec n) f (insert x F) $ i = (\<Sum>v\<in>insert x F. f v * v $ i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma add_sum:
  assumes "i > 0" "j \<ge> i" "k > j"
  shows "sum i j + sum (Suc j) k = sum i k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. local.sum i j + local.sum (Suc j) k = local.sum i k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. local.sum i j + local.sum (Suc j) k = local.sum i k
[PROOF STEP]
have *: "[i - 1 ..< k - 1] = [i - 1..< j] @ [j..< k - 1]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [i - 1..<k - 1] = [i - 1..<j] @ [j..<k - 1]
[PROOF STEP]
using assms upt_add_eq_append[of "i - 1" "j - 1" "k - j"]
[PROOF STATE]
proof (prove)
using this:
0 < i
i \<le> j
j < k
i - 1 \<le> j - 1 \<Longrightarrow> [i - 1..<j - 1 + (k - j)] = [i - 1..<j - 1] @ [j - 1..<j - 1 + (k - j)]

goal (1 subgoal):
 1. [i - 1..<k - 1] = [i - 1..<j] @ [j..<k - 1]
[PROOF STEP]
by (cases j) (auto simp: upt_conv_Cons)
[PROOF STATE]
proof (state)
this:
[i - 1..<k - 1] = [i - 1..<j] @ [j..<k - 1]

goal (1 subgoal):
 1. local.sum i j + local.sum (Suc j) k = local.sum i k
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[i - 1..<k - 1] = [i - 1..<j] @ [j..<k - 1]
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[i - 1..<k - 1] = [i - 1..<j] @ [j..<k - 1]

goal (1 subgoal):
 1. local.sum i j + local.sum (Suc j) k = local.sum i k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
[i - 1..<k - 1] = [i - 1..<j] @ [j..<k - 1]
0 < i
i \<le> j
j < k

goal (1 subgoal):
 1. local.sum i j + local.sum (Suc j) k = local.sum i k
[PROOF STEP]
by (cases j) (auto simp: fold_add_add)
[PROOF STATE]
proof (state)
this:
local.sum i j + local.sum (Suc j) k = local.sum i k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma LIM_const_eq: "(\<lambda>x. k) \<midarrow>a\<rightarrow> L \<Longrightarrow> k = L"
  for a :: "'a::perfect_space" and k L :: "'b::t2_space"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. k) \<midarrow>a\<rightarrow> L \<Longrightarrow> k = L
[PROOF STEP]
by (simp add: tendsto_const_iff)


[STATEMENT]
lemma indexed_const_P_mult_eq:
  assumes "a \<in> carrier R"
  assumes "b \<in> carrier R"
  shows "(indexed_const a) \<Otimes>\<^sub>p  (indexed_const b) = indexed_const (a \<otimes> b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indexed_const a \<Otimes>\<^sub>p indexed_const b = indexed_const (a \<otimes> b)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. indexed_const a \<Otimes>\<^sub>p indexed_const b = indexed_const (a \<otimes> b)
[PROOF STEP]
have 0: "monomials_of R (indexed_const a) = (if (a = \<zero>) then {} else {{#}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomials_of R (indexed_const a) = (if a = \<zero> then {} else {{#}})
[PROOF STEP]
unfolding monomials_of_def indexed_const_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {m. (if m = {#} then a else \<zero>) \<noteq> \<zero>} = (if a = \<zero> then {} else {{#}})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
monomials_of R (indexed_const a) = (if a = \<zero> then {} else {{#}})

goal (1 subgoal):
 1. indexed_const a \<Otimes>\<^sub>p indexed_const b = indexed_const (a \<otimes> b)
[PROOF STEP]
have 1: "monomials_of R (indexed_const b) = (if (b = \<zero>) then {} else {{#}})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. monomials_of R (indexed_const b) = (if b = \<zero> then {} else {{#}})
[PROOF STEP]
unfolding monomials_of_def indexed_const_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {m. (if m = {#} then b else \<zero>) \<noteq> \<zero>} = (if b = \<zero> then {} else {{#}})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
monomials_of R (indexed_const b) = (if b = \<zero> then {} else {{#}})

goal (1 subgoal):
 1. indexed_const a \<Otimes>\<^sub>p indexed_const b = indexed_const (a \<otimes> b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indexed_const a \<Otimes>\<^sub>p indexed_const b = indexed_const (a \<otimes> b)
[PROOF STEP]
unfolding P_ring_mult_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>m. \<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
fix m:: "'c monomial"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
show "(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
proof(cases "m = {#}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. m = {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
 2. m \<noteq> {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
m = {#}

goal (2 subgoals):
 1. m = {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
 2. m \<noteq> {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m = {#}
[PROOF STEP]
have T0: "mset_factors m = {{#}}"
[PROOF STATE]
proof (prove)
using this:
m = {#}

goal (1 subgoal):
 1. mset_factors m = {{#}}
[PROOF STEP]
unfolding mset_factors_def
[PROOF STATE]
proof (prove)
using this:
m = {#}

goal (1 subgoal):
 1. {n. n \<subseteq># m} = {{#}}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
mset_factors m = {{#}}

goal (2 subgoals):
 1. m = {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
 2. m \<noteq> {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
have "(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) =
                   indexed_const a {#} \<otimes> indexed_const b ({#} - {#}) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
have 0: "(\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
have 1: "indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R
[PROOF STEP]
by (simp add: assms(1) assms(2) indexed_const_def)
[PROOF STATE]
proof (state)
this:
indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
have 2: "(\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) =
                 indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))
[PROOF STEP]
using True T0 0 1  finsum_insert[of "{}" "{#}" "\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)"  ]
[PROOF STATE]
proof (prove)
using this:
m = {#}
mset_factors m = {{#}}
(\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R
indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R
\<lbrakk>finite {}; {#} \<notin> {}; (\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R; indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))

goal (1 subgoal):
 1. (\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))
[PROOF STEP]
by (simp add: indexed_const_def)
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
using True T0 0 1  finsum_insert[of "{}" "{#}" "\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)"  ]
              finsum_empty[of "\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)"]
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))
m = {#}
mset_factors m = {{#}}
(\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R
indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R
\<lbrakk>finite {}; {#} \<notin> {}; (\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R; indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))
(\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x)) = \<zero>

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
by (simp add: \<open>\<lbrakk>finite {}; {#} \<notin> {}; (\<lambda>x. indexed_const a x \<otimes> indexed_const b (m - x)) \<in> {} \<rightarrow> carrier R; indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<in> carrier R\<rbrakk> \<Longrightarrow> (\<Oplus>x\<in>{{#}}. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b (m - {#}) \<oplus> (\<Oplus>x\<in>{}. indexed_const a x \<otimes> indexed_const b (m - x))\<close> indexed_const_def)
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})

goal (2 subgoals):
 1. m = {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
 2. m \<noteq> {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const a {#} \<otimes> indexed_const b ({#} - {#})

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
by (simp add: True indexed_const_def)
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m

goal (1 subgoal):
 1. m \<noteq> {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. m \<noteq> {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
m \<noteq> {#}

goal (1 subgoal):
 1. m \<noteq> {#} \<Longrightarrow> (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
m \<noteq> {#}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
m \<noteq> {#}

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
using 0 1
[PROOF STATE]
proof (prove)
using this:
m \<noteq> {#}
monomials_of R (indexed_const a) = (if a = \<zero> then {} else {{#}})
monomials_of R (indexed_const b) = (if b = \<zero> then {} else {{#}})

goal (1 subgoal):
 1. (\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m
[PROOF STEP]
by (simp add: add.finprod_one_eqI assms(1) assms(2)
            indexed_const_def )
[PROOF STATE]
proof (state)
this:
(\<Oplus>x\<in>mset_factors m. indexed_const a x \<otimes> indexed_const b (m - x)) = indexed_const (a \<otimes> b) m

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

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma just_cash_valid_transfer:
  "valid_transfer (just_cash c) (just_cash t) = ((0 :: real) \<le> t \<and> t \<le> c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. valid_transfer (just_cash c) (just_cash t) = (0 \<le> t \<and> t \<le> c)
[PROOF STEP]
unfolding valid_transfer_alt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> just_cash t \<and> just_cash t \<le> just_cash c) = (0 \<le> t \<and> t \<le> c)
[PROOF STEP]
by (simp add: less_eq_account_def)


[STATEMENT]
lemma cong:
  assumes "[a = b] (mod n)"
  shows   "\<chi> a = \<chi> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
[a = b] (mod n)
[PROOF STEP]
obtain k1 k2 where *: "b + k1 * n = a + k2 * n"
[PROOF STATE]
proof (prove)
using this:
[a = b] (mod n)

goal (1 subgoal):
 1. (\<And>k1 k2. b + k1 * n = a + k2 * n \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm) cong_iff_lin_nat) auto
[PROOF STATE]
proof (state)
this:
b + k1 * n = a + k2 * n

goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
have "\<chi> a = \<chi> (a + k2 * n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> a = \<chi> (a + k2 * n)
[PROOF STEP]
by (rule periodic_mult [symmetric])
[PROOF STATE]
proof (state)
this:
\<chi> a = \<chi> (a + k2 * n)

goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<chi> a = \<chi> (a + k2 * n)

goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
note * [symmetric]
[PROOF STATE]
proof (state)
this:
a + k2 * n = b + k1 * n

goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a + k2 * n = b + k1 * n

goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
have "\<chi> (b + k1 * n) = \<chi> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> (b + k1 * n) = \<chi> b
[PROOF STEP]
by (rule periodic_mult)
[PROOF STATE]
proof (state)
this:
\<chi> (b + k1 * n) = \<chi> b

goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<chi> a = \<chi> b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<chi> a = \<chi> b

goal (1 subgoal):
 1. \<chi> a = \<chi> b
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
\<chi> a = \<chi> b

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deg_pm_superset:
  assumes "keys s \<subseteq> A" and "finite A"
  shows "deg_pm s = (\<Sum>x\<in>A. lookup s x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_pm s = sum (lookup s) A
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
keys s \<subseteq> A
finite A

goal (1 subgoal):
 1. deg_pm s = sum (lookup s) A
[PROOF STEP]
by (simp only: deg_pm.rep_eq keys_eq_supp, elim deg_fun_superset)


[STATEMENT]
lemma nat_minus1_eq: "nat (- 1) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat (- 1) = 0
[PROOF STEP]
by simp


[STATEMENT]
lemma strongly_confluentI [intro]:
  "\<lbrakk>\<And>x y z. (x, y) \<in> r \<Longrightarrow> (x, z) \<in> r \<Longrightarrow> \<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>=\<rbrakk> \<Longrightarrow> strongly_confluent r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y z. \<lbrakk>(x, y) \<in> r; (x, z) \<in> r\<rbrakk> \<Longrightarrow> \<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>=) \<Longrightarrow> strongly_confluent r
[PROOF STEP]
unfolding strongly_confluent_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x y z. \<lbrakk>(x, y) \<in> r; (x, z) \<in> r\<rbrakk> \<Longrightarrow> \<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>=) \<Longrightarrow> \<forall>x\<in>UNIV. \<forall>y z. (x, y) \<in> r \<and> (x, z) \<in> r \<longrightarrow> (\<exists>u. (y, u) \<in> r\<^sup>* \<and> (z, u) \<in> r\<^sup>=)
[PROOF STEP]
by auto


[STATEMENT]
theorem pair_measure_density:
  assumes f: "f \<in> borel_measurable M1"
  assumes g: "g \<in> borel_measurable M2"
  assumes "sigma_finite_measure M2" "sigma_finite_measure (density M2 g)"
  shows "density M1 f \<Otimes>\<^sub>M density M2 g = density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x,y). f x * g y)" (is "?L = ?R")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. density M1 f \<Otimes>\<^sub>M density M2 g = density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)
[PROOF STEP]
proof (rule measure_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (density M1 f \<Otimes>\<^sub>M density M2 g) = sets (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y))
 2. \<And>A. A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g) \<Longrightarrow> emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A
[PROOF STEP]
interpret M2: sigma_finite_measure M2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure M2
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (density M1 f \<Otimes>\<^sub>M density M2 g) = sets (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y))
 2. \<And>A. A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g) \<Longrightarrow> emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A
[PROOF STEP]
interpret D2: sigma_finite_measure "density M2 g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_finite_measure (density M2 g)
[PROOF STEP]
by fact
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (density M1 f \<Otimes>\<^sub>M density M2 g) = sets (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y))
 2. \<And>A. A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g) \<Longrightarrow> emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A
[PROOF STEP]
fix A
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sets (density M1 f \<Otimes>\<^sub>M density M2 g) = sets (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y))
 2. \<And>A. A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g) \<Longrightarrow> emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A
[PROOF STEP]
assume A: "A \<in> sets ?L"
[PROOF STATE]
proof (state)
this:
A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g)

goal (2 subgoals):
 1. sets (density M1 f \<Otimes>\<^sub>M density M2 g) = sets (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y))
 2. \<And>A. A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g) \<Longrightarrow> emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A
[PROOF STEP]
with f g
[PROOF STATE]
proof (chain)
picking this:
f \<in> borel_measurable M1
g \<in> borel_measurable M2
A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g)
[PROOF STEP]
have "(\<integral>\<^sup>+ x. f x * \<integral>\<^sup>+ y. g y * indicator A (x, y) \<partial>M2 \<partial>M1) =
    (\<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f x * g y * indicator A (x, y) \<partial>M2 \<partial>M1)"
[PROOF STATE]
proof (prove)
using this:
f \<in> borel_measurable M1
g \<in> borel_measurable M2
A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g)

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. f x * \<integral>\<^sup>+ y. g y * indicator A (x, y) \<partial>M2 \<partial>M1 = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f x * g y * indicator A (x, y) \<partial>M2 \<partial>M1
[PROOF STEP]
by (intro nn_integral_cong_AE)
       (auto simp add: nn_integral_cmult[symmetric] ac_simps)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. f x * \<integral>\<^sup>+ y. g y * indicator A (x, y) \<partial>M2 \<partial>M1 = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f x * g y * indicator A (x, y) \<partial>M2 \<partial>M1

goal (2 subgoals):
 1. sets (density M1 f \<Otimes>\<^sub>M density M2 g) = sets (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y))
 2. \<And>A. A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g) \<Longrightarrow> emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A
[PROOF STEP]
with A f g
[PROOF STATE]
proof (chain)
picking this:
A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g)
f \<in> borel_measurable M1
g \<in> borel_measurable M2
\<integral>\<^sup>+ x. f x * \<integral>\<^sup>+ y. g y * indicator A (x, y) \<partial>M2 \<partial>M1 = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f x * g y * indicator A (x, y) \<partial>M2 \<partial>M1
[PROOF STEP]
show "emeasure ?L A = emeasure ?R A"
[PROOF STATE]
proof (prove)
using this:
A \<in> sets (density M1 f \<Otimes>\<^sub>M density M2 g)
f \<in> borel_measurable M1
g \<in> borel_measurable M2
\<integral>\<^sup>+ x. f x * \<integral>\<^sup>+ y. g y * indicator A (x, y) \<partial>M2 \<partial>M1 = \<integral>\<^sup>+ x. \<integral>\<^sup>+ y. f x * g y * indicator A (x, y) \<partial>M2 \<partial>M1

goal (1 subgoal):
 1. emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A
[PROOF STEP]
by (simp add: D2.emeasure_pair_measure emeasure_density nn_integral_density
                  M2.nn_integral_fst[symmetric]
             cong: nn_integral_cong)
[PROOF STATE]
proof (state)
this:
emeasure (density M1 f \<Otimes>\<^sub>M density M2 g) A = emeasure (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y)) A

goal (1 subgoal):
 1. sets (density M1 f \<Otimes>\<^sub>M density M2 g) = sets (density (M1 \<Otimes>\<^sub>M M2) (\<lambda>(x, y). f x * g y))
[PROOF STEP]
qed simp


[STATEMENT]
lemma register_Fst_register_Snd[simp]:
  assumes \<open>register F\<close>
  shows \<open>(F o Fst; F o Snd) = F\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (F \<circ> Fst;F \<circ> Snd) = F
[PROOF STEP]
apply (rule tensor_extensionality)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. preregister (F \<circ> Fst;F \<circ> Snd)
 2. preregister F
 3. \<And>a b. (F \<circ> Fst;F \<circ> Snd) (a \<otimes>\<^sub>u b) = F (a \<otimes>\<^sub>u b)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
register F

goal (3 subgoals):
 1. preregister (F \<circ> Fst;F \<circ> Snd)
 2. preregister F
 3. \<And>a b. (F \<circ> Fst;F \<circ> Snd) (a \<otimes>\<^sub>u b) = F (a \<otimes>\<^sub>u b)
[PROOF STEP]
by (auto simp: register_pair_apply Fst_def Snd_def register_mult tensor_update_mult)


[STATEMENT]
lemma subspace_hyperplane2: "subspace {x. x \<bullet> a = 0}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subspace {x. x \<bullet> a = 0}
[PROOF STEP]
by (simp add: inner_commute inner_right_distrib subspace_def)


[STATEMENT]
lemma gcd_Esigma_mult:
  assumes "gcd m n = 1"
  shows "Esigma (m*n) = (Esigma m)*(Esigma n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
have "Esigma (m*n) = \<Sum> {i*j| i j. i \<in> divisor_set m \<and> j \<in> divisor_set n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Esigma (m * n) = \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n}
[PROOF STEP]
by (simp add: divisor_set_mult Esigma_def)
[PROOF STATE]
proof (state)
this:
Esigma (m * n) = \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n}

goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Esigma (m * n) = \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n}

goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
have "... = (\<Sum>i \<in> divisor_set m. \<Sum>j \<in> divisor_set n. i*j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))
[PROOF STEP]
have "inj_on (\<lambda>(i,j). i*j) (divisor_set m \<times> divisor_set n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on (\<lambda>(i, j). i * j) (divisor_set m \<times> divisor_set n)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
gcd m n = 1

goal (1 subgoal):
 1. inj_on (\<lambda>(i, j). i * j) (divisor_set m \<times> divisor_set n)
[PROOF STEP]
apply (simp add: inj_on_def divisor_set divisor_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd m n = Suc 0 \<Longrightarrow> \<forall>x. Suc 0 \<le> x \<and> x \<le> m \<and> x dvd m \<longrightarrow> (\<forall>y. Suc 0 \<le> y \<and> y \<le> n \<and> y dvd n \<longrightarrow> (\<forall>xa. Suc 0 \<le> xa \<and> xa \<le> m \<and> xa dvd m \<longrightarrow> (\<forall>ya. Suc 0 \<le> ya \<and> ya \<le> n \<and> ya dvd n \<longrightarrow> x * y = xa * ya \<longrightarrow> x = xa \<and> y = ya)))
[PROOF STEP]
by (metis assms coprime_dvd_aux mult_left_cancel not_one_le_zero)
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(i, j). i * j) (divisor_set m \<times> divisor_set n)

goal (1 subgoal):
 1. \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
inj_on (\<lambda>(i, j). i * j) (divisor_set m \<times> divisor_set n)

goal (1 subgoal):
 1. \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))
[PROOF STEP]
have
"{i*j| i j. i \<in> divisor_set m \<and> j \<in> divisor_set n}= (\<lambda>(i,j). i*j)`(divisor_set m \<times> divisor_set n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<lambda>(i, j). i * j) ` (divisor_set m \<times> divisor_set n)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<lambda>(i, j). i * j) ` (divisor_set m \<times> divisor_set n)

goal (1 subgoal):
 1. \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>(i, j). i * j) (divisor_set m \<times> divisor_set n)
{i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<lambda>(i, j). i * j) ` (divisor_set m \<times> divisor_set n)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>(i, j). i * j) (divisor_set m \<times> divisor_set n)
{i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<lambda>(i, j). i * j) ` (divisor_set m \<times> divisor_set n)

goal (1 subgoal):
 1. \<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))
[PROOF STEP]
by (simp add: sum.cartesian_product sum_image_eq)
[PROOF STATE]
proof (state)
this:
\<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))

goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Sum> {i * j |i j. i \<in> divisor_set m \<and> j \<in> divisor_set n} = (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n))

goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
have "... = \<Sum>( divisor_set m)* \<Sum>( divisor_set n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n)) = \<Sum> (divisor_set m) * \<Sum> (divisor_set n)
[PROOF STEP]
by (simp add: sum_product)
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n)) = \<Sum> (divisor_set m) * \<Sum> (divisor_set n)

goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>divisor_set m. sum ((*) i) (divisor_set n)) = \<Sum> (divisor_set m) * \<Sum> (divisor_set n)

goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
have "... = Esigma m * Esigma n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Sum> (divisor_set m) * \<Sum> (divisor_set n) = Esigma m * Esigma n
[PROOF STEP]
by (simp add: Esigma_def)
[PROOF STATE]
proof (state)
this:
\<Sum> (divisor_set m) * \<Sum> (divisor_set n) = Esigma m * Esigma n

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

goal (1 subgoal):
 1. Esigma (m * n) = Esigma m * Esigma n
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
Esigma (m * n) = Esigma m * Esigma n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma interval_lebesgue_integrable_combine:
  assumes "interval_lebesgue_integrable lborel A B f"
  assumes "interval_lebesgue_integrable lborel B C f"
  assumes "set_borel_measurable borel (einterval A C) f"
  assumes "A \<le> B" "B \<le> C"
  shows   "interval_lebesgue_integrable lborel A C f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
have meas: "set_borel_measurable borel (einterval A B \<union> einterval B C) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_borel_measurable borel (einterval A B \<union> einterval B C) f
[PROOF STEP]
by (rule set_borel_measurable_subset[OF assms(3)]) (use assms in \<open>auto simp: einterval_def\<close>)
[PROOF STATE]
proof (state)
this:
set_borel_measurable borel (einterval A B \<union> einterval B C) f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
have "set_integrable lborel (einterval A B \<union> einterval B C) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel (einterval A B \<union> einterval B C) f
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
interval_lebesgue_integrable lborel A B f
interval_lebesgue_integrable lborel B C f
set_borel_measurable borel (einterval A C) f
A \<le> B
B \<le> C

goal (1 subgoal):
 1. set_integrable lborel (einterval A B \<union> einterval B C) f
[PROOF STEP]
by (intro set_integrable_Un) (auto simp: interval_lebesgue_integrable_def)
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval A B \<union> einterval B C) f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval A B \<union> einterval B C) f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
have "?this \<longleftrightarrow> set_integrable lborel (einterval A C) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
proof (cases "B \<in> {\<infinity>, -\<infinity>}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. B \<in> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
 2. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
B \<in> {\<infinity>, - \<infinity>}

goal (2 subgoals):
 1. B \<in> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
 2. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
interval_lebesgue_integrable lborel A B f
interval_lebesgue_integrable lborel B C f
set_borel_measurable borel (einterval A C) f
A \<le> B
B \<le> C
B \<in> {\<infinity>, - \<infinity>}
[PROOF STEP]
have "einterval A B \<union> einterval B C = einterval A C"
[PROOF STATE]
proof (prove)
using this:
interval_lebesgue_integrable lborel A B f
interval_lebesgue_integrable lborel B C f
set_borel_measurable borel (einterval A C) f
A \<le> B
B \<le> C
B \<in> {\<infinity>, - \<infinity>}

goal (1 subgoal):
 1. einterval A B \<union> einterval B C = einterval A C
[PROOF STEP]
by (auto simp: einterval_def)
[PROOF STATE]
proof (state)
this:
einterval A B \<union> einterval B C = einterval A C

goal (2 subgoals):
 1. B \<in> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
 2. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
einterval A B \<union> einterval B C = einterval A C

goal (1 subgoal):
 1. set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f

goal (1 subgoal):
 1. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
B \<notin> {\<infinity>, - \<infinity>}

goal (1 subgoal):
 1. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
B \<notin> {\<infinity>, - \<infinity>}
[PROOF STEP]
obtain B' where [simp]: "B = ereal B'"
[PROOF STATE]
proof (prove)
using this:
B \<notin> {\<infinity>, - \<infinity>}

goal (1 subgoal):
 1. (\<And>B'. B = ereal B' \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases B) auto
[PROOF STATE]
proof (state)
this:
B = ereal B'

goal (1 subgoal):
 1. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
have "indicator (einterval A C) x = (indicator (einterval A B \<union> einterval B C) x :: real)"
      if "x \<noteq> B'" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indicat_real (einterval A C) x = indicat_real (einterval A B \<union> einterval B C) x
[PROOF STEP]
using assms(4,5) that
[PROOF STATE]
proof (prove)
using this:
A \<le> B
B \<le> C
x \<noteq> B'

goal (1 subgoal):
 1. indicat_real (einterval A C) x = indicat_real (einterval A B \<union> einterval B C) x
[PROOF STEP]
by (cases A; cases C) (auto simp: einterval_def indicator_def)
[PROOF STATE]
proof (state)
this:
?x \<noteq> B' \<Longrightarrow> indicat_real (einterval A C) ?x = indicat_real (einterval A B \<union> einterval B C) ?x

goal (1 subgoal):
 1. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
hence "{x \<in> space lborel. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x \<noteq>
              indicat_real (einterval A C) x *\<^sub>R f x} \<subseteq> {B'}"
[PROOF STATE]
proof (prove)
using this:
?x \<noteq> B' \<Longrightarrow> indicat_real (einterval A C) ?x = indicat_real (einterval A B \<union> einterval B C) ?x

goal (1 subgoal):
 1. {x \<in> space lborel. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x \<noteq> indicat_real (einterval A C) x *\<^sub>R f x} \<subseteq> {B'}
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
{x \<in> space lborel. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x \<noteq> indicat_real (einterval A C) x *\<^sub>R f x} \<subseteq> {B'}

goal (1 subgoal):
 1. B \<notin> {\<infinity>, - \<infinity>} \<Longrightarrow> set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
{x \<in> space lborel. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x \<noteq> indicat_real (einterval A C) x *\<^sub>R f x} \<subseteq> {B'}

goal (1 subgoal):
 1. set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f
[PROOF STEP]
unfolding set_integrable_def
[PROOF STATE]
proof (prove)
using this:
{x \<in> space lborel. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x \<noteq> indicat_real (einterval A C) x *\<^sub>R f x} \<subseteq> {B'}

goal (1 subgoal):
 1. integrable lborel (\<lambda>x. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x) = integrable lborel (\<lambda>x. indicat_real (einterval A C) x *\<^sub>R f x)
[PROOF STEP]
using meas assms
[PROOF STATE]
proof (prove)
using this:
{x \<in> space lborel. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x \<noteq> indicat_real (einterval A C) x *\<^sub>R f x} \<subseteq> {B'}
set_borel_measurable borel (einterval A B \<union> einterval B C) f
interval_lebesgue_integrable lborel A B f
interval_lebesgue_integrable lborel B C f
set_borel_measurable borel (einterval A C) f
A \<le> B
B \<le> C

goal (1 subgoal):
 1. integrable lborel (\<lambda>x. indicat_real (einterval A B \<union> einterval B C) x *\<^sub>R f x) = integrable lborel (\<lambda>x. indicat_real (einterval A C) x *\<^sub>R f x)
[PROOF STEP]
by (intro integrable_cong_AE AE_I[of _ _ "{B'}"])
         (simp_all add: set_borel_measurable_def)
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval A B \<union> einterval B C) f = set_integrable lborel (einterval A C) f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
have "\<dots> \<longleftrightarrow> ?thesis"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_integrable lborel (einterval A C) f = interval_lebesgue_integrable lborel A C f
[PROOF STEP]
using order.trans[OF assms(4,5)]
[PROOF STATE]
proof (prove)
using this:
A \<le> C

goal (1 subgoal):
 1. set_integrable lborel (einterval A C) f = interval_lebesgue_integrable lborel A C f
[PROOF STEP]
by (simp add: interval_lebesgue_integrable_def)
[PROOF STATE]
proof (state)
this:
set_integrable lborel (einterval A C) f = interval_lebesgue_integrable lborel A C f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
interval_lebesgue_integrable lborel A C f
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
interval_lebesgue_integrable lborel A C f

goal (1 subgoal):
 1. interval_lebesgue_integrable lborel A C f
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
interval_lebesgue_integrable lborel A C f

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lebesgue_integral_point_measure_finite:
  fixes g :: "'a \<Rightarrow> 'b::{banach, second_countable_topology}"
  shows "finite A \<Longrightarrow> (\<And>a. a \<in> A \<Longrightarrow> 0 \<le> f a) \<Longrightarrow>
    integral\<^sup>L (point_measure A f) g = (\<Sum>a\<in>A. f a *\<^sub>R g a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>finite A; \<And>a. a \<in> A \<Longrightarrow> 0 \<le> f a\<rbrakk> \<Longrightarrow> integral\<^sup>L (point_measure A (\<lambda>x. ennreal (f x))) g = (\<Sum>a\<in>A. f a *\<^sub>R g a)
[PROOF STEP]
by (simp add: lebesgue_integral_count_space_finite AE_count_space integral_density point_measure_def)


[STATEMENT]
lemma ennreal_prod_eq_0[simp]:
  fixes f :: "'a \<Rightarrow> ennreal"
  shows "(prod f A = 0) = (finite A \<and> (\<exists>i\<in>A. f i = 0))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (prod f A = 0) = (finite A \<and> (\<exists>i\<in>A. f i = 0))
[PROOF STEP]
by (induction A rule: infinite_finite_induct) auto


[STATEMENT]
lemma Rats_infinite: "\<not> finite \<rat>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite \<rat>
[PROOF STEP]
by (auto dest!: finite_imageD simp: inj_on_def infinite_UNIV_char_0 Rats_def)


[STATEMENT]
lemma quat_eq_iff: "x = y \<longleftrightarrow> Re x = Re y \<and> Im1 x = Im1 y \<and> Im2 x = Im2 y \<and> Im3 x = Im3 y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x = y) = (quat.Re x = quat.Re y \<and> Im1 x = Im1 y \<and> Im2 x = Im2 y \<and> Im3 x = Im3 y)
[PROOF STEP]
by (auto intro: quat.expand)


[STATEMENT]
lemma (in jozsa) jozsa_transform_coeff_is_zero [simp]:
  assumes "i < dim_row U\<^sub>f \<and> j < dim_col U\<^sub>f"
  shows "(i\<noteq>j \<and> \<not>(i=j+1 \<and> odd i) \<and> \<not> (i=j-1 \<and> even i \<and> j\<ge>1)) \<longrightarrow> U\<^sub>f $$ (i,j) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i \<noteq> j \<and> \<not> (i = j + 1 \<and> odd i) \<and> \<not> (i = j - 1 \<and> even i \<and> 1 \<le> j) \<longrightarrow> U\<^sub>f $$ (i, j) = 0
[PROOF STEP]
using jozsa_transform_def assms
[PROOF STATE]
proof (prove)
using this:
U\<^sub>f \<equiv> Matrix.mat (2 ^ (n + 1)) (2 ^ (n + 1)) (\<lambda>x. of_nat (case x of (i, j) \<Rightarrow> if i = j then 1 - f (i div 2) else if i = j + 1 \<and> odd i then f (i div 2) else if i = j - 1 \<and> even i \<and> 1 \<le> j then f (i div 2) else 0))
i < dim_row U\<^sub>f \<and> j < dim_col U\<^sub>f

goal (1 subgoal):
 1. i \<noteq> j \<and> \<not> (i = j + 1 \<and> odd i) \<and> \<not> (i = j - 1 \<and> even i \<and> 1 \<le> j) \<longrightarrow> U\<^sub>f $$ (i, j) = 0
[PROOF STEP]
by auto


[STATEMENT]
lemma huntington_is_boolean_II:
   "class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. class.boolean_algebra_II uminus (\<sqinter>) (\<squnion>) \<bottom> \<top>
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (7 subgoals):
 1. \<And>x y. x \<sqinter> y = y \<sqinter> x
 2. \<And>x y z. x \<sqinter> (y \<sqinter> z) = x \<sqinter> y \<sqinter> z
 3. \<And>x y. x \<squnion> x \<sqinter> y = x
 4. \<And>x y. x \<sqinter> (x \<squnion> y) = x
 5. \<And>x y z. x \<squnion> y \<sqinter> z = (x \<squnion> y) \<sqinter> (x \<squnion> z)
 6. \<And>x. x \<squnion> - x = \<top>
 7. \<And>x. x \<sqinter> - x = \<bottom>
[PROOF STEP]
apply (metis inf_comm inf_assoc sup_absorb
             inf_absorb sup_inf_distrib1
             sup_compl inf_compl)+
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sign_idempotent [simp]: "sign p * sign p = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sign p * sign p = 1
[PROOF STEP]
by (simp add: sign_def)


[STATEMENT]
lemma unit_disc_fix_iff [simp]:
  assumes "unit_disc_fix M"
  shows "moebius_pt M ` unit_disc = unit_disc"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. moebius_pt M ` unit_disc = unit_disc
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M

goal (1 subgoal):
 1. moebius_pt M ` unit_disc = unit_disc
[PROOF STEP]
using unit_disc_fix_iff_ounit_circle[of M]
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M = (moebius_ocircline M ounit_circle = ounit_circle)

goal (1 subgoal):
 1. moebius_pt M ` unit_disc = unit_disc
[PROOF STEP]
unfolding unit_disc_def
[PROOF STATE]
proof (prove)
using this:
unit_disc_fix M
unit_disc_fix M = (moebius_ocircline M ounit_circle = ounit_circle)

goal (1 subgoal):
 1. moebius_pt M ` disc ounit_circle = disc ounit_circle
[PROOF STEP]
by (subst disc_moebius_ocircline[symmetric], simp)


[STATEMENT]
lemma aux2:
  fixes a b :: int
  assumes "b = t * b\<^sub>0 + s * a\<^sub>0" "q = a div b" "gcd a b = gcd a\<^sub>0 b\<^sub>0"
  shows "gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0
[PROOF STEP]
have "a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a - b * q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a - b * q
[PROOF STEP]
unfolding \<open>b = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a - (t * b\<^sub>0 + s * a\<^sub>0) * q
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a - b * q

goal (1 subgoal):
 1. gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a - b * q

goal (1 subgoal):
 1. gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0
[PROOF STEP]
have "a - b * q = a mod b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - b * q = a mod b
[PROOF STEP]
unfolding \<open>q = _\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a - b * (a div b) = a mod b
[PROOF STEP]
by (simp add: algebra_simps)
[PROOF STATE]
proof (state)
this:
a - b * q = a mod b

goal (1 subgoal):
 1. gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a mod b
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a mod b

goal (1 subgoal):
 1. gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0
[PROOF STEP]
unfolding \<open>gcd a b = _\<close>[symmetric]
[PROOF STATE]
proof (prove)
using this:
a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q)) = a mod b

goal (1 subgoal):
 1. gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a b
[PROOF STEP]
by (simp add: gcd_red_int[symmetric])
[PROOF STATE]
proof (state)
this:
gcd b (a - (a\<^sub>0 * (s * q) + b\<^sub>0 * (t * q))) = gcd a\<^sub>0 b\<^sub>0

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma eval_fact:
  "fact 0 = 1"
  "fact (Suc 0) = 1"
  "fact (numeral n) = numeral n * fact (pred_numeral n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fact 0 = (1::'a) &&& fact (Suc 0) = (1::'b) &&& fact (numeral n) = numeral n * fact (pred_numeral n)
[PROOF STEP]
by (simp, simp, simp_all only: numeral_eq_Suc fact_Suc,
      simp only: numeral_eq_Suc [symmetric] of_nat_numeral)


[STATEMENT]
theorem th_1: "\<forall> u. c_fold (c_unfold (Suc k) u) = u"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>u. c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
apply(induct k)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<forall>u. c_fold (c_unfold (Suc 0) u) = u
 2. \<And>k. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
apply(simp add: c_fold_2)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc (Suc k)) u) = u
[PROOF STEP]
apply(rule th_lm_3)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>k. \<forall>u. c_fold (c_unfold (Suc k) u) = u \<Longrightarrow> \<forall>u. c_fold (c_unfold (Suc k) u) = u
[PROOF STEP]
apply(assumption)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cosh_real_nonpos_less_iff: "x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> cosh x < cosh y \<longleftrightarrow> x > (y::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<le> 0; y \<le> 0\<rbrakk> \<Longrightarrow> (cosh x < cosh y) = (y < x)
[PROOF STEP]
using cosh_real_nonneg_less_iff[of "-x" "-y"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 \<le> - x; 0 \<le> - y\<rbrakk> \<Longrightarrow> (cosh (- x) < cosh (- y)) = (- x < - y)

goal (1 subgoal):
 1. \<lbrakk>x \<le> 0; y \<le> 0\<rbrakk> \<Longrightarrow> (cosh x < cosh y) = (y < x)
[PROOF STEP]
by simp


[STATEMENT]
lemma prod_topology_euclidean [simp]: "prod_topology euclidean euclidean = euclidean"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_topology euclidean euclidean = euclidean
[PROOF STEP]
by (simp add: prod_topology_def open_product_open_eq)


[STATEMENT]
lemma vertical_composite_iso_inverse [simp]:
  assumes "natural_isomorphism A B F G \<tau>"
  shows "vertical_composite.map A B \<tau> (inverse_transformation.map A B G \<tau>) = F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vertical_composite.map A B \<tau> (inverse_transformation.map A B G \<tau>) = F
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vertical_composite.map A B \<tau> (inverse_transformation.map A B G \<tau>) = F
[PROOF STEP]
interpret \<tau>: natural_isomorphism A B F G \<tau>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. natural_isomorphism A B F G \<tau>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
natural_isomorphism A B F G \<tau>

goal (1 subgoal):
 1. natural_isomorphism A B F G \<tau>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vertical_composite.map A B \<tau> (inverse_transformation.map A B G \<tau>) = F
[PROOF STEP]
interpret \<tau>': inverse_transformation A B F G \<tau>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse_transformation A B F G \<tau>
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vertical_composite.map A B \<tau> \<tau>'.map = F
[PROOF STEP]
interpret \<tau>\<tau>': vertical_composite A B F G F \<tau> \<tau>'.map
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vertical_composite A B F G F \<tau> \<tau>'.map
[PROOF STEP]
..
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<tau>\<tau>'.map = F
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<tau>\<tau>'.map = F
[PROOF STEP]
using \<tau>\<tau>'.is_natural_transformation \<tau>.F.as_nat_trans.natural_transformation_axioms
            \<tau>'.inverts_components \<tau>.B.comp_inv_arr \<tau>\<tau>'.map_simp_ide
[PROOF STATE]
proof (prove)
using this:
natural_transformation A B F F \<tau>\<tau>'.map
natural_transformation A B F F F
\<tau>.A.ide ?a \<Longrightarrow> \<tau>.B.inverse_arrows (\<tau> ?a) (\<tau>'.map ?a)
\<tau>.B.inverse_arrows ?f ?g \<Longrightarrow> B ?g ?f = \<tau>.B.dom ?f
\<tau>.A.ide ?a \<Longrightarrow> \<tau>\<tau>'.map ?a = B (\<tau>'.map ?a) (\<tau> ?a)

goal (1 subgoal):
 1. \<tau>\<tau>'.map = F
[PROOF STEP]
by (intro eqI, auto)
[PROOF STATE]
proof (state)
this:
\<tau>\<tau>'.map = F

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma intersectionEmptyRelationIntersectionEmpty:
  assumes "runiq (R^-1)" "runiq R" "X1 \<inter> X2 = {}"
  shows "(R``X1) \<inter> (R``X2) = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R `` X1 \<inter> R `` X2 = {}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
runiq (R\<inverse>)
runiq R
X1 \<inter> X2 = {}

goal (1 subgoal):
 1. R `` X1 \<inter> R `` X2 = {}
[PROOF STEP]
by (metis disj_Domain_imp_disj_Image inf_assoc inf_bot_right)


[STATEMENT]
lemma evens_odds_power_2:
  fixes x::'b and y::'b
  assumes "Suc (Suc (length (xs::'b list))) = 2 ^ l"
  shows " Suc(length (evens_odds b xs)) = 2 ^ (l-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (length (evens_odds b xs)) = 2 ^ (l - 1)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Suc (length (evens_odds b xs)) = 2 ^ (l - 1)
[PROOF STEP]
have "Suc(length (evens_odds b xs)) = length (evens_odds b (x#y#xs))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (length (evens_odds b xs)) = length (evens_odds b (x # y # xs))
[PROOF STEP]
by (metis (full_types)  evens_odds.simps(2) evens_odds.simps(3) length_Cons)
[PROOF STATE]
proof (state)
this:
Suc (length (evens_odds b xs)) = length (evens_odds b (x # y # xs))

goal (1 subgoal):
 1. Suc (length (evens_odds b xs)) = 2 ^ (l - 1)
[PROOF STEP]
have "length (x#y#xs) = 2^l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (x # y # xs) = 2 ^ l
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Suc (Suc (length xs)) = 2 ^ l

goal (1 subgoal):
 1. length (x # y # xs) = 2 ^ l
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length (x # y # xs) = 2 ^ l

goal (1 subgoal):
 1. Suc (length (evens_odds b xs)) = 2 ^ (l - 1)
[PROOF STEP]
have "length (evens_odds b (x#y#xs))  = 2^(l-1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (evens_odds b (x # y # xs)) = 2 ^ (l - 1)
[PROOF STEP]
apply (cases b)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. b \<Longrightarrow> length (evens_odds b (x # y # xs)) = 2 ^ (l - 1)
 2. \<not> b \<Longrightarrow> length (evens_odds b (x # y # xs)) = 2 ^ (l - 1)
[PROOF STEP]
apply (smt (z3) Suc_eq_plus1 Suc_pred \<open>length (x # y # xs) = 2 ^ l\<close> add.commute add_diff_cancel_left' assms filter_compehension_evens_odds gr0I le_add1 le_imp_less_Suc length_even_filter mult_2 nat_less_le power_diff power_eq_if power_one_right zero_neq_numeral)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> b \<Longrightarrow> length (evens_odds b (x # y # xs)) = 2 ^ (l - 1)
[PROOF STEP]
by (smt (z3) One_nat_def Suc_inject \<open>length (x # y # xs) = 2 ^ l\<close> assms evens_odds_length le_zero_eq nat.distinct(1) neq0_conv not_less_eq_eq pos2 power_Suc0_right power_diff_power_eq power_eq_if)
[PROOF STATE]
proof (state)
this:
length (evens_odds b (x # y # xs)) = 2 ^ (l - 1)

goal (1 subgoal):
 1. Suc (length (evens_odds b xs)) = 2 ^ (l - 1)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
length (evens_odds b (x # y # xs)) = 2 ^ (l - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
length (evens_odds b (x # y # xs)) = 2 ^ (l - 1)

goal (1 subgoal):
 1. Suc (length (evens_odds b xs)) = 2 ^ (l - 1)
[PROOF STEP]
by (metis \<open>Suc (length (evens_odds b xs)) = length (evens_odds b (x # y # xs))\<close>)
[PROOF STATE]
proof (state)
this:
Suc (length (evens_odds b xs)) = 2 ^ (l - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma trees_UNIV[simp]: "trees UNIV = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trees UNIV = UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trees UNIV = UNIV
[PROOF STEP]
have "t \<in> trees UNIV" for t :: "'a tree"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. t \<in> trees UNIV
[PROOF STEP]
by (induction t) (auto intro: trees.intros(2))
[PROOF STATE]
proof (state)
this:
?t \<in> trees UNIV

goal (1 subgoal):
 1. trees UNIV = UNIV
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?t \<in> trees UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?t \<in> trees UNIV

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

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma continuous_on_open_Un:
  "open s \<Longrightarrow> open t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>open s; open t; continuous_on s f; continuous_on t f\<rbrakk> \<Longrightarrow> continuous_on (s \<union> t) f
[PROOF STEP]
using continuous_on_open_Union [of "{s,t}"]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>sa. sa \<in> {s, t} \<Longrightarrow> open sa; \<And>sa. sa \<in> {s, t} \<Longrightarrow> continuous_on sa ?f\<rbrakk> \<Longrightarrow> continuous_on (\<Union> {s, t}) ?f

goal (1 subgoal):
 1. \<lbrakk>open s; open t; continuous_on s f; continuous_on t f\<rbrakk> \<Longrightarrow> continuous_on (s \<union> t) f
[PROOF STEP]
by auto


[STATEMENT]
lemma sublist_ext':
  \<open>(\<forall>i. lo\<le>i\<and>i\<le>hi \<longrightarrow> xs'!i=xs!i) \<Longrightarrow>
   length xs' = length xs \<Longrightarrow>
   lo \<le> hi \<Longrightarrow> Suc hi < length xs \<Longrightarrow>
   sublist xs' lo hi = sublist xs lo hi\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i. lo \<le> i \<and> i \<le> hi \<longrightarrow> xs' ! i = xs ! i; length xs' = length xs; lo \<le> hi; Suc hi < length xs\<rbrakk> \<Longrightarrow> WB_Sort.sublist xs' lo hi = WB_Sort.sublist xs lo hi
[PROOF STEP]
apply (simp add: sublist_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<forall>i. lo \<le> i \<and> i \<le> hi \<longrightarrow> xs' ! i = xs ! i; length xs' = length xs; lo \<le> hi; Suc hi < length xs\<rbrakk> \<Longrightarrow> take (Suc hi - lo) (drop lo xs') = take (Suc hi - lo) (drop lo xs)
[PROOF STEP]
apply (rule take_ext)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. \<lbrakk>\<forall>i. lo \<le> i \<and> i \<le> hi \<longrightarrow> xs' ! i = xs ! i; length xs' = length xs; lo \<le> hi; Suc hi < length xs\<rbrakk> \<Longrightarrow> \<forall>i<Suc hi - lo. drop lo xs' ! i = drop lo xs ! i
 2. \<lbrakk>\<forall>i. lo \<le> i \<and> i \<le> hi \<longrightarrow> xs' ! i = xs ! i; length xs' = length xs; lo \<le> hi; Suc hi < length xs\<rbrakk> \<Longrightarrow> Suc hi - lo < length (drop lo xs)
 3. \<lbrakk>\<forall>i. lo \<le> i \<and> i \<le> hi \<longrightarrow> xs' ! i = xs ! i; length xs' = length xs; lo \<le> hi; Suc hi < length xs\<rbrakk> \<Longrightarrow> Suc hi - lo < length (drop lo xs')
[PROOF STEP]
by auto


[STATEMENT]
lemma independent_span_bound:
  assumes f: "finite T"
    and i: "independent S"
    and sp: "S \<subseteq> span T"
  shows "finite S \<and> card S \<le> card T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<and> card S \<le> card T
[PROOF STEP]
by (metis exchange_lemma[OF f i sp] finite_subset card_mono)


[STATEMENT]
lemma mset_ran_swap: "\<lbrakk> i\<in>r; j\<in>r \<rbrakk>
  \<Longrightarrow> mset_ran (swap a i j) r = mset_ran a r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>i \<in> r; j \<in> r\<rbrakk> \<Longrightarrow> mset_ran (swap a i j) r = mset_ran a r
[PROOF STEP]
by (cases "finite r") (auto simp: swap_def mset_ran_subst_inside)


[STATEMENT]
lemma has_derivative_vector_1:
  assumes der_g: "(g has_derivative (\<lambda>x. x * g' a)) (at a within S)"
  shows "((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' a))
         (at ((vec a)::real^1) within vec ` S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' a)) (at (vec a) within vec ` S)
[PROOF STEP]
using der_g
[PROOF STATE]
proof (prove)
using this:
(g has_derivative (\<lambda>x. x * g' a)) (at a within S)

goal (1 subgoal):
 1. ((\<lambda>x. vec (g (x $ 1))) has_derivative (*\<^sub>R) (g' a)) (at (vec a) within vec ` S)
[PROOF STEP]
apply (auto simp: Deriv.has_derivative_within bounded_linear_scaleR_right norm_vector_1)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded_linear (\<lambda>x. x * g' a); ((\<lambda>y. (g y - (g a + (y - a) * g' a)) / \<bar>y - a\<bar>) \<longlongrightarrow> 0) (at a within S)\<rbrakk> \<Longrightarrow> ((\<lambda>y. (1 / \<bar>y $ 1 - a\<bar>) *\<^sub>R (vec (g (y $ 1)) - (vec (g a) + g' a *\<^sub>R (y - vec a)))) \<longlongrightarrow> 0) (at (vec a) within vec ` S)
[PROOF STEP]
apply (drule tendsto_at_within_vector_1, vector)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded_linear (\<lambda>x. x * g' a); ((\<lambda>y. \<chi>i. (g (y $ 1) - (g a + (y $ 1 - a) * g' a)) / \<bar>y $ 1 - a\<bar>) \<longlongrightarrow> (\<chi>i. 0)) (at (\<chi>i. a) within (\<lambda>x. \<chi>i. x) ` S)\<rbrakk> \<Longrightarrow> ((\<lambda>y. \<chi>i. (g (y $ 1) - (g a + g' a * (y $ i - a))) / \<bar>y $ 1 - a\<bar>) \<longlongrightarrow> (\<chi>i. 0)) (at (\<chi>i. a) within (\<lambda>x. \<chi>i. x) ` S)
[PROOF STEP]
apply (auto simp: algebra_simps eventually_at tendsto_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma sorted_iff_nth_mono_less:
  "sorted xs = (\<forall>i j. i < j \<longrightarrow> j < length xs \<longrightarrow> xs ! i \<le> xs ! j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted xs = (\<forall>i j. i < j \<longrightarrow> j < length xs \<longrightarrow> xs ! i \<le> xs ! j)
[PROOF STEP]
by (simp add: sorted_wrt_iff_nth_less)


[STATEMENT]
lemma boundedByInsert: "boundedBy N (insert (n,delta) B)     = (n < N & boundedBy N B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. boundedBy N (insert (n, delta) B) = (n < N \<and> boundedBy N B)
[PROOF STEP]
by(simp add: boundedBy_def)


[STATEMENT]
lemma [smt_arith_multiplication]:
  fixes A B :: real and p n :: real
  assumes "A \<le> B" "0 < n" "p > 0"
  shows "(A / n) * p \<le> (B / n) * p"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A / n * p \<le> B / n * p
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<le> B
0 < n
0 < p

goal (1 subgoal):
 1. A / n * p \<le> B / n * p
[PROOF STEP]
by (auto simp: field_simps)


[STATEMENT]
lemma gval_fold_equiv_gval_foldr:
  "gval (fold gAnd G (Bc True)) s = gval (foldr gAnd G (Bc True)) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gval (fold gAnd G (Bc True)) s = gval (foldr gAnd G (Bc True)) s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. gval (fold gAnd G (Bc True)) s = gval (foldr gAnd G (Bc True)) s
[PROOF STEP]
have "gval (fold gAnd G (Bc True)) s = gval (fold gAnd (rev G) (Bc True)) s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gval (fold gAnd G (Bc True)) s = gval (fold gAnd (rev G) (Bc True)) s
[PROOF STEP]
using gval_fold_equiv_fold_rev
[PROOF STATE]
proof (prove)
using this:
gval (fold gAnd ?G (Bc True)) ?s = gval (fold gAnd (rev ?G) (Bc True)) ?s

goal (1 subgoal):
 1. gval (fold gAnd G (Bc True)) s = gval (fold gAnd (rev G) (Bc True)) s
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
gval (fold gAnd G (Bc True)) s = gval (fold gAnd (rev G) (Bc True)) s

goal (1 subgoal):
 1. gval (fold gAnd G (Bc True)) s = gval (foldr gAnd G (Bc True)) s
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
gval (fold gAnd G (Bc True)) s = gval (fold gAnd (rev G) (Bc True)) s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
gval (fold gAnd G (Bc True)) s = gval (fold gAnd (rev G) (Bc True)) s

goal (1 subgoal):
 1. gval (fold gAnd G (Bc True)) s = gval (foldr gAnd G (Bc True)) s
[PROOF STEP]
by (simp add: foldr_conv_fold)
[PROOF STATE]
proof (state)
this:
gval (fold gAnd G (Bc True)) s = gval (foldr gAnd G (Bc True)) s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_nsets:
  assumes "bij_betw f A B"
  shows "bij_betw (\<lambda>X. f ` X) ([A]\<^bsup>n\<^esup>) ([B]\<^bsup>n\<^esup>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw ((`) f) ([A]\<^bsup>n\<^esup>) ([B]\<^bsup>n\<^esup>)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. bij_betw ((`) f) ([A]\<^bsup>n\<^esup>) ([B]\<^bsup>n\<^esup>)
[PROOF STEP]
have "(`) f ` [A]\<^bsup>n\<^esup> = [f ` A]\<^bsup>n\<^esup>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (`) f ` [A]\<^bsup>n\<^esup> = [f ` A]\<^bsup>n\<^esup>
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B

goal (1 subgoal):
 1. (`) f ` [A]\<^bsup>n\<^esup> = [f ` A]\<^bsup>n\<^esup>
[PROOF STEP]
apply (auto simp: nsets_def bij_betw_def image_iff card_image inj_on_subset)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. \<lbrakk>inj_on f A; B = f ` A; x \<subseteq> f ` A; finite x; n = card x\<rbrakk> \<Longrightarrow> \<exists>xa\<subseteq>A. finite xa \<and> card xa = card x \<and> x = f ` xa
[PROOF STEP]
by (metis card_image inj_on_finite order_refl subset_image_inj)
[PROOF STATE]
proof (state)
this:
(`) f ` [A]\<^bsup>n\<^esup> = [f ` A]\<^bsup>n\<^esup>

goal (1 subgoal):
 1. bij_betw ((`) f) ([A]\<^bsup>n\<^esup>) ([B]\<^bsup>n\<^esup>)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
bij_betw f A B
(`) f ` [A]\<^bsup>n\<^esup> = [f ` A]\<^bsup>n\<^esup>
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bij_betw f A B
(`) f ` [A]\<^bsup>n\<^esup> = [f ` A]\<^bsup>n\<^esup>

goal (1 subgoal):
 1. bij_betw ((`) f) ([A]\<^bsup>n\<^esup>) ([B]\<^bsup>n\<^esup>)
[PROOF STEP]
by (auto simp: bij_betw_def inj_on_nsets)
[PROOF STATE]
proof (state)
this:
bij_betw ((`) f) ([A]\<^bsup>n\<^esup>) ([B]\<^bsup>n\<^esup>)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inj_image_ord_of_nat: "inj (image ord_of_nat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj ((`) ord_of_nat)
[PROOF STEP]
by (intro injI) (simp add: inj_image_eq_iff inj_ord_of_nat)


[STATEMENT]
lemma nn_integral_null_delta:
  assumes "A \<in> sets M" "B \<in> sets M"
          "(A - B) \<union> (B - A) \<in> null_sets M"
  shows "(\<integral>\<^sup>+x \<in> A. f x \<partial>M) = (\<integral>\<^sup>+x \<in> B. f x \<partial>M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_nn_integral M A f = set_nn_integral M B f
[PROOF STEP]
proof (rule nn_integral_cong_AE)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. AE x in M. f x * indicator A x = f x * indicator B x
[PROOF STEP]
have *: "AE a in M. a \<notin> (A - B) \<union> (B - A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. AE a in M. a \<notin> A - B \<union> (B - A)
[PROOF STEP]
using assms(3) AE_not_in
[PROOF STATE]
proof (prove)
using this:
A - B \<union> (B - A) \<in> null_sets M
?N \<in> null_sets ?M \<Longrightarrow> AE x in ?M. x \<notin> ?N

goal (1 subgoal):
 1. AE a in M. a \<notin> A - B \<union> (B - A)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
AE a in M. a \<notin> A - B \<union> (B - A)

goal (1 subgoal):
 1. AE x in M. f x * indicator A x = f x * indicator B x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
AE a in M. a \<notin> A - B \<union> (B - A)
[PROOF STEP]
show \<open>AE x in M. f x * indicator A x = f x * indicator B x\<close>
[PROOF STATE]
proof (prove)
using this:
AE a in M. a \<notin> A - B \<union> (B - A)

goal (1 subgoal):
 1. AE x in M. f x * indicator A x = f x * indicator B x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
AE x in M. f x * indicator A x = f x * indicator B x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma lcm_pos_nat: "m > 0 \<Longrightarrow> n > 0 \<Longrightarrow> lcm m n > 0"
  for m n :: nat
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 < n\<rbrakk> \<Longrightarrow> 0 < lcm m n
[PROOF STEP]
using lcm_eq_0_iff [of m n]
[PROOF STATE]
proof (prove)
using this:
(lcm m n = 0) = (m = 0 \<or> n = 0)

goal (1 subgoal):
 1. \<lbrakk>0 < m; 0 < n\<rbrakk> \<Longrightarrow> 0 < lcm m n
[PROOF STEP]
by auto