[STATEMENT]
lemma card_extensional_funcset_inj_on:
  assumes "finite S" "finite T" "card S \<le> card T"
  shows "card {f \<in> extensional_funcset S T. inj_on f S} = fact (card T) div (fact (card T - card S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S} = fact (card T) div fact (card T - card S)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
finite T
card S \<le> card T

goal (1 subgoal):
 1. card {f \<in> S \<rightarrow>\<^sub>E T. inj_on f S} = fact (card T) div fact (card T - card S)
[PROOF STEP]
proof (induct S arbitrary: T rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>T. \<lbrakk>finite T; card {} \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> {} \<rightarrow>\<^sub>E T. inj_on f {}} = fact (card T) div fact (card T - card {})
 2. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:
finite T
card {} \<le> card T

goal (2 subgoals):
 1. \<And>T. \<lbrakk>finite T; card {} \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> {} \<rightarrow>\<^sub>E T. inj_on f {}} = fact (card T) div fact (card T - card {})
 2. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
finite T
card {} \<le> card T
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite T
card {} \<le> card T

goal (1 subgoal):
 1. card {f. f \<in> {} \<rightarrow>\<^sub>E T \<and> inj_on f {}} = fact (card T) div fact (card T - card {})
[PROOF STEP]
by (simp add: Collect_conv_if PiE_empty_domain)
[PROOF STATE]
proof (state)
this:
card {f. f \<in> {} \<rightarrow>\<^sub>E T \<and> inj_on f {}} = fact (card T) div fact (card T - card {})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
case (insert x S)
[PROOF STATE]
proof (state)
this:
finite S
x \<notin> S
\<lbrakk>finite ?T; card S \<le> card ?T\<rbrakk> \<Longrightarrow> card {f. f \<in> S \<rightarrow>\<^sub>E ?T \<and> inj_on f S} = fact (card ?T) div fact (card ?T - card S)
finite T
card (insert x S) \<le> card T

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
finite S
x \<notin> S
\<lbrakk>finite ?T; card S \<le> card ?T\<rbrakk> \<Longrightarrow> card {f. f \<in> S \<rightarrow>\<^sub>E ?T \<and> inj_on f S} = fact (card ?T) div fact (card ?T - card S)
finite T
card (insert x S) \<le> card T

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from \<open>finite T\<close>
[PROOF STATE]
proof (chain)
picking this:
finite T
[PROOF STEP]
have "finite (T - {x})"
[PROOF STATE]
proof (prove)
using this:
finite T

goal (1 subgoal):
 1. finite (T - {x})
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite (T - {x})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from \<open>finite S\<close> this
[PROOF STATE]
proof (chain)
picking this:
finite S
finite (T - {x})
[PROOF STEP]
have "finite (extensional_funcset S (T - {x}))"
[PROOF STATE]
proof (prove)
using this:
finite S
finite (T - {x})

goal (1 subgoal):
 1. finite (S \<rightarrow>\<^sub>E T - {x})
[PROOF STEP]
by (rule finite_PiE)
[PROOF STATE]
proof (state)
this:
finite (S \<rightarrow>\<^sub>E T - {x})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite (S \<rightarrow>\<^sub>E T - {x})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
have "{f : extensional_funcset S (T - {x}). inj_on f S} \<subseteq> (extensional_funcset S (T - {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {f \<in> S \<rightarrow>\<^sub>E T - {x}. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T - {x}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
{f \<in> S \<rightarrow>\<^sub>E T - {x}. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T - {x}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite (S \<rightarrow>\<^sub>E T - {x})
{f \<in> S \<rightarrow>\<^sub>E T - {x}. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T - {x}
[PROOF STEP]
have "finite {f : extensional_funcset S (T - {x}). inj_on f S}"
[PROOF STATE]
proof (prove)
using this:
finite (S \<rightarrow>\<^sub>E T - {x})
{f \<in> S \<rightarrow>\<^sub>E T - {x}. inj_on f S} \<subseteq> S \<rightarrow>\<^sub>E T - {x}

goal (1 subgoal):
 1. finite {f \<in> S \<rightarrow>\<^sub>E T - {x}. inj_on f S}
[PROOF STEP]
by (auto intro: finite_subset)
[PROOF STATE]
proof (state)
this:
finite {f \<in> S \<rightarrow>\<^sub>E T - {x}. inj_on f S}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
finite {f \<in> S \<rightarrow>\<^sub>E T - {?xa2}. inj_on f S}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
note finite_delete = this
[PROOF STATE]
proof (state)
this:
finite {f \<in> S \<rightarrow>\<^sub>E T - {?xa2}. inj_on f S}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from insert
[PROOF STATE]
proof (chain)
picking this:
finite S
x \<notin> S
\<lbrakk>finite ?T; card S \<le> card ?T\<rbrakk> \<Longrightarrow> card {f. f \<in> S \<rightarrow>\<^sub>E ?T \<and> inj_on f S} = fact (card ?T) div fact (card ?T - card S)
finite T
card (insert x S) \<le> card T
[PROOF STEP]
have hyps: "\<forall>y \<in> T. card ({g. g \<in> extensional_funcset S (T - {y}) \<and> inj_on g S}) = fact (card T - 1) div fact ((card T - 1) - card S)"(is "\<forall> _ \<in> T. _ = ?k")
[PROOF STATE]
proof (prove)
using this:
finite S
x \<notin> S
\<lbrakk>finite ?T; card S \<le> card ?T\<rbrakk> \<Longrightarrow> card {f. f \<in> S \<rightarrow>\<^sub>E ?T \<and> inj_on f S} = fact (card ?T) div fact (card ?T - card S)
finite T
card (insert x S) \<le> card T

goal (1 subgoal):
 1. \<forall>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S} = fact (card T - 1) div fact (card T - 1 - card S)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<forall>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S} = fact (card T - 1) div fact (card T - 1 - card S)

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from extensional_funcset_extend_domain_inj_on_eq[OF \<open>x \<notin> S\<close>]
[PROOF STATE]
proof (chain)
picking this:
{f \<in> insert x S \<rightarrow>\<^sub>E ?T. inj_on f (insert x S)} = (\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> ?T \<and> g \<in> S \<rightarrow>\<^sub>E ?T - {y} \<and> inj_on g S}
[PROOF STEP]
have "card {f. f \<in> extensional_funcset (insert x S) T \<and> inj_on f (insert x S)} =
    card ((\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> T \<and> g \<in> extensional_funcset S (T - {y}) \<and> inj_on g S})"
[PROOF STATE]
proof (prove)
using this:
{f \<in> insert x S \<rightarrow>\<^sub>E ?T. inj_on f (insert x S)} = (\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> ?T \<and> g \<in> S \<rightarrow>\<^sub>E ?T - {y} \<and> inj_on g S}

goal (1 subgoal):
 1. card {f \<in> insert x S \<rightarrow>\<^sub>E T. inj_on f (insert x S)} = card ((\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S})
[PROOF STEP]
by metis
[PROOF STATE]
proof (state)
this:
card {f \<in> insert x S \<rightarrow>\<^sub>E T. inj_on f (insert x S)} = card ((\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {f \<in> insert x S \<rightarrow>\<^sub>E T. inj_on f (insert x S)} = card ((\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from extensional_funcset_extend_domain_inj_onI[OF \<open>x \<notin> S\<close>, of T]
[PROOF STATE]
proof (chain)
picking this:
inj_on (\<lambda>(y, g). g(x := y)) {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}
[PROOF STEP]
have "\<dots> =  card {(y, g). y \<in> T \<and> g \<in> extensional_funcset S (T - {y}) \<and> inj_on g S}"
[PROOF STATE]
proof (prove)
using this:
inj_on (\<lambda>(y, g). g(x := y)) {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}

goal (1 subgoal):
 1. card ((\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}) = card {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}
[PROOF STEP]
by (simp add: card_image)
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}) = card {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card ((\<lambda>(y, g). g(x := y)) ` {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}) = card {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
have "card {(y, g). y \<in> T \<and> g \<in> extensional_funcset S (T - {y}) \<and> inj_on g S} =
    card {(y, g). y \<in> T \<and> g \<in> {f \<in> extensional_funcset S (T - {y}). inj_on f S}}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S} = card {(y, g). y \<in> T \<and> g \<in> {f \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on f S}}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S} = card {(y, g). y \<in> T \<and> g \<in> {f \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on f S}}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {(y, g). y \<in> T \<and> g \<in> S \<rightarrow>\<^sub>E T - {y} \<and> inj_on g S} = card {(y, g). y \<in> T \<and> g \<in> {f \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on f S}}

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from \<open>finite T\<close> finite_delete
[PROOF STATE]
proof (chain)
picking this:
finite T
finite {f \<in> S \<rightarrow>\<^sub>E T - {?xa2}. inj_on f S}
[PROOF STEP]
have "... = (\<Sum>y \<in> T. card {g. g \<in> extensional_funcset S (T - {y}) \<and>  inj_on g S})"
[PROOF STATE]
proof (prove)
using this:
finite T
finite {f \<in> S \<rightarrow>\<^sub>E T - {?xa2}. inj_on f S}

goal (1 subgoal):
 1. card {(y, g). y \<in> T \<and> g \<in> {f \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on f S}} = (\<Sum>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S})
[PROOF STEP]
by (subst card_product_dependent) auto
[PROOF STATE]
proof (state)
this:
card {(y, g). y \<in> T \<and> g \<in> {f \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on f S}} = (\<Sum>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {(y, g). y \<in> T \<and> g \<in> {f \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on f S}} = (\<Sum>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S})

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
from hyps
[PROOF STATE]
proof (chain)
picking this:
\<forall>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S} = fact (card T - 1) div fact (card T - 1 - card S)
[PROOF STEP]
have "... = (card T) * ?k"
[PROOF STATE]
proof (prove)
using this:
\<forall>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S} = fact (card T - 1) div fact (card T - 1 - card S)

goal (1 subgoal):
 1. (\<Sum>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S}) = card T * (fact (card T - 1) div fact (card T - 1 - card S))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S}) = card T * (fact (card T - 1) div fact (card T - 1 - card S))

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>y\<in>T. card {g \<in> S \<rightarrow>\<^sub>E T - {y}. inj_on g S}) = card T * (fact (card T - 1) div fact (card T - 1 - card S))

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
have "... = card T * fact (card T - 1) div fact (card T - card (insert x S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card T * (fact (card T - 1) div fact (card T - 1 - card S)) = card T * fact (card T - 1) div fact (card T - card (insert x S))
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite S
x \<notin> S
\<lbrakk>finite ?T; card S \<le> card ?T\<rbrakk> \<Longrightarrow> card {f. f \<in> S \<rightarrow>\<^sub>E ?T \<and> inj_on f S} = fact (card ?T) div fact (card ?T - card S)
finite T
card (insert x S) \<le> card T

goal (1 subgoal):
 1. card T * (fact (card T - 1) div fact (card T - 1 - card S)) = card T * fact (card T - 1) div fact (card T - card (insert x S))
[PROOF STEP]
unfolding div_mult1_eq[of "card T" "fact (card T - 1)"]
[PROOF STATE]
proof (prove)
using this:
finite S
x \<notin> S
\<lbrakk>finite ?T; card S \<le> card ?T\<rbrakk> \<Longrightarrow> card {f. f \<in> S \<rightarrow>\<^sub>E ?T \<and> inj_on f S} = fact (card ?T) div fact (card ?T - card S)
finite T
card (insert x S) \<le> card T

goal (1 subgoal):
 1. card T * (fact (card T - 1) div fact (card T - 1 - card S)) = card T * (fact (card T - 1) div fact (card T - card (insert x S))) + card T * (fact (card T - 1) mod fact (card T - card (insert x S))) div fact (card T - card (insert x S))
[PROOF STEP]
by (simp add: fact_mod)
[PROOF STATE]
proof (state)
this:
card T * (fact (card T - 1) div fact (card T - 1 - card S)) = card T * fact (card T - 1) div fact (card T - card (insert x S))

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card T * (fact (card T - 1) div fact (card T - 1 - card S)) = card T * fact (card T - 1) div fact (card T - card (insert x S))

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
have "... = fact (card T) div fact (card T - card (insert x S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card T * fact (card T - 1) div fact (card T - card (insert x S)) = fact (card T) div fact (card T - card (insert x S))
[PROOF STEP]
using insert
[PROOF STATE]
proof (prove)
using this:
finite S
x \<notin> S
\<lbrakk>finite ?T; card S \<le> card ?T\<rbrakk> \<Longrightarrow> card {f. f \<in> S \<rightarrow>\<^sub>E ?T \<and> inj_on f S} = fact (card ?T) div fact (card ?T - card S)
finite T
card (insert x S) \<le> card T

goal (1 subgoal):
 1. card T * fact (card T - 1) div fact (card T - card (insert x S)) = fact (card T) div fact (card T - card (insert x S))
[PROOF STEP]
by (simp add: fact_reduce[of "card T"])
[PROOF STATE]
proof (state)
this:
card T * fact (card T - 1) div fact (card T - card (insert x S)) = fact (card T) div fact (card T - card (insert x S))

goal (1 subgoal):
 1. \<And>x F T. \<lbrakk>finite F; x \<notin> F; \<And>T. \<lbrakk>finite T; card F \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> F \<rightarrow>\<^sub>E T. inj_on f F} = fact (card T) div fact (card T - card F); finite T; card (insert x F) \<le> card T\<rbrakk> \<Longrightarrow> card {f \<in> insert x F \<rightarrow>\<^sub>E T. inj_on f (insert x F)} = fact (card T) div fact (card T - card (insert x F))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {f \<in> insert x S \<rightarrow>\<^sub>E T. inj_on f (insert x S)} = fact (card T) div fact (card T - card (insert x S))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
card {f \<in> insert x S \<rightarrow>\<^sub>E T. inj_on f (insert x S)} = fact (card T) div fact (card T - card (insert x S))

goal (1 subgoal):
 1. card {f. f \<in> insert x S \<rightarrow>\<^sub>E T \<and> inj_on f (insert x S)} = fact (card T) div fact (card T - card (insert x S))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {f. f \<in> insert x S \<rightarrow>\<^sub>E T \<and> inj_on f (insert x S)} = fact (card T) div fact (card T - card (insert x S))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem orbit_stabiliser:
  assumes finite: "finite (carrier G)"
  shows "order G = card (orbit x) * card (stabiliser x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order G = card (orbit x) * card (stabiliser x)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. order G = card (orbit x) * card (stabiliser x)
[PROOF STEP]
have "card (carrier (G LMod (stabiliser x))) = card (orbit x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (G LMod stabiliser x)) = card (orbit x)
[PROOF STEP]
using bij_betw_same_card orbit_stabiliser_bij
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B
bij_betw (\<lambda>H. rep H \<odot> ?x) (carrier (G LMod stabiliser ?x)) (orbit ?x)

goal (1 subgoal):
 1. card (carrier (G LMod stabiliser x)) = card (orbit x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (carrier (G LMod stabiliser x)) = card (orbit x)

goal (1 subgoal):
 1. order G = card (orbit x) * card (stabiliser x)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
card (carrier (G LMod stabiliser x)) = card (orbit x)

goal (1 subgoal):
 1. order G = card (orbit x) * card (stabiliser x)
[PROOF STEP]
have "card (carrier (G LMod (stabiliser x))) * card (stabiliser x)  = order G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (carrier (G LMod stabiliser x)) * card (stabiliser x) = order G
[PROOF STEP]
using finite stabiliser_subgroup l_lagrange
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)
subgroup (stabiliser ?x) G
\<lbrakk>finite (carrier G); subgroup ?H G\<rbrakk> \<Longrightarrow> card (lcosets ?H) * card ?H = order G

goal (1 subgoal):
 1. card (carrier (G LMod stabiliser x)) * card (stabiliser x) = order G
[PROOF STEP]
unfolding LFactGroup_def
[PROOF STATE]
proof (prove)
using this:
finite (carrier G)
subgroup (stabiliser ?x) G
\<lbrakk>finite (carrier G); subgroup ?H G\<rbrakk> \<Longrightarrow> card (lcosets ?H) * card ?H = order G

goal (1 subgoal):
 1. card (carrier \<lparr>carrier = lcosets stabiliser x, mult = (<#>), one = stabiliser x\<rparr>) * card (stabiliser x) = order G
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (carrier (G LMod stabiliser x)) * card (stabiliser x) = order G

goal (1 subgoal):
 1. order G = card (orbit x) * card (stabiliser x)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
card (carrier (G LMod stabiliser x)) = card (orbit x)
card (carrier (G LMod stabiliser x)) * card (stabiliser x) = order G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card (carrier (G LMod stabiliser x)) = card (orbit x)
card (carrier (G LMod stabiliser x)) * card (stabiliser x) = order G

goal (1 subgoal):
 1. order G = card (orbit x) * card (stabiliser x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
order G = card (orbit x) * card (stabiliser x)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem card_partitions_with_k_parts:
  "card {N. number_partition n N \<and> size N = k} = Partition n k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
have "bij_betw count {N. number_partition n N \<and> size N = k} {p. p partitions n \<and> sum p {..n} = k}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw count {N. number_partition n N \<and> size N = k} {p. p partitions n \<and> sum p {..n} = k}
[PROOF STEP]
by (rule bij_betw_multiset_number_partition_with_size)
[PROOF STATE]
proof (state)
this:
bij_betw count {N. number_partition n N \<and> size N = k} {p. p partitions n \<and> sum p {..n} = k}

goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
bij_betw count {N. number_partition n N \<and> size N = k} {p. p partitions n \<and> sum p {..n} = k}
[PROOF STEP]
have "card {N. number_partition n N \<and> size N = k} = card {p. p partitions n \<and> sum p {..n} = k}"
[PROOF STATE]
proof (prove)
using this:
bij_betw count {N. number_partition n N \<and> size N = k} {p. p partitions n \<and> sum p {..n} = k}

goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = card {p. p partitions n \<and> sum p {..n} = k}
[PROOF STEP]
by (rule bij_betw_same_card)
[PROOF STATE]
proof (state)
this:
card {N. number_partition n N \<and> size N = k} = card {p. p partitions n \<and> sum p {..n} = k}

goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
card {N. number_partition n N \<and> size N = k} = card {p. p partitions n \<and> sum p {..n} = k}

goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
have "\<dots> = Partition n k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card {p. p partitions n \<and> sum p {..n} = k} = Partition n k
[PROOF STEP]
by (rule card_partitions_k_parts)
[PROOF STATE]
proof (state)
this:
card {p. p partitions n \<and> sum p {..n} = k} = Partition n k

goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
card {N. number_partition n N \<and> size N = k} = Partition n k

goal (1 subgoal):
 1. card {N. number_partition n N \<and> size N = k} = Partition n k
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
card {N. number_partition n N \<and> size N = k} = Partition n k

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma norm_add_rule_thm:
  fixes x1 x2 :: "'a::real_normed_vector"
  shows "norm x1 \<le> b1 \<Longrightarrow> norm x2 \<le> b2 \<Longrightarrow> norm (x1 + x2) \<le> b1 + b2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>norm x1 \<le> b1; norm x2 \<le> b2\<rbrakk> \<Longrightarrow> norm (x1 + x2) \<le> b1 + b2
[PROOF STEP]
by (rule order_trans [OF norm_triangle_ineq add_mono])


[STATEMENT]
lemma op_norm_triangle: "\<parallel>A + B\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) + (\<parallel>B\<parallel>\<^sub>o\<^sub>p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<parallel>A + B\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) + (\<parallel>B\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
using onorm_triangle[OF blin_matrix_vector_mult[of A] blin_matrix_vector_mult[of B]]
    matrix_vector_mult_add_rdistrib[symmetric, of A _ B]
[PROOF STATE]
proof (prove)
using this:
onorm (\<lambda>x. A *v x + B *v x) \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) + (\<parallel>B\<parallel>\<^sub>o\<^sub>p)
A *v ?x + B *v ?x = (A + B) *v ?x

goal (1 subgoal):
 1. \<parallel>A + B\<parallel>\<^sub>o\<^sub>p \<le> (\<parallel>A\<parallel>\<^sub>o\<^sub>p) + (\<parallel>B\<parallel>\<^sub>o\<^sub>p)
[PROOF STEP]
by simp


[STATEMENT]
lemma matrix_inv_mult:
  fixes A::"'a::{semiring_1}^'n^'n"
  and B::"'a::{semiring_1}^'n^'n"
  assumes "invertible A" and "invertible B"
  shows "matrix_inv (A ** B) = matrix_inv B ** matrix_inv A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv (A ** B) = matrix_inv B ** matrix_inv A
[PROOF STEP]
proof (rule matrix_inv_unique[of "A**B"])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. A ** B ** (matrix_inv B ** matrix_inv A) = mat (1::'a)
 2. matrix_inv B ** matrix_inv A ** (A ** B) = mat (1::'a)
[PROOF STEP]
show "A ** B ** (matrix_inv B ** matrix_inv A) = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A ** B ** (matrix_inv B ** matrix_inv A) = mat (1::'a)
[PROOF STEP]
by (metis assms(1) assms(2) matrix_inv_right matrix_mul_assoc matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
A ** B ** (matrix_inv B ** matrix_inv A) = mat (1::'a)

goal (1 subgoal):
 1. matrix_inv B ** matrix_inv A ** (A ** B) = mat (1::'a)
[PROOF STEP]
show " matrix_inv B ** matrix_inv A ** (A ** B) = mat 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. matrix_inv B ** matrix_inv A ** (A ** B) = mat (1::'a)
[PROOF STEP]
by (metis assms(1) assms(2) matrix_inv_left matrix_mul_assoc matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
matrix_inv B ** matrix_inv A ** (A ** B) = mat (1::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Cauchy_Schwarz_complex_vec_norm:
assumes "dim_vec x = dim_vec y"
shows "cmod (inner_prod x y) \<le> vec_norm x * vec_norm y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
have x: "x \<in> carrier_vec (dim_vec x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<in> carrier_vec (dim_vec x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec (dim_vec x)

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x \<in> carrier_vec (dim_vec x)

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
have y: "y \<in> carrier_vec (dim_vec x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. y \<in> carrier_vec (dim_vec x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
dim_vec x = dim_vec y

goal (1 subgoal):
 1. y \<in> carrier_vec (dim_vec x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
y \<in> carrier_vec (dim_vec x)

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier_vec (dim_vec x)
y \<in> carrier_vec (dim_vec x)
[PROOF STEP]
have "(cmod (inner_prod x y))\<^sup>2 = inner_prod x y * inner_prod y x"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier_vec (dim_vec x)
y \<in> carrier_vec (dim_vec x)

goal (1 subgoal):
 1. complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) = Complex_Matrix.inner_prod x y * Complex_Matrix.inner_prod y x
[PROOF STEP]
using complex_norm_square
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier_vec (dim_vec x)
y \<in> carrier_vec (dim_vec x)
complex_of_real ((cmod ?z)\<^sup>2) = ?z * cnj ?z

goal (1 subgoal):
 1. complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) = Complex_Matrix.inner_prod x y * Complex_Matrix.inner_prod y x
[PROOF STEP]
by (metis inner_prod_swap mult_conj_cmod_square)
[PROOF STATE]
proof (state)
this:
complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) = Complex_Matrix.inner_prod x y * Complex_Matrix.inner_prod y x

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) = Complex_Matrix.inner_prod x y * Complex_Matrix.inner_prod y x

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
have "... \<le> inner_prod x x * inner_prod y y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Complex_Matrix.inner_prod x y * Complex_Matrix.inner_prod y x \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y
[PROOF STEP]
using Cauchy_Schwarz_complex_vec x y
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x \<in> carrier_vec ?n; ?y \<in> carrier_vec ?n\<rbrakk> \<Longrightarrow> Complex_Matrix.inner_prod ?x ?y * Complex_Matrix.inner_prod ?y ?x \<le> Complex_Matrix.inner_prod ?x ?x * Complex_Matrix.inner_prod ?y ?y
x \<in> carrier_vec (dim_vec x)
y \<in> carrier_vec (dim_vec x)

goal (1 subgoal):
 1. Complex_Matrix.inner_prod x y * Complex_Matrix.inner_prod y x \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
Complex_Matrix.inner_prod x y * Complex_Matrix.inner_prod y x \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y
[PROOF STEP]
have "(cmod (inner_prod x y))\<^sup>2 \<le> inner_prod x x * inner_prod y y"
[PROOF STATE]
proof (prove)
using this:
complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y

goal (1 subgoal):
 1. complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
hence "(cmod (inner_prod x y))\<^sup>2 \<le> Re (inner_prod x x) * Re (inner_prod y y)"
[PROOF STATE]
proof (prove)
using this:
complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y

goal (1 subgoal):
 1. (cmod (Complex_Matrix.inner_prod x y))\<^sup>2 \<le> Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y)
[PROOF STEP]
using less_eq_complex_def
[PROOF STATE]
proof (prove)
using this:
complex_of_real ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> Complex_Matrix.inner_prod x x * Complex_Matrix.inner_prod y y
(?x \<le> ?y) = (Re ?x \<le> Re ?y \<and> Im ?x = Im ?y)

goal (1 subgoal):
 1. (cmod (Complex_Matrix.inner_prod x y))\<^sup>2 \<le> Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(cmod (Complex_Matrix.inner_prod x y))\<^sup>2 \<le> Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y)

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
hence "sqrt ((cmod (inner_prod x y))\<^sup>2) \<le>
    sqrt (Re (inner_prod x x) * Re (inner_prod y y))"
[PROOF STATE]
proof (prove)
using this:
(cmod (Complex_Matrix.inner_prod x y))\<^sup>2 \<le> Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y)

goal (1 subgoal):
 1. sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y))
[PROOF STEP]
using real_sqrt_le_iff
[PROOF STATE]
proof (prove)
using this:
(cmod (Complex_Matrix.inner_prod x y))\<^sup>2 \<le> Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y)
(sqrt ?x \<le> sqrt ?y) = (?x \<le> ?y)

goal (1 subgoal):
 1. sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y))
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y))

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y))

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
have "... =  sqrt (Re (inner_prod x x)) * sqrt (Re (inner_prod y y))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt (Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y)) = sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))
[PROOF STEP]
by (simp add: real_sqrt_mult)
[PROOF STATE]
proof (state)
this:
sqrt (Re (Complex_Matrix.inner_prod x x) * Re (Complex_Matrix.inner_prod y y)) = sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))
[PROOF STEP]
have "sqrt ((cmod (inner_prod x y))\<^sup>2) \<le>
    sqrt (Re (inner_prod x x)) * sqrt (Re (inner_prod y y))"
[PROOF STATE]
proof (prove)
using this:
sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))

goal (1 subgoal):
 1. sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
using less_eq_complex_def
[PROOF STATE]
proof (prove)
using this:
sqrt ((cmod (Complex_Matrix.inner_prod x y))\<^sup>2) \<le> sqrt (Re (Complex_Matrix.inner_prod x x)) * sqrt (Re (Complex_Matrix.inner_prod y y))
(?x \<le> ?y) = (Re ?x \<le> Re ?y \<and> Im ?x = Im ?y)

goal (1 subgoal):
 1. complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y
[PROOF STEP]
by (simp add: vec_norm_def)
[PROOF STATE]
proof (state)
this:
complex_of_real (cmod (Complex_Matrix.inner_prod x y)) \<le> vec_norm x * vec_norm y

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem inverse_triangle_num_sums: "(\<lambda>n. 1 / triangle_num (Suc n)) sums 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
have "(\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) sums
          (inverse (real (Suc 0)) - 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) sums (inverse (real (Suc 0)) - 0)
[PROOF STEP]
by (intro telescope_sums' LIMSEQ_inverse_real_of_nat)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) sums (inverse (real (Suc 0)) - 0)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) sums (inverse (real (Suc 0)) - 0)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
have "(\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) =
               (\<lambda>n. 1 / real (2 * triangle_num (Suc n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) = (\<lambda>n. 1 / real (2 * triangle_num (Suc n)))
[PROOF STEP]
by (auto simp: field_simps triangle_num_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) = (\<lambda>n. 1 / real (2 * triangle_num (Suc n)))

goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. inverse (real (Suc n)) - inverse (real (Suc (Suc n)))) = (\<lambda>n. 1 / real (2 * triangle_num (Suc n)))

goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
have "inverse (real (Suc 0)) - 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (real (Suc 0)) - 0 = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
inverse (real (Suc 0)) - 0 = 1

goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. 1 / real (2 * triangle_num (Suc n))) sums 1
[PROOF STEP]
have "(\<lambda>n. 2 * (1 / real (2 * triangle_num (Suc n)))) sums (2 * 1)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. 1 / real (2 * triangle_num (Suc n))) sums 1

goal (1 subgoal):
 1. (\<lambda>n. 2 * (1 / real (2 * triangle_num (Suc n)))) sums (2 * 1)
[PROOF STEP]
by (intro sums_mult)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 2 * (1 / real (2 * triangle_num (Suc n)))) sums (2 * 1)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. 2 * (1 / real (2 * triangle_num (Suc n)))) sums (2 * 1)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / real (triangle_num (Suc n))) sums 2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inner_prod_expand:
  assumes "dim_vec a = dim_vec b" and "dim_vec a = dim_vec c" and "dim_vec a = dim_vec d"
  shows "\<langle>a + b|c + d\<rangle> = \<langle>a|c\<rangle> + \<langle>a|d\<rangle> + \<langle>b|c\<rangle> + \<langle>b|d\<rangle>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<langle>a + b|c + d\<rangle> = \<langle>a|c\<rangle> + \<langle>a|d\<rangle> + \<langle>b|c\<rangle> + \<langle>b|d\<rangle>
[PROOF STEP]
apply (simp add: inner_prod_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec d. cnj ((a + b) $ i) * (c $ i + d $ i)) = (\<Sum>i = 0..<dim_vec c. cnj (a $ i) * c $ i) + (\<Sum>i = 0..<dim_vec d. cnj (a $ i) * d $ i) + (\<Sum>i = 0..<dim_vec c. cnj (b $ i) * c $ i) + (\<Sum>i = 0..<dim_vec d. cnj (b $ i) * d $ i)
[PROOF STEP]
using assms sum.cong
[PROOF STATE]
proof (prove)
using this:
dim_vec a = dim_vec b
dim_vec a = dim_vec c
dim_vec a = dim_vec d
\<lbrakk>?A = ?B; \<And>x. x \<in> ?B \<Longrightarrow> ?g x = ?h x\<rbrakk> \<Longrightarrow> sum ?g ?A = sum ?h ?B

goal (1 subgoal):
 1. (\<Sum>i = 0..<dim_vec d. cnj ((a + b) $ i) * (c $ i + d $ i)) = (\<Sum>i = 0..<dim_vec c. cnj (a $ i) * c $ i) + (\<Sum>i = 0..<dim_vec d. cnj (a $ i) * d $ i) + (\<Sum>i = 0..<dim_vec c. cnj (b $ i) * c $ i) + (\<Sum>i = 0..<dim_vec d. cnj (b $ i) * d $ i)
[PROOF STEP]
by (simp add: sum.distrib algebra_simps)


[STATEMENT]
lemma neg_prod_sum_lt:
  fixes c :: "'a::linordered_field"
  assumes "c < 0"
  shows "c * x + t < 0 \<equiv> x > (- 1 / c) * t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
have "c * x + t < 0 \<longleftrightarrow> c * x < - t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c * x + t < (0::'a)) = (c * x < - t)
[PROOF STEP]
by (subst less_iff_diff_less_0 [of "c * x" "- t"]) simp
[PROOF STATE]
proof (state)
this:
(c * x + t < (0::'a)) = (c * x < - t)

goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * x + t < (0::'a)) = (c * x < - t)

goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
have "\<dots> \<longleftrightarrow> - t / c < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (c * x < - t) = (- t / c < x)
[PROOF STEP]
by (simp only: neg_divide_less_eq[OF \<open>c < 0\<close>] algebra_simps)
[PROOF STATE]
proof (state)
this:
(c * x < - t) = (- t / c < x)

goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(c * x < - t) = (- t / c < x)

goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (- 1 / c) * t < x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- t / c < x) = (- (1::'a) / c * t < x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(- t / c < x) = (- (1::'a) / c * t < x)

goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(c * x + t < (0::'a)) = (- (1::'a) / c * t < x)
[PROOF STEP]
show "PROP ?thesis"
[PROOF STATE]
proof (prove)
using this:
(c * x + t < (0::'a)) = (- (1::'a) / c * t < x)

goal (1 subgoal):
 1. c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c * x + t < (0::'a) \<equiv> - (1::'a) / c * t < x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rank_transpose:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  shows  "rank (transpose A) = rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (Finite_Cartesian_Product.transpose A) = rank A
[PROOF STEP]
by (metis rank_def rank_eq_dim_col_space row_rank_def row_space_eq_col_space_transpose)


[STATEMENT]
lemma setdist_eq_0_closed_compact:
  assumes S: "closed S" and T: "compact T"
    shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (setdist S T = 0) = (S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {})
[PROOF STEP]
using setdist_eq_0_compact_closed [OF T S]
[PROOF STATE]
proof (prove)
using this:
(setdist T S = 0) = (T = {} \<or> S = {} \<or> T \<inter> S \<noteq> {})

goal (1 subgoal):
 1. (setdist S T = 0) = (S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {})
[PROOF STEP]
by (metis Int_commute setdist_sym)


[STATEMENT]
lemma pi_machin: "pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)
[PROOF STEP]
using machin
[PROOF STATE]
proof (prove)
using this:
pi / 4 = 4 * arctan (1 / 5) - arctan (1 / 239)

goal (1 subgoal):
 1. pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)
[PROOF STEP]
by simp


[STATEMENT]
lemma row_space_eq_col_space_transpose:
  fixes A::"'a::{field}^'columns^'rows"
  shows "row_space A = col_space (transpose A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. row_space A = col_space (Finite_Cartesian_Product.transpose A)
[PROOF STEP]
unfolding col_space_def row_space_def columns_transpose[of A]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.span (rows A) = vec.span (rows A)
[PROOF STEP]
..


[STATEMENT]
lemma contour_integral_midpoint:
  assumes "continuous_on (closed_segment a b) f"
  shows "contour_integral (linepath a b) f =
         contour_integral (linepath a (midpoint a b)) f + contour_integral (linepath (midpoint a b) b) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a b) f = contour_integral (linepath a (midpoint a b)) f + contour_integral (linepath (midpoint a b) b) f
[PROOF STEP]
proof (rule contour_integral_split)
[PROOF STATE]
proof (state)
goal (4 subgoals):
 1. continuous_on (closed_segment a b) f
 2. 0 \<le> ?k
 3. ?k \<le> 1
 4. midpoint a b - a = ?k *\<^sub>R (b - a)
[PROOF STEP]
show "midpoint a b - a = (1/2) *\<^sub>R (b - a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. midpoint a b - a = (1 / 2) *\<^sub>R (b - a)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
continuous_on (closed_segment a b) f

goal (1 subgoal):
 1. midpoint a b - a = (1 / 2) *\<^sub>R (b - a)
[PROOF STEP]
by (auto simp: midpoint_def scaleR_conv_of_real)
[PROOF STATE]
proof (state)
this:
midpoint a b - a = (1 / 2) *\<^sub>R (b - a)

goal (3 subgoals):
 1. continuous_on (closed_segment a b) f
 2. 0 \<le> 1 / 2
 3. 1 / 2 \<le> 1
[PROOF STEP]
qed (use assms in auto)


[STATEMENT]
lemma trace_outer_prod:
  fixes v w :: "('a::conjugatable_field vec)"
  assumes v: "v \<in> carrier_vec n" and w: "w \<in> carrier_vec n"
  shows "trace (outer_prod v w) = inner_prod w v" (is "?lhs = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. trace (outer_prod v w) = inner_prod w v
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. trace (outer_prod v w) = inner_prod w v
[PROOF STEP]
have "(1\<^sub>m n) * (outer_prod v w) = outer_prod v w"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n * outer_prod v w = outer_prod v w
[PROOF STEP]
apply (subst left_mult_one_mat)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. outer_prod v w \<in> carrier_mat n ?nc
 2. outer_prod v w = outer_prod v w
[PROOF STEP]
using outer_prod_dim assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?v \<in> carrier_vec ?n; ?w \<in> carrier_vec ?m\<rbrakk> \<Longrightarrow> outer_prod ?v ?w \<in> carrier_mat ?n ?m
v \<in> carrier_vec n
w \<in> carrier_vec n

goal (2 subgoals):
 1. outer_prod v w \<in> carrier_mat n ?nc
 2. outer_prod v w = outer_prod v w
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1\<^sub>m n * outer_prod v w = outer_prod v w

goal (1 subgoal):
 1. trace (outer_prod v w) = inner_prod w v
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
1\<^sub>m n * outer_prod v w = outer_prod v w

goal (1 subgoal):
 1. trace (outer_prod v w) = inner_prod w v
[PROOF STEP]
have "1\<^sub>m n *\<^sub>v v = v"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1\<^sub>m n *\<^sub>v v = v
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
v \<in> carrier_vec n
w \<in> carrier_vec n

goal (1 subgoal):
 1. 1\<^sub>m n *\<^sub>v v = v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
1\<^sub>m n *\<^sub>v v = v

goal (1 subgoal):
 1. trace (outer_prod v w) = inner_prod w v
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
1\<^sub>m n * outer_prod v w = outer_prod v w
1\<^sub>m n *\<^sub>v v = v
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
1\<^sub>m n * outer_prod v w = outer_prod v w
1\<^sub>m n *\<^sub>v v = v

goal (1 subgoal):
 1. trace (outer_prod v w) = inner_prod w v
[PROOF STEP]
using trace_outer_prod_right[of "1\<^sub>m n" n v w] assms
[PROOF STATE]
proof (prove)
using this:
1\<^sub>m n * outer_prod v w = outer_prod v w
1\<^sub>m n *\<^sub>v v = v
\<lbrakk>1\<^sub>m n \<in> carrier_mat n n; v \<in> carrier_vec n; w \<in> carrier_vec n\<rbrakk> \<Longrightarrow> trace (1\<^sub>m n * outer_prod v w) = inner_prod w (1\<^sub>m n *\<^sub>v v)
v \<in> carrier_vec n
w \<in> carrier_vec n

goal (1 subgoal):
 1. trace (outer_prod v w) = inner_prod w v
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
trace (outer_prod v w) = inner_prod w v

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_const_minus_self_real_le:
  fixes x :: real
  shows "x * (c - x) \<le> c\<^sup>2 / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (c - x) \<le> c\<^sup>2 / 4
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * (c - x) \<le> c\<^sup>2 / 4
[PROOF STEP]
have "x * (c - x) = -(x - c / 2)\<^sup>2 + c\<^sup>2 / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (c - x) = - (x - c / 2)\<^sup>2 + c\<^sup>2 / 4
[PROOF STEP]
by (simp add: field_simps power2_eq_square)
[PROOF STATE]
proof (state)
this:
x * (c - x) = - (x - c / 2)\<^sup>2 + c\<^sup>2 / 4

goal (1 subgoal):
 1. x * (c - x) \<le> c\<^sup>2 / 4
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x * (c - x) = - (x - c / 2)\<^sup>2 + c\<^sup>2 / 4

goal (1 subgoal):
 1. x * (c - x) \<le> c\<^sup>2 / 4
[PROOF STEP]
have "\<dots> \<le> 0 + c\<^sup>2 / 4"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (x - c / 2)\<^sup>2 + c\<^sup>2 / 4 \<le> 0 + c\<^sup>2 / 4
[PROOF STEP]
by (intro add_mono) auto
[PROOF STATE]
proof (state)
this:
- (x - c / 2)\<^sup>2 + c\<^sup>2 / 4 \<le> 0 + c\<^sup>2 / 4

goal (1 subgoal):
 1. x * (c - x) \<le> c\<^sup>2 / 4
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x * (c - x) \<le> 0 + c\<^sup>2 / 4
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * (c - x) \<le> 0 + c\<^sup>2 / 4

goal (1 subgoal):
 1. x * (c - x) \<le> c\<^sup>2 / 4
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
x * (c - x) \<le> c\<^sup>2 / 4

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ack_3: "ack (Suc (Suc (Suc 0))) j = 2 ^ (j+3) - 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3
[PROOF STEP]
proof (induct j)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ack (Suc (Suc (Suc 0))) 0 = 2 ^ (0 + 3) - 3
 2. \<And>j. ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3 \<Longrightarrow> ack (Suc (Suc (Suc 0))) (Suc j) = 2 ^ (Suc j + 3) - 3
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. ack (Suc (Suc (Suc 0))) 0 = 2 ^ (0 + 3) - 3
 2. \<And>j. ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3 \<Longrightarrow> ack (Suc (Suc (Suc 0))) (Suc j) = 2 ^ (Suc j + 3) - 3
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ack (Suc (Suc (Suc 0))) 0 = 2 ^ (0 + 3) - 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
ack (Suc (Suc (Suc 0))) 0 = 2 ^ (0 + 3) - 3

goal (1 subgoal):
 1. \<And>j. ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3 \<Longrightarrow> ack (Suc (Suc (Suc 0))) (Suc j) = 2 ^ (Suc j + 3) - 3
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>j. ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3 \<Longrightarrow> ack (Suc (Suc (Suc 0))) (Suc j) = 2 ^ (Suc j + 3) - 3
[PROOF STEP]
case (Suc j)
[PROOF STATE]
proof (state)
this:
ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3

goal (1 subgoal):
 1. \<And>j. ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3 \<Longrightarrow> ack (Suc (Suc (Suc 0))) (Suc j) = 2 ^ (Suc j + 3) - 3
[PROOF STEP]
with less_le_trans
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z
ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?x < ?y; ?y \<le> ?z\<rbrakk> \<Longrightarrow> ?x < ?z
ack (Suc (Suc (Suc 0))) j = 2 ^ (j + 3) - 3

goal (1 subgoal):
 1. ack (Suc (Suc (Suc 0))) (Suc j) = 2 ^ (Suc j + 3) - 3
[PROOF STEP]
by (fastforce simp add: power_add algebra_simps)
[PROOF STATE]
proof (state)
this:
ack (Suc (Suc (Suc 0))) (Suc j) = 2 ^ (Suc j + 3) - 3

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma round_up_diff_round_down: "round_up prec x - round_down prec x \<le> 2 powr -prec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_up prec x - round_down prec x \<le> 2 powr - real_of_int prec
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. round_up prec x - round_down prec x \<le> 2 powr - real_of_int prec
[PROOF STEP]
have "round_up prec x - round_down prec x = (\<lceil>x * 2 powr prec\<rceil> - \<lfloor>x * 2 powr prec\<rfloor>) * 2 powr -prec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. round_up prec x - round_down prec x = real_of_int (\<lceil>x * 2 powr real_of_int prec\<rceil> - \<lfloor>x * 2 powr real_of_int prec\<rfloor>) * 2 powr real_of_int (- prec)
[PROOF STEP]
by (simp add: round_up_def round_down_def field_simps)
[PROOF STATE]
proof (state)
this:
round_up prec x - round_down prec x = real_of_int (\<lceil>x * 2 powr real_of_int prec\<rceil> - \<lfloor>x * 2 powr real_of_int prec\<rfloor>) * 2 powr real_of_int (- prec)

goal (1 subgoal):
 1. round_up prec x - round_down prec x \<le> 2 powr - real_of_int prec
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
round_up prec x - round_down prec x = real_of_int (\<lceil>x * 2 powr real_of_int prec\<rceil> - \<lfloor>x * 2 powr real_of_int prec\<rfloor>) * 2 powr real_of_int (- prec)

goal (1 subgoal):
 1. round_up prec x - round_down prec x \<le> 2 powr - real_of_int prec
[PROOF STEP]
have "\<dots> \<le> 1 * 2 powr -prec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (\<lceil>x * 2 powr real_of_int prec\<rceil> - \<lfloor>x * 2 powr real_of_int prec\<rfloor>) * 2 powr real_of_int (- prec) \<le> 1 * 2 powr real_of_int (- prec)
[PROOF STEP]
by (rule mult_mono)
      (auto simp flip: of_int_diff simp: ceiling_diff_floor_le_1)
[PROOF STATE]
proof (state)
this:
real_of_int (\<lceil>x * 2 powr real_of_int prec\<rceil> - \<lfloor>x * 2 powr real_of_int prec\<rfloor>) * 2 powr real_of_int (- prec) \<le> 1 * 2 powr real_of_int (- prec)

goal (1 subgoal):
 1. round_up prec x - round_down prec x \<le> 2 powr - real_of_int prec
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
round_up prec x - round_down prec x \<le> 1 * 2 powr real_of_int (- prec)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
round_up prec x - round_down prec x \<le> 1 * 2 powr real_of_int (- prec)

goal (1 subgoal):
 1. round_up prec x - round_down prec x \<le> 2 powr - real_of_int prec
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
round_up prec x - round_down prec x \<le> 2 powr - real_of_int prec

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma polyfun_Sum:
assumes "finite I"
assumes "\<And>i. i\<in>I \<Longrightarrow> polyfun N (f i)"
shows "polyfun N (\<lambda>x. \<Sum>i\<in>I. f i x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. polyfun N (\<lambda>x. \<Sum>i\<in>I. f i x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite I
?i \<in> I \<Longrightarrow> polyfun N (f ?i)

goal (1 subgoal):
 1. polyfun N (\<lambda>x. \<Sum>i\<in>I. f i x)
[PROOF STEP]
apply (induction I rule:finite_induct)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. (\<And>i. i \<in> {} \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Sum>i\<in>{}. f i x)
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Sum>i\<in>F. f i x); \<And>i. i \<in> insert x F \<Longrightarrow> polyfun N (f i)\<rbrakk> \<Longrightarrow> polyfun N (\<lambda>xa. \<Sum>i\<in>insert x F. f i xa)
[PROOF STEP]
apply (simp add: polyfun_const)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Sum>i\<in>F. f i x); \<And>i. i \<in> insert x F \<Longrightarrow> polyfun N (f i)\<rbrakk> \<Longrightarrow> polyfun N (\<lambda>xa. \<Sum>i\<in>insert x F. f i xa)
[PROOF STEP]
using comm_monoid_add_class.sum.insert polyfun_add
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>finite ?A; ?x \<notin> ?A\<rbrakk> \<Longrightarrow> sum ?g (insert ?x ?A) = ?g ?x + sum ?g ?A
\<lbrakk>polyfun ?N ?f; polyfun ?N ?g\<rbrakk> \<Longrightarrow> polyfun ?N (\<lambda>x. ?f x + ?g x)

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; (\<And>i. i \<in> F \<Longrightarrow> polyfun N (f i)) \<Longrightarrow> polyfun N (\<lambda>x. \<Sum>i\<in>F. f i x); \<And>i. i \<in> insert x F \<Longrightarrow> polyfun N (f i)\<rbrakk> \<Longrightarrow> polyfun N (\<lambda>xa. \<Sum>i\<in>insert x F. f i xa)
[PROOF STEP]
by fastforce


[STATEMENT]
lemma polyfun_eq_coeffs: "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = (\<Sum>i\<le>n. d i * x^i)) \<longleftrightarrow> (\<forall>i\<le>n. c i = d i)"
  for c :: "nat \<Rightarrow> 'a::{idom,real_normed_div_algebra}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i = d i)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i = d i)
[PROOF STEP]
have "(\<forall>x. (\<Sum>i\<le>n. c i * x^i) = (\<Sum>i\<le>n. d i * x^i)) \<longleftrightarrow> (\<forall>x. (\<Sum>i\<le>n. (c i - d i) * x^i) = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>x. (\<Sum>i\<le>n. (c i - d i) * x ^ i) = (0::'a))
[PROOF STEP]
by (simp add: left_diff_distrib Groups_Big.sum_subtractf)
[PROOF STATE]
proof (state)
this:
(\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>x. (\<Sum>i\<le>n. (c i - d i) * x ^ i) = (0::'a))

goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i = d i)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>x. (\<Sum>i\<le>n. (c i - d i) * x ^ i) = (0::'a))

goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i = d i)
[PROOF STEP]
have "\<dots> \<longleftrightarrow> (\<forall>i\<le>n. c i - d i = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. (c i - d i) * x ^ i) = (0::'a)) = (\<forall>i\<le>n. c i - d i = (0::'a))
[PROOF STEP]
by (rule polyfun_eq_0)
[PROOF STATE]
proof (state)
this:
(\<forall>x. (\<Sum>i\<le>n. (c i - d i) * x ^ i) = (0::'a)) = (\<forall>i\<le>n. c i - d i = (0::'a))

goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i = d i)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i - d i = (0::'a))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i - d i = (0::'a))

goal (1 subgoal):
 1. (\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i = d i)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<forall>x. (\<Sum>i\<le>n. c i * x ^ i) = (\<Sum>i\<le>n. d i * x ^ i)) = (\<forall>i\<le>n. c i = d i)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma homeomorphic_spheres:
  fixes a b ::"'a::real_normed_vector"
  assumes "0 < d"  "0 < e"
  shows "(sphere a d) homeomorphic (sphere b e)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sphere a d homeomorphic sphere b e
[PROOF STEP]
unfolding homeomorphic_minimal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>f g. (\<forall>x\<in>sphere a d. f x \<in> sphere b e \<and> g (f x) = x) \<and> (\<forall>y\<in>sphere b e. g y \<in> sphere a d \<and> f (g y) = y) \<and> continuous_on (sphere a d) f \<and> continuous_on (sphere b e) g
[PROOF STEP]
apply(rule_tac x="\<lambda>x. b + (e/d) *\<^sub>R (x - a)" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>g. (\<forall>x\<in>sphere a d. b + (e / d) *\<^sub>R (x - a) \<in> sphere b e \<and> g (b + (e / d) *\<^sub>R (x - a)) = x) \<and> (\<forall>y\<in>sphere b e. g y \<in> sphere a d \<and> b + (e / d) *\<^sub>R (g y - a) = y) \<and> continuous_on (sphere a d) (\<lambda>x. b + (e / d) *\<^sub>R (x - a)) \<and> continuous_on (sphere b e) g
[PROOF STEP]
apply(rule_tac x="\<lambda>x. a + (d/e) *\<^sub>R (x - b)" in exI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x\<in>sphere a d. b + (e / d) *\<^sub>R (x - a) \<in> sphere b e \<and> a + (d / e) *\<^sub>R (b + (e / d) *\<^sub>R (x - a) - b) = x) \<and> (\<forall>y\<in>sphere b e. a + (d / e) *\<^sub>R (y - b) \<in> sphere a d \<and> b + (e / d) *\<^sub>R (a + (d / e) *\<^sub>R (y - b) - a) = y) \<and> continuous_on (sphere a d) (\<lambda>x. b + (e / d) *\<^sub>R (x - a)) \<and> continuous_on (sphere b e) (\<lambda>x. a + (d / e) *\<^sub>R (x - b))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < d
0 < e

goal (1 subgoal):
 1. (\<forall>x\<in>sphere a d. b + (e / d) *\<^sub>R (x - a) \<in> sphere b e \<and> a + (d / e) *\<^sub>R (b + (e / d) *\<^sub>R (x - a) - b) = x) \<and> (\<forall>y\<in>sphere b e. a + (d / e) *\<^sub>R (y - b) \<in> sphere a d \<and> b + (e / d) *\<^sub>R (a + (d / e) *\<^sub>R (y - b) - a) = y) \<and> continuous_on (sphere a d) (\<lambda>x. b + (e / d) *\<^sub>R (x - a)) \<and> continuous_on (sphere b e) (\<lambda>x. a + (d / e) *\<^sub>R (x - b))
[PROOF STEP]
by (auto intro!: continuous_intros simp: dist_commute dist_norm pos_divide_less_eq)


[STATEMENT]
lemma path_image_part_circlepath':
  "path_image (part_circlepath z r s t) = (\<lambda>x. z + r * cis x) ` closed_segment s t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * cis x) ` closed_segment s t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * cis x) ` closed_segment s t
[PROOF STEP]
have "path_image (part_circlepath z r s t) =
          (\<lambda>x. z + r * exp(\<i> * of_real x)) ` linepath s t ` {0..1}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * exp (\<i> * complex_of_real x)) ` linepath s t ` {0..1}
[PROOF STEP]
by (simp add: image_image path_image_def part_circlepath_def)
[PROOF STATE]
proof (state)
this:
path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * exp (\<i> * complex_of_real x)) ` linepath s t ` {0..1}

goal (1 subgoal):
 1. path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * cis x) ` closed_segment s t
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * exp (\<i> * complex_of_real x)) ` linepath s t ` {0..1}

goal (1 subgoal):
 1. path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * cis x) ` closed_segment s t
[PROOF STEP]
have "linepath s t ` {0..1} = closed_segment s t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. linepath s t ` {0..1} = closed_segment s t
[PROOF STEP]
by (rule linepath_image_01)
[PROOF STATE]
proof (state)
this:
linepath s t ` {0..1} = closed_segment s t

goal (1 subgoal):
 1. path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * cis x) ` closed_segment s t
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * exp (\<i> * complex_of_real x)) ` closed_segment s t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * exp (\<i> * complex_of_real x)) ` closed_segment s t

goal (1 subgoal):
 1. path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * cis x) ` closed_segment s t
[PROOF STEP]
by (simp add: cis_conv_exp)
[PROOF STATE]
proof (state)
this:
path_image (part_circlepath z r s t) = (\<lambda>x. z + complex_of_real r * cis x) ` closed_segment s t

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ring_iso_same_card: "R \<simeq> S \<Longrightarrow> card (carrier R) = card (carrier S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. R \<simeq> S \<Longrightarrow> card (carrier R) = card (carrier S)
[PROOF STEP]
using bij_betw_same_card
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B

goal (1 subgoal):
 1. R \<simeq> S \<Longrightarrow> card (carrier R) = card (carrier S)
[PROOF STEP]
unfolding is_ring_iso_def ring_iso_def
[PROOF STATE]
proof (prove)
using this:
bij_betw ?f ?A ?B \<Longrightarrow> card ?A = card ?B

goal (1 subgoal):
 1. {h \<in> ring_hom R S. bij_betw h (carrier R) (carrier S)} \<noteq> {} \<Longrightarrow> card (carrier R) = card (carrier S)
[PROOF STEP]
by auto


[STATEMENT]
lemma mult_bounds_enclose_zero1:
  "min (la * lb) (min (la * ub) (min (lb * ua) (ua * ub))) \<le> 0"
  "0 \<le> max (la * lb) (max (la * ub) (max (lb * ua) (ua * ub)))"
  if "la \<le> 0" "0 \<le> ua"
  for la lb ua ub:: "'a::linordered_idom"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (la * lb) (min (la * ub) (min (lb * ua) (ua * ub))) \<le> (0::'a) &&& (0::'a) \<le> max (la * lb) (max (la * ub) (max (lb * ua) (ua * ub)))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. min (la * lb) (min (la * ub) (min (lb * ua) (ua * ub))) \<le> (0::'a)
[PROOF STEP]
by (metis (no_types, opaque_lifting) that eq_iff min_le_iff_disj mult_zero_left mult_zero_right
        zero_le_mult_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> max (la * lb) (max (la * ub) (max (lb * ua) (ua * ub)))
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> max (la * lb) (max (la * ub) (max (lb * ua) (ua * ub)))
[PROOF STEP]
by (metis that le_max_iff_disj mult_zero_right order_refl zero_le_mult_iff)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma cosine_law_triangle'':
  "cos (angle b a c) = (dist a b ^ 2 + dist a c ^ 2 - dist b c ^ 2) / (2 * dist a b * dist a c)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (angle b a c) = ((dist a b)\<^sup>2 + (dist a c)\<^sup>2 - (dist b c)\<^sup>2) / (2 * dist a b * dist a c)
[PROOF STEP]
using cosine_law_triangle[of b c a]
[PROOF STATE]
proof (prove)
using this:
(dist b c)\<^sup>2 = (dist a b)\<^sup>2 + (dist a c)\<^sup>2 - 2 * dist a b * dist a c * cos (angle b a c)

goal (1 subgoal):
 1. cos (angle b a c) = ((dist a b)\<^sup>2 + (dist a c)\<^sup>2 - (dist b c)\<^sup>2) / (2 * dist a b * dist a c)
[PROOF STEP]
by simp


[STATEMENT]
lemma isCont_powreal_exponent_less_one:
  assumes "0 < a"
  and "a < 1"
  shows "isCont (\<lambda>x. a pow\<^sub>\<real> x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
have "1 < inverse a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < inverse a
[PROOF STEP]
by (simp add: assms one_less_inverse)
[PROOF STATE]
proof (state)
this:
1 < inverse a

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
1 < inverse a
[PROOF STEP]
have "isCont ((pow\<^sub>\<real>) (inverse a)) x"
[PROOF STATE]
proof (prove)
using this:
1 < inverse a

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) (inverse a)) x
[PROOF STEP]
by (simp add: isCont_powreal_exponent_gt_one)
[PROOF STATE]
proof (state)
this:
isCont ((pow\<^sub>\<real>) (inverse a)) x

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont ((pow\<^sub>\<real>) (inverse a)) x
[PROOF STEP]
have "isCont (\<lambda>x. inverse (inverse a pow\<^sub>\<real> x)) x"
[PROOF STATE]
proof (prove)
using this:
isCont ((pow\<^sub>\<real>) (inverse a)) x

goal (1 subgoal):
 1. isCont (\<lambda>x. inverse (inverse a pow\<^sub>\<real> x)) x
[PROOF STEP]
using assms(1) continuous_at_within_inverse powreal_not_zero
[PROOF STATE]
proof (prove)
using this:
isCont ((pow\<^sub>\<real>) (inverse a)) x
0 < a
\<lbrakk>continuous (at ?a within ?s) ?f; ?f ?a \<noteq> (0::?'b)\<rbrakk> \<Longrightarrow> continuous (at ?a within ?s) (\<lambda>x. inverse (?f x))
0 < ?a \<Longrightarrow> ?a pow\<^sub>\<real> ?x \<noteq> 0

goal (1 subgoal):
 1. isCont (\<lambda>x. inverse (inverse a pow\<^sub>\<real> x)) x
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
isCont (\<lambda>x. inverse (inverse a pow\<^sub>\<real> x)) x

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
isCont (\<lambda>x. inverse (inverse a pow\<^sub>\<real> x)) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
isCont (\<lambda>x. inverse (inverse a pow\<^sub>\<real> x)) x

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
using assms(1) powreal_inverse
[PROOF STATE]
proof (prove)
using this:
isCont (\<lambda>x. inverse (inverse a pow\<^sub>\<real> x)) x
0 < a
inverse (?a pow\<^sub>\<real> ?x) = inverse ?a pow\<^sub>\<real> ?x

goal (1 subgoal):
 1. isCont ((pow\<^sub>\<real>) a) x
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
isCont ((pow\<^sub>\<real>) a) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma contour_integral_id [simp]: "contour_integral (linepath a b) (\<lambda>y. y) = (b^2 - a^2)/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. contour_integral (linepath a b) (\<lambda>y. y) = (b\<^sup>2 - a\<^sup>2) / 2
[PROOF STEP]
using contour_integral_primitive [of UNIV "\<lambda>x. x^2/2" "\<lambda>x. x" "linepath a b"] contour_integral_unique
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<And>x. x \<in> UNIV \<Longrightarrow> ((\<lambda>x. x\<^sup>2 / 2) has_field_derivative x) (at x); valid_path (linepath a b); path_image (linepath a b) \<subseteq> UNIV\<rbrakk> \<Longrightarrow> ((\<lambda>x. x) has_contour_integral (pathfinish (linepath a b))\<^sup>2 / 2 - (pathstart (linepath a b))\<^sup>2 / 2) (linepath a b)
(?f has_contour_integral ?i) ?g \<Longrightarrow> contour_integral ?g ?f = ?i

goal (1 subgoal):
 1. contour_integral (linepath a b) (\<lambda>y. y) = (b\<^sup>2 - a\<^sup>2) / 2
[PROOF STEP]
by (simp add: has_field_der_id)


[STATEMENT]
lemma norm_columns_fst_QR_decomposition:
  fixes A::"real^'n::{mod_type}^'m::{mod_type}"
  assumes "rank A = ncols A"
  shows "norm (column i (fst (QR_decomposition A))) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (column i (fst (QR_decomposition A))) = 1
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. norm (column i (fst (QR_decomposition A))) = 1
[PROOF STEP]
have "vec.independent (columns (Gram_Schmidt_matrix A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.independent (columns (Gram_Schmidt_matrix A))
[PROOF STEP]
by (metis assms full_rank_imp_is_basis2 independent_columns_Gram_Schmidt_matrix)
[PROOF STATE]
proof (state)
this:
vec.independent (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. norm (column i (fst (QR_decomposition A))) = 1
[PROOF STEP]
hence "column i (Gram_Schmidt_matrix A) \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
vec.independent (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. column i (Gram_Schmidt_matrix A) \<noteq> 0
[PROOF STEP]
using vec.dependent_zero[of "columns (Gram_Schmidt_matrix A)"]
[PROOF STATE]
proof (prove)
using this:
vec.independent (columns (Gram_Schmidt_matrix A))
0 \<in> columns (Gram_Schmidt_matrix A) \<Longrightarrow> vec.dependent (columns (Gram_Schmidt_matrix A))

goal (1 subgoal):
 1. column i (Gram_Schmidt_matrix A) \<noteq> 0
[PROOF STEP]
unfolding columns_def
[PROOF STATE]
proof (prove)
using this:
vec.independent {column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}
0 \<in> {column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV} \<Longrightarrow> vec.dependent {column i (Gram_Schmidt_matrix A) |i. i \<in> UNIV}

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

goal (1 subgoal):
 1. norm (column i (fst (QR_decomposition A))) = 1
[PROOF STEP]
thus "norm (column i (fst (QR_decomposition A))) = 1"
[PROOF STATE]
proof (prove)
using this:
column i (Gram_Schmidt_matrix A) \<noteq> 0

goal (1 subgoal):
 1. norm (column i (fst (QR_decomposition A))) = 1
[PROOF STEP]
unfolding QR_decomposition_def Let_def fst_conv
[PROOF STATE]
proof (prove)
using this:
column i (Gram_Schmidt_matrix A) \<noteq> 0

goal (1 subgoal):
 1. norm (column i (divide_by_norm (Gram_Schmidt_matrix A))) = 1
[PROOF STEP]
by (rule norm_column_divide_by_norm)
[PROOF STATE]
proof (state)
this:
norm (column i (fst (QR_decomposition A))) = 1

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sorted_list_of_multiset_image_commute:
  assumes "mono f"
  shows "sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)
[PROOF STEP]
have "sorted (sorted_list_of_multiset (image_mset f M))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (sorted_list_of_multiset (image_mset f M))
[PROOF STEP]
by (simp add:sorted_sorted_list_of_multiset)
[PROOF STATE]
proof (state)
this:
sorted (sorted_list_of_multiset (image_mset f M))

goal (1 subgoal):
 1. sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
sorted (sorted_list_of_multiset (image_mset f M))

goal (1 subgoal):
 1. sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)
[PROOF STEP]
have " sorted_wrt (\<lambda>x y. f x \<le> f y) (sorted_list_of_multiset M)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted_wrt (\<lambda>x y. f x \<le> f y) (sorted_list_of_multiset M)
[PROOF STEP]
by (rule sorted_wrt_mono_rel[where P="\<lambda>x y. x \<le> y"])
      (auto intro: monoD[OF assms] sorted_sorted_list_of_multiset)
[PROOF STATE]
proof (state)
this:
sorted_wrt (\<lambda>x y. f x \<le> f y) (sorted_list_of_multiset M)

goal (1 subgoal):
 1. sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)
[PROOF STEP]
hence "sorted (map f (sorted_list_of_multiset M))"
[PROOF STATE]
proof (prove)
using this:
sorted_wrt (\<lambda>x y. f x \<le> f y) (sorted_list_of_multiset M)

goal (1 subgoal):
 1. sorted (map f (sorted_list_of_multiset M))
[PROOF STEP]
by (subst sorted_wrt_map)
[PROOF STATE]
proof (state)
this:
sorted (map f (sorted_list_of_multiset M))

goal (1 subgoal):
 1. sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
sorted (sorted_list_of_multiset (image_mset f M))
sorted (map f (sorted_list_of_multiset M))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sorted (sorted_list_of_multiset (image_mset f M))
sorted (map f (sorted_list_of_multiset M))

goal (1 subgoal):
 1. sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)
[PROOF STEP]
by (intro list_eq_iff, auto)
[PROOF STATE]
proof (state)
this:
sorted_list_of_multiset (image_mset f M) = map f (sorted_list_of_multiset M)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma index_matrix_prod [simp]:
  assumes "i < dim_row A" and "j < dim_col B" and "dim_col A = dim_row B"
  shows "(A * B) $$ (i,j) = (\<Sum>k<dim_row B. (A $$ (i,k)) * (B $$ (k,j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (A * B) $$ (i, j) = (\<Sum>k<dim_row B. A $$ (i, k) * B $$ (k, j))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
i < dim_row A
j < dim_col B
dim_col A = dim_row B

goal (1 subgoal):
 1. (A * B) $$ (i, j) = (\<Sum>k<dim_row B. A $$ (i, k) * B $$ (k, j))
[PROOF STEP]
apply(simp add: scalar_prod_def atLeast0LessThan)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.


[STATEMENT]
lemma real_sqrt_sum_squares_triangle_ineq:
  "sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "(a * c + b * d) \<le> (sqrt (a\<^sup>2 + b\<^sup>2) * sqrt (c\<^sup>2 + d\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a * c + b * d \<le> sqrt (a\<^sup>2 + b\<^sup>2) * sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
by (rule power2_le_imp_le) (simp_all add: power2_sum power_mult_distrib ring_distribs L2_set_mult_ineq_lemma add.commute)
[PROOF STATE]
proof (state)
this:
a * c + b * d \<le> sqrt (a\<^sup>2 + b\<^sup>2) * sqrt (c\<^sup>2 + d\<^sup>2)

goal (1 subgoal):
 1. sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
a * c + b * d \<le> sqrt (a\<^sup>2 + b\<^sup>2) * sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
have "(a + c)\<^sup>2 + (b + d)\<^sup>2 \<le> (sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2))\<^sup>2"
[PROOF STATE]
proof (prove)
using this:
a * c + b * d \<le> sqrt (a\<^sup>2 + b\<^sup>2) * sqrt (c\<^sup>2 + d\<^sup>2)

goal (1 subgoal):
 1. (a + c)\<^sup>2 + (b + d)\<^sup>2 \<le> (sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2))\<^sup>2
[PROOF STEP]
by (simp add: power2_sum)
[PROOF STATE]
proof (state)
this:
(a + c)\<^sup>2 + (b + d)\<^sup>2 \<le> (sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(a + c)\<^sup>2 + (b + d)\<^sup>2 \<le> (sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2))\<^sup>2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(a + c)\<^sup>2 + (b + d)\<^sup>2 \<le> (sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2))\<^sup>2

goal (1 subgoal):
 1. sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)
[PROOF STEP]
by (auto intro: power2_le_imp_le)
[PROOF STATE]
proof (state)
this:
sqrt ((a + c)\<^sup>2 + (b + d)\<^sup>2) \<le> sqrt (a\<^sup>2 + b\<^sup>2) + sqrt (c\<^sup>2 + d\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma real_of_int_div_aux:
  "(real_of_int x) / (real_of_int d) =
    real_of_int (x div d) + (real_of_int (x mod d)) / (real_of_int d)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int x / real_of_int d = real_of_int (x div d) + real_of_int (x mod d) / real_of_int d
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. real_of_int x / real_of_int d = real_of_int (x div d) + real_of_int (x mod d) / real_of_int d
[PROOF STEP]
have "x = (x div d) * d + x mod d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = x div d * d + x mod d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = x div d * d + x mod d

goal (1 subgoal):
 1. real_of_int x / real_of_int d = real_of_int (x div d) + real_of_int (x mod d) / real_of_int d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x = x div d * d + x mod d
[PROOF STEP]
have "real_of_int x = real_of_int (x div d) * real_of_int d + real_of_int(x mod d)"
[PROOF STATE]
proof (prove)
using this:
x = x div d * d + x mod d

goal (1 subgoal):
 1. real_of_int x = real_of_int (x div d) * real_of_int d + real_of_int (x mod d)
[PROOF STEP]
by (metis of_int_add of_int_mult)
[PROOF STATE]
proof (state)
this:
real_of_int x = real_of_int (x div d) * real_of_int d + real_of_int (x mod d)

goal (1 subgoal):
 1. real_of_int x / real_of_int d = real_of_int (x div d) + real_of_int (x mod d) / real_of_int d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int x = real_of_int (x div d) * real_of_int d + real_of_int (x mod d)
[PROOF STEP]
have "real_of_int x / real_of_int d = \<dots> / real_of_int d"
[PROOF STATE]
proof (prove)
using this:
real_of_int x = real_of_int (x div d) * real_of_int d + real_of_int (x mod d)

goal (1 subgoal):
 1. real_of_int x / real_of_int d = (real_of_int (x div d) * real_of_int d + real_of_int (x mod d)) / real_of_int d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
real_of_int x / real_of_int d = (real_of_int (x div d) * real_of_int d + real_of_int (x mod d)) / real_of_int d

goal (1 subgoal):
 1. real_of_int x / real_of_int d = real_of_int (x div d) + real_of_int (x mod d) / real_of_int d
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int x / real_of_int d = (real_of_int (x div d) * real_of_int d + real_of_int (x mod d)) / real_of_int d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
real_of_int x / real_of_int d = (real_of_int (x div d) * real_of_int d + real_of_int (x mod d)) / real_of_int d

goal (1 subgoal):
 1. real_of_int x / real_of_int d = real_of_int (x div d) + real_of_int (x mod d) / real_of_int d
[PROOF STEP]
by (auto simp add: add_divide_distrib algebra_simps)
[PROOF STATE]
proof (state)
this:
real_of_int x / real_of_int d = real_of_int (x div d) + real_of_int (x mod d) / real_of_int d

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_UNIV_option: "CARD('a option) = (if CARD('a) = 0 then 0 else CARD('a) + 1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. CARD('a option) = (if CARD('a) = 0 then 0 else CARD('a) + 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. CARD('a option) = (if CARD('a) = 0 then 0 else CARD('a) + 1)
[PROOF STEP]
have "(None :: 'a option) \<notin> range Some"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. None \<notin> range Some
[PROOF STEP]
by clarsimp
[PROOF STATE]
proof (state)
this:
None \<notin> range Some

goal (1 subgoal):
 1. CARD('a option) = (if CARD('a) = 0 then 0 else CARD('a) + 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
None \<notin> range Some

goal (1 subgoal):
 1. CARD('a option) = (if CARD('a) = 0 then 0 else CARD('a) + 1)
[PROOF STEP]
by (simp add: UNIV_option_conv card_eq_0_iff finite_range_Some card_image)
[PROOF STATE]
proof (state)
this:
CARD('a option) = (if CARD('a) = 0 then 0 else CARD('a) + 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cong_mersenne_number_int:
  fixes k :: int
  shows "[k mod 2 ^ n + k div 2 ^ n = k] (mod (2 ^ n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [k mod 2 ^ n + k div 2 ^ n = k] (mod 2 ^ n - 1)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [k mod 2 ^ n + k div 2 ^ n = k] (mod 2 ^ n - 1)
[PROOF STEP]
have "k = (2 ^ n - 1 + 1) * (k div 2 ^ n) + (k mod 2 ^ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k = (2 ^ n - 1 + 1) * (k div 2 ^ n) + k mod 2 ^ n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
k = (2 ^ n - 1 + 1) * (k div 2 ^ n) + k mod 2 ^ n

goal (1 subgoal):
 1. [k mod 2 ^ n + k div 2 ^ n = k] (mod 2 ^ n - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
k = (2 ^ n - 1 + 1) * (k div 2 ^ n) + k mod 2 ^ n

goal (1 subgoal):
 1. [k mod 2 ^ n + k div 2 ^ n = k] (mod 2 ^ n - 1)
[PROOF STEP]
have "[\<dots> = (0 + 1) * (k div 2 ^ n) + (k mod 2 ^ n)] (mod (2 ^ n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [(2 ^ n - 1 + 1) * (k div 2 ^ n) + k mod 2 ^ n = (0 + 1) * (k div 2 ^ n) + k mod 2 ^ n] (mod 2 ^ n - 1)
[PROOF STEP]
by (intro cong_add cong_mult cong_refl) (auto simp: cong_def)
[PROOF STATE]
proof (state)
this:
[(2 ^ n - 1 + 1) * (k div 2 ^ n) + k mod 2 ^ n = (0 + 1) * (k div 2 ^ n) + k mod 2 ^ n] (mod 2 ^ n - 1)

goal (1 subgoal):
 1. [k mod 2 ^ n + k div 2 ^ n = k] (mod 2 ^ n - 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
[k = (0 + 1) * (k div 2 ^ n) + k mod 2 ^ n] (mod 2 ^ n - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[k = (0 + 1) * (k div 2 ^ n) + k mod 2 ^ n] (mod 2 ^ n - 1)

goal (1 subgoal):
 1. [k mod 2 ^ n + k div 2 ^ n = k] (mod 2 ^ n - 1)
[PROOF STEP]
by (simp add: cong_sym add_ac)
[PROOF STATE]
proof (state)
this:
[k mod 2 ^ n + k div 2 ^ n = k] (mod 2 ^ n - 1)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diagonal_mat_smult:
  fixes A::"'a::{ring} Matrix.mat"
  assumes "diagonal_mat A"
  shows "diagonal_mat (x \<cdot>\<^sub>mA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. diagonal_mat (x \<cdot>\<^sub>m A)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
diagonal_mat A

goal (1 subgoal):
 1. diagonal_mat (x \<cdot>\<^sub>m A)
[PROOF STEP]
unfolding diagonal_mat_def uminus_mat_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i<dim_row A. \<forall>j<dim_col A. i \<noteq> j \<longrightarrow> A $$ (i, j) = (0::'a)

goal (1 subgoal):
 1. \<forall>i<dim_row (x \<cdot>\<^sub>m A). \<forall>j<dim_col (x \<cdot>\<^sub>m A). i \<noteq> j \<longrightarrow> (x \<cdot>\<^sub>m A) $$ (i, j) = (0::'a)
[PROOF STEP]
by auto


[STATEMENT]
lemma effective_scalar_product_distributivity:
 assumes "length v1 = length v2" and "length w1 = length w2"
 shows "(scalar_product v1 v2)*(scalar_product w1 w2)
      = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
using assms scalar_product_distributivity
[PROOF STATE]
proof (prove)
using this:
length v1 = length v2
length w1 = length w2
\<forall>v1 v2 w1 w2. length v1 = length v2 \<and> length v1 = ?n \<and> length w1 = length w2 \<longrightarrow> scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)

goal (1 subgoal):
 1. scalar_product v1 v2 * scalar_product w1 w2 = scalar_product (vec_vec_Tensor v1 w1) (vec_vec_Tensor v2 w2)
[PROOF STEP]
by auto


[STATEMENT]
lemma norm_eq_on_real_2_vec:
  fixes x :: "real ^ 2"
  shows "norm x = sqrt ((x $ 1) ^ 2 + (x $ 2) ^ 2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm x = sqrt ((x $ 1)\<^sup>2 + (x $ 2)\<^sup>2)
[PROOF STEP]
by (simp add: norm_eq_sqrt_inner inner_vec_def UNIV_2 power2_eq_square)


[STATEMENT]
lemma card_PiE: "finite S \<Longrightarrow> card (\<Pi>\<^sub>E i \<in> S. T i) = (\<Prod> i\<in>S. card (T i))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite S \<Longrightarrow> card (Pi\<^sub>E S T) = (\<Prod>i\<in>S. card (T i))
[PROOF STEP]
proof (induct rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. card (Pi\<^sub>E {} T) = (\<Prod>i\<in>{}. card (T i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card (Pi\<^sub>E F T) = (\<Prod>i\<in>F. card (T i))\<rbrakk> \<Longrightarrow> card (Pi\<^sub>E (insert x F) T) = (\<Prod>i\<in>insert x F. card (T i))
[PROOF STEP]
case empty
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. card (Pi\<^sub>E {} T) = (\<Prod>i\<in>{}. card (T i))
 2. \<And>x F. \<lbrakk>finite F; x \<notin> F; card (Pi\<^sub>E F T) = (\<Prod>i\<in>F. card (T i))\<rbrakk> \<Longrightarrow> card (Pi\<^sub>E (insert x F) T) = (\<Prod>i\<in>insert x F. card (T i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (Pi\<^sub>E {} T) = (\<Prod>i\<in>{}. card (T i))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
card (Pi\<^sub>E {} T) = (\<Prod>i\<in>{}. card (T i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card (Pi\<^sub>E F T) = (\<Prod>i\<in>F. card (T i))\<rbrakk> \<Longrightarrow> card (Pi\<^sub>E (insert x F) T) = (\<Prod>i\<in>insert x F. card (T i))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card (Pi\<^sub>E F T) = (\<Prod>i\<in>F. card (T i))\<rbrakk> \<Longrightarrow> card (Pi\<^sub>E (insert x F) T) = (\<Prod>i\<in>insert x F. card (T i))
[PROOF STEP]
case (insert x S)
[PROOF STATE]
proof (state)
this:
finite S
x \<notin> S
card (Pi\<^sub>E S T) = (\<Prod>i\<in>S. card (T i))

goal (1 subgoal):
 1. \<And>x F. \<lbrakk>finite F; x \<notin> F; card (Pi\<^sub>E F T) = (\<Prod>i\<in>F. card (T i))\<rbrakk> \<Longrightarrow> card (Pi\<^sub>E (insert x F) T) = (\<Prod>i\<in>insert x F. card (T i))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
finite S
x \<notin> S
card (Pi\<^sub>E S T) = (\<Prod>i\<in>S. card (T i))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
finite S
x \<notin> S
card (Pi\<^sub>E S T) = (\<Prod>i\<in>S. card (T i))

goal (1 subgoal):
 1. card (Pi\<^sub>E (insert x S) T) = (\<Prod>i\<in>insert x S. card (T i))
[PROOF STEP]
by (simp add: PiE_insert_eq inj_combinator card_image card_cartesian_product)
[PROOF STATE]
proof (state)
this:
card (Pi\<^sub>E (insert x S) T) = (\<Prod>i\<in>insert x S. card (T i))

goal:
No subgoals!
[PROOF STEP]
qed