[STATEMENT]
lemma last_subset:
  assumes "A \<subseteq> {a,b}"
  and "a\<noteq> b"
and "A \<noteq> {a, b}"
and "A\<noteq> {}"
and "A \<noteq> {a}"
shows "A = {b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A = {b}
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {a, b}
a \<noteq> b
A \<noteq> {a, b}
A \<noteq> {}
A \<noteq> {a}

goal (1 subgoal):
 1. A = {b}
[PROOF STEP]
by blast


[STATEMENT]
lemma ffilter_transfer [transfer_rule]:
  assumes "bi_unique A"
  shows "((A ===> (=)) ===> rel_fset A ===> rel_fset A) ffilter ffilter"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((A ===> (=)) ===> rel_fset A ===> rel_fset A) ffilter ffilter
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
bi_unique A

goal (1 subgoal):
 1. ((A ===> (=)) ===> rel_fset A ===> rel_fset A) ffilter ffilter
[PROOF STEP]
unfolding rel_fun_def
[PROOF STATE]
proof (prove)
using this:
bi_unique A

goal (1 subgoal):
 1. \<forall>x y. (\<forall>xa ya. A xa ya \<longrightarrow> x xa = y ya) \<longrightarrow> (\<forall>xa ya. rel_fset A xa ya \<longrightarrow> rel_fset A (ffilter x xa) (ffilter y ya))
[PROOF STEP]
using Lifting_Set.filter_transfer[unfolded rel_fun_def, rule_format, Transfer.transferred]
[PROOF STATE]
proof (prove)
using this:
bi_unique A
\<lbrakk>bi_unique ?A; \<And>x y. ?A x y \<Longrightarrow> ?x x = ?y y; rel_fset ?A ?xa ?ya\<rbrakk> \<Longrightarrow> rel_fset ?A (ffilter ?x ?xa) (ffilter ?y ?ya)

goal (1 subgoal):
 1. \<forall>x y. (\<forall>xa ya. A xa ya \<longrightarrow> x xa = y ya) \<longrightarrow> (\<forall>xa ya. rel_fset A xa ya \<longrightarrow> rel_fset A (ffilter x xa) (ffilter y ya))
[PROOF STEP]
by blast


[STATEMENT]
lemma parts_UN [simp]: "parts(\<Union>x\<in>A. H x) = (\<Union>x\<in>A. parts(H x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. parts (\<Union> (H ` A)) = (\<Union>x\<in>A. parts (H x))
[PROOF STEP]
by (intro equalityI parts_UN_subset1 parts_UN_subset2)


[STATEMENT]
lemma on_tripleD[dest]:
  assumes "((l1,v1,v2),(l2,v3,v4)) \<in> on_triple R"
  shows "l2 = l1" "(v1,v3)\<in> R" "(v2,v4) \<in> R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. l2 = l1 &&& (v1, v3) \<in> R &&& (v2, v4) \<in> R
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
((l1, v1, v2), l2, v3, v4) \<in> on_triple R

goal (1 subgoal):
 1. l2 = l1 &&& (v1, v3) \<in> R &&& (v2, v4) \<in> R
[PROOF STEP]
unfolding on_triple_def
[PROOF STATE]
proof (prove)
using this:
((l1, v1, v2), l2, v3, v4) \<in> {((l, s, t), l', s', t'). l = l' \<and> (s, s') \<in> R \<and> (t, t') \<in> R}

goal (1 subgoal):
 1. l2 = l1 &&& (v1, v3) \<in> R &&& (v2, v4) \<in> R
[PROOF STEP]
by auto


[STATEMENT]
lemma (in ring) mono_generate_ring:
  assumes "I \<subseteq> J" and "J \<subseteq> carrier R"
  shows "generate_ring R I \<subseteq> generate_ring R J"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
have "I \<subseteq> generate_ring R J "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. I \<subseteq> generate_ring R J
[PROOF STEP]
using assms generate_ringE(2)
[PROOF STATE]
proof (prove)
using this:
I \<subseteq> J
J \<subseteq> carrier R
\<lbrakk>?H \<subseteq> carrier R; ?E = generate_ring R ?H\<rbrakk> \<Longrightarrow> ?H \<subseteq> ?E

goal (1 subgoal):
 1. I \<subseteq> generate_ring R J
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
I \<subseteq> generate_ring R J

goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
thus "generate_ring R I \<subseteq> generate_ring R J"
[PROOF STATE]
proof (prove)
using this:
I \<subseteq> generate_ring R J

goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
using generate_ring_min_subring1[of I "generate_ring R J"] assms generate_ring_is_subring[OF assms(2)]
[PROOF STATE]
proof (prove)
using this:
I \<subseteq> generate_ring R J
\<lbrakk>I \<subseteq> carrier R; subring (generate_ring R J) R; I \<subseteq> generate_ring R J\<rbrakk> \<Longrightarrow> generate_ring R I \<subseteq> generate_ring R J
I \<subseteq> J
J \<subseteq> carrier R
subring (generate_ring R J) R

goal (1 subgoal):
 1. generate_ring R I \<subseteq> generate_ring R J
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
generate_ring R I \<subseteq> generate_ring R J

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma listgcd_greatest_mult: "(\<And> x :: 'a. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
[PROOF STEP]
proof (induct xs)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
 2. \<And>a xs. \<lbrakk>(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z; \<And>x. x \<in> set (a # xs) \<Longrightarrow> y dvd x * z\<rbrakk> \<Longrightarrow> y dvd listgcd (a # xs) * z
[PROOF STEP]
case (Cons x xs)
[PROOF STATE]
proof (state)
this:
(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
?x1 \<in> set (x # xs) \<Longrightarrow> y dvd ?x1 * z

goal (2 subgoals):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
 2. \<And>a xs. \<lbrakk>(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z; \<And>x. x \<in> set (a # xs) \<Longrightarrow> y dvd x * z\<rbrakk> \<Longrightarrow> y dvd listgcd (a # xs) * z
[PROOF STEP]
from Cons
[PROOF STATE]
proof (chain)
picking this:
(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
?x1 \<in> set (x # xs) \<Longrightarrow> y dvd ?x1 * z
[PROOF STEP]
have "y dvd x * z" "y dvd listgcd xs * z"
[PROOF STATE]
proof (prove)
using this:
(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z
?x1 \<in> set (x # xs) \<Longrightarrow> y dvd ?x1 * z

goal (1 subgoal):
 1. y dvd x * z &&& y dvd listgcd xs * z
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
y dvd x * z
y dvd listgcd xs * z

goal (2 subgoals):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
 2. \<And>a xs. \<lbrakk>(\<And>x. x \<in> set xs \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd xs * z; \<And>x. x \<in> set (a # xs) \<Longrightarrow> y dvd x * z\<rbrakk> \<Longrightarrow> y dvd listgcd (a # xs) * z
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
y dvd x * z
y dvd listgcd xs * z

goal (1 subgoal):
 1. y dvd listgcd (x # xs) * z
[PROOF STEP]
unfolding listgcd_simps
[PROOF STATE]
proof (prove)
using this:
y dvd x * z
y dvd listgcd xs * z

goal (1 subgoal):
 1. y dvd gcd x (listgcd xs) * z
[PROOF STEP]
by (rule gcd_greatest_mult)
[PROOF STATE]
proof (state)
this:
y dvd listgcd (x # xs) * z

goal (1 subgoal):
 1. (\<And>x. x \<in> set [] \<Longrightarrow> y dvd x * z) \<Longrightarrow> y dvd listgcd [] * z
[PROOF STEP]
qed (simp)


[STATEMENT]
lemma cblinfun_of_mat_times:
  fixes M N ::"complex mat"
  defines "nA \<equiv> length (canonical_basis :: 'a::{basis_enum,complex_normed_vector} list)"
    and "nB \<equiv> length (canonical_basis :: 'b::{basis_enum,complex_normed_vector} list)"
    and "nC \<equiv> length (canonical_basis :: 'c::{basis_enum,complex_normed_vector} list)"
  assumes a1: "M \<in> carrier_mat nC nB" and a2: "N \<in> carrier_mat nB nA"
  shows  "cblinfun_of_mat (M * N) = ((cblinfun_of_mat M)::'b \<Rightarrow>\<^sub>C\<^sub>L'c) o\<^sub>C\<^sub>L ((cblinfun_of_mat N)::'a \<Rightarrow>\<^sub>C\<^sub>L'b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have b1: "((cblinfun_of_mat M)::'b \<Rightarrow>\<^sub>C\<^sub>L'c) v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum v)"
    for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat M *\<^sub>V v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by (metis assms(4) cblinfun_of_mat.rep_eq nB_def nC_def)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat M *\<^sub>V ?v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have b2: "((cblinfun_of_mat N)::'a \<Rightarrow>\<^sub>C\<^sub>L'b) v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)"
    for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat N *\<^sub>V v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by (metis assms(5) cblinfun_of_mat.rep_eq nA_def nB_def)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat N *\<^sub>V ?v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have b3: "((cblinfun_of_mat (M * N))::'a \<Rightarrow>\<^sub>C\<^sub>L'c) v
       = basis_enum_of_vec ((M * N) *\<^sub>v vec_of_basis_enum v)"
    for v
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cblinfun_of_mat (M * N) *\<^sub>V v = basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by (metis assms(4) assms(5) cblinfun_of_mat.rep_eq mult_carrier_mat nA_def nC_def)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat (M * N) *\<^sub>V ?v = basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
have "(basis_enum_of_vec ((M * N) *\<^sub>v vec_of_basis_enum v)::'c)
      = (basis_enum_of_vec (M *\<^sub>v ( vec_of_basis_enum ( (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v))::'b ))))"
    for v::'a
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have c1: "vec_of_basis_enum (basis_enum_of_vec x :: 'b) = x"
      if "dim_vec x = nB"
      for x::"complex vec"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec x) = x
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
dim_vec x = nB

goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec x) = x
[PROOF STEP]
unfolding nB_def
[PROOF STATE]
proof (prove)
using this:
dim_vec x = length canonical_basis

goal (1 subgoal):
 1. vec_of_basis_enum (basis_enum_of_vec x) = x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
dim_vec ?x = nB \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec ?x) = ?x

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have c2: "vec_of_basis_enum v \<in> carrier_vec nA"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec_of_basis_enum v \<in> carrier_vec nA
[PROOF STEP]
by (metis (mono_tags, opaque_lifting) add.commute carrier_vec_dim_vec index_add_vec(2)
          index_zero_vec(2) nA_def vec_of_basis_enum_add basis_enum_of_vec_inverse)
[PROOF STATE]
proof (state)
this:
vec_of_basis_enum v \<in> carrier_vec nA

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have "(M * N) *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
using Matrix.assoc_mult_mat_vec a1 a2 c2
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?A \<in> carrier_mat ?n\<^sub>1 ?n\<^sub>2; ?B \<in> carrier_mat ?n\<^sub>2 ?n\<^sub>3; ?v \<in> carrier_vec ?n\<^sub>3\<rbrakk> \<Longrightarrow> ?A * ?B *\<^sub>v ?v = ?A *\<^sub>v (?B *\<^sub>v ?v)
M \<in> carrier_mat nC nB
N \<in> carrier_mat nB nA
vec_of_basis_enum v \<in> carrier_vec nA

goal (1 subgoal):
 1. M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
hence "(basis_enum_of_vec ((M * N) *\<^sub>v vec_of_basis_enum v)::'c)
        = (basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))::'c)"
[PROOF STATE]
proof (prove)
using this:
M * N *\<^sub>v vec_of_basis_enum v = M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v))

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
have "\<dots> =
      (basis_enum_of_vec (M *\<^sub>v ( vec_of_basis_enum ( (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v))::'b ))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. basis_enum_of_vec (M *\<^sub>v (N *\<^sub>v vec_of_basis_enum v)) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
using c1 a2
[PROOF STATE]
proof (prove)
using this:
dim_vec ?x = nB \<Longrightarrow> vec_of_basis_enum (basis_enum_of_vec ?x) = ?x
N \<in> carrier_mat nB nA

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

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))

goal (1 subgoal):
 1. basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum v)))

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)))

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)))

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
using b1 b2 b3
[PROOF STATE]
proof (prove)
using this:
basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v) = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum (basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)))
cblinfun_of_mat M *\<^sub>V ?v = basis_enum_of_vec (M *\<^sub>v vec_of_basis_enum ?v)
cblinfun_of_mat N *\<^sub>V ?v = basis_enum_of_vec (N *\<^sub>v vec_of_basis_enum ?v)
cblinfun_of_mat (M * N) *\<^sub>V ?v = basis_enum_of_vec (M * N *\<^sub>v vec_of_basis_enum ?v)

goal (1 subgoal):
 1. cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N
[PROOF STEP]
by (simp add: cblinfun_eqI scaleC_cblinfun.rep_eq)
[PROOF STATE]
proof (state)
this:
cblinfun_of_mat (M * N) = cblinfun_of_mat M o\<^sub>C\<^sub>L cblinfun_of_mat N

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in Order) Pre_in_segment:"\<lbrakk>a \<in> carrier D; ExPre D a\<rbrakk> \<Longrightarrow>
                  Pre D a \<in> segment D a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>a \<in> carrier D; ExPre D a\<rbrakk> \<Longrightarrow> Pre D a \<in> segment D a
[PROOF STEP]
by (frule Pre_element[of "a"], assumption+, (erule conjE)+,
    simp add:segment_inc)


[STATEMENT]
lemma qtable_unit_table: "(\<And>x. wf_tuple n {} x \<Longrightarrow> P x \<Longrightarrow> Q x) \<Longrightarrow> qtable n {} P Q (unit_table n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>wf_tuple n {} x; P x\<rbrakk> \<Longrightarrow> Q x) \<Longrightarrow> qtable n {} P Q (unit_table n)
[PROOF STEP]
unfolding qtable_def table_def in_unit_table
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. \<lbrakk>wf_tuple n {} x; P x\<rbrakk> \<Longrightarrow> Q x) \<Longrightarrow> Ball (unit_table n) (wf_tuple n {}) \<and> (\<forall>x. (wf_tuple n {} x \<and> P x \<longrightarrow> Q x) \<and> (wf_tuple n {} x \<and> P x \<and> Q x \<longrightarrow> wf_tuple n {} x))
[PROOF STEP]
by auto


[STATEMENT]
lemma tl_as_projection:
  assumes "a \<in> carrier (R\<^bsup>n\<^esup>)"
  shows "tl a = project_at_indices {1::nat..<n} a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have 0: "indices_of a = {..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. indices_of a = {..<n}
[PROOF STEP]
using assms cartesian_power_car_memE indices_of_def
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> length ?as = ?n
indices_of ?as = {..<length ?as}

goal (1 subgoal):
 1. indices_of a = {..<n}
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
indices_of a = {..<n}

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have 1: "length (tl a) = n - 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (tl a) = n - 1
[PROOF STEP]
using assms cartesian_power_car_memE length_tl
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier (R\<^bsup>n\<^esup>)
?as \<in> carrier (?R\<^bsup>?n\<^esup>) \<Longrightarrow> length ?as = ?n
length (tl ?xs) = degree ?xs

goal (1 subgoal):
 1. length (tl a) = n - 1
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
length (tl a) = n - 1

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have 2: "length (tl a) = length (project_at_indices {1::nat..<n} a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (tl a) = length (nths a {1..<n})
[PROOF STEP]
using 0 assms cartesian_power_car_memE[of a R n] proj_at_index_list_length[of "{1::nat..<n}" a]
[PROOF STATE]
proof (prove)
using this:
indices_of a = {..<n}
a \<in> carrier (R\<^bsup>n\<^esup>)
a \<in> carrier (R\<^bsup>n\<^esup>) \<Longrightarrow> length a = n
{1..<n} \<subseteq> indices_of a \<Longrightarrow> length (nths a {1..<n}) = card {1..<n}

goal (1 subgoal):
 1. length (tl a) = length (nths a {1..<n})
[PROOF STEP]
by (metis "1" atLeastLessThan_iff card_atLeastLessThan  lessThan_iff subsetI)
[PROOF STATE]
proof (state)
this:
length (tl a) = length (nths a {1..<n})

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
have "\<And>i. i < n - 1 \<Longrightarrow> (tl a) ! i = (project_at_indices {1::nat..<n} a) ! i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i. i < n - 1 \<Longrightarrow> tl a ! i = nths a {1..<n} ! i
[PROOF STEP]
using project_at_indices_consecutive_indices'[of 1 n n a R] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>1 < n; n \<le> n; a \<in> carrier (R\<^bsup>n\<^esup>); ?k < n - 1\<rbrakk> \<Longrightarrow> nths a {1..<n} ! ?k = a ! (1 + ?k)
a \<in> carrier (R\<^bsup>n\<^esup>)

goal (1 subgoal):
 1. \<And>i. i < n - 1 \<Longrightarrow> tl a ! i = nths a {1..<n} ! i
[PROOF STEP]
by (metis "1" One_nat_def Suc_leI le_add_diff_inverse2 le_numeral_extra(4)
        linorder_neqE_nat nat_add_left_cancel_le nat_diff_split_asm not_less0 nth_tl plus_1_eq_Suc)
[PROOF STATE]
proof (state)
this:
?i < n - 1 \<Longrightarrow> tl a ! ?i = nths a {1..<n} ! ?i

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
?i < n - 1 \<Longrightarrow> tl a ! ?i = nths a {1..<n} ! ?i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?i < n - 1 \<Longrightarrow> tl a ! ?i = nths a {1..<n} ! ?i

goal (1 subgoal):
 1. tl a = nths a {1..<n}
[PROOF STEP]
by (metis "1" "2" nth_equalityI)
[PROOF STATE]
proof (state)
this:
tl a = nths a {1..<n}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma poly_compose_add:
  assumes "is_poly_tuple m fs"
  assumes "length fs = n"
  assumes "f \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  assumes "g \<in> carrier (R[\<X>\<^bsub>n\<^esub>])"
  shows "poly_compose n m fs (f \<oplus>\<^bsub>R[\<X>\<^bsub>n\<^esub>]\<^esub> g) = (poly_compose n m fs f) \<oplus>\<^bsub>coord_ring R m\<^esub>  (poly_compose n m fs g)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. poly_compose n m fs (f \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> g) = poly_compose n m fs f \<oplus>\<^bsub>R [\<X>\<^bsub>m\<^esub>]\<^esub> poly_compose n m fs g
[PROOF STEP]
using assms poly_compose_ring_hom ring_hom_add
[PROOF STATE]
proof (prove)
using this:
is_poly_tuple m fs
length fs = n
f \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
g \<in> carrier (R [\<X>\<^bsub>n\<^esub>])
\<lbrakk>is_poly_tuple ?m ?fs; length ?fs = ?n\<rbrakk> \<Longrightarrow> ring_hom_ring (R [\<X>\<^bsub>?n\<^esub>]) (R [\<X>\<^bsub>?m\<^esub>]) (poly_compose ?n ?m ?fs)
\<lbrakk>?h \<in> ring_hom ?R ?S; ?x \<in> carrier ?R; ?y \<in> carrier ?R\<rbrakk> \<Longrightarrow> ?h (?x \<oplus>\<^bsub>?R\<^esub> ?y) = ?h ?x \<oplus>\<^bsub>?S\<^esub> ?h ?y

goal (1 subgoal):
 1. poly_compose n m fs (f \<oplus>\<^bsub>R [\<X>\<^bsub>n\<^esub>]\<^esub> g) = poly_compose n m fs f \<oplus>\<^bsub>R [\<X>\<^bsub>m\<^esub>]\<^esub> poly_compose n m fs g
[PROOF STEP]
by (metis (mono_tags, lifting) ring_hom_ring.homh)


[STATEMENT]
lemma nonneg_has_sum_le_0D_complex:
  fixes f :: "'a \<Rightarrow> complex"
  assumes "has_sum f A a" and \<open>a \<le> 0\<close>
    and "\<And>x. x \<in> A \<Longrightarrow> f x \<ge> 0" and "x \<in> A"
  shows "f x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f x = 0
[PROOF STEP]
by (metis assms infsumI nonneg_infsum_le_0D_complex summable_on_def)


[STATEMENT]
lemma ofilter_ordLeq:
assumes "Well_order r" and "ofilter r A"
shows "Restr r A \<le>o r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
have "A \<le> Field r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A \<subseteq> Field r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
Well_order r
ofilter r A

goal (1 subgoal):
 1. A \<subseteq> Field r
[PROOF STEP]
by (auto simp add: wo_rel_def wo_rel.ofilter_def)
[PROOF STATE]
proof (state)
this:
A \<subseteq> Field r

goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> Field r

goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> Field r
Well_order r
ofilter r A

goal (1 subgoal):
 1. Restr r A \<le>o r
[PROOF STEP]
by (simp add: ofilter_subset_ordLeq wo_rel.Field_ofilter
      wo_rel_def Restr_Field)
[PROOF STATE]
proof (state)
this:
Restr r A \<le>o r

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_sums_not_infty_minus:
  assumes "f sums (a::ereal)"
    and "\<bar>a\<bar> \<noteq> \<infinity>"
  shows "(\<lambda>n. - f n) sums -a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
have "\<And>n. \<bar>f n\<bar> \<noteq> \<infinity>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. \<bar>f n\<bar> \<noteq> \<infinity>
[PROOF STEP]
using assms  ereal_sums_not_infty
[PROOF STATE]
proof (prove)
using this:
f sums a
\<bar>a\<bar> \<noteq> \<infinity>
\<lbrakk>?f sums ?a; \<bar>?a\<bar> \<noteq> \<infinity>\<rbrakk> \<Longrightarrow> \<bar>?f ?n\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. \<And>n. \<bar>f n\<bar> \<noteq> \<infinity>
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<bar>f ?n\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
define g where "g = (\<lambda>n. real_of_ereal (f n))"
[PROOF STATE]
proof (state)
this:
g = (\<lambda>n. real_of_ereal (f n))

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
have "\<And>n. f n = ereal (g n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>n. f n = ereal (g n)
[PROOF STEP]
using  \<open>\<And>n. \<bar>f n\<bar> \<noteq> \<infinity>\<close>
[PROOF STATE]
proof (prove)
using this:
\<bar>f ?n\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. \<And>n. f n = ereal (g n)
[PROOF STEP]
by (simp add: ereal_real' g_def)
[PROOF STATE]
proof (state)
this:
f ?n = ereal (g ?n)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "\<And>n. - f n = ereal (-g n)"
[PROOF STATE]
proof (prove)
using this:
f ?n = ereal (g ?n)

goal (1 subgoal):
 1. \<And>n. - f n = ereal (- g n)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
- f ?n = ereal (- g ?n)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
have "\<exists>r. a = ereal (r)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>r. a = ereal r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
f sums a
\<bar>a\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. \<exists>r. a = ereal r
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>r. a = ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>r. a = ereal r
[PROOF STEP]
obtain r where "a = ereal r"
[PROOF STATE]
proof (prove)
using this:
\<exists>r. a = ereal r

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

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "f sums (ereal r)"
[PROOF STATE]
proof (prove)
using this:
a = ereal r

goal (1 subgoal):
 1. f sums ereal r
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a = ereal r
f sums a
\<bar>a\<bar> \<noteq> \<infinity>

goal (1 subgoal):
 1. f sums ereal r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f sums ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. ereal (g n)) sums (ereal r)"
[PROOF STATE]
proof (prove)
using this:
f sums ereal r

goal (1 subgoal):
 1. (\<lambda>n. ereal (g n)) sums ereal r
[PROOF STEP]
using \<open>\<And>n. f n = ereal (g n)\<close>
      sums_cong[of f "\<lambda>n. ereal (g n)"]
[PROOF STATE]
proof (prove)
using this:
f sums ereal r
f ?n = ereal (g ?n)
(\<And>n. f n = ereal (g n)) \<Longrightarrow> f sums ?c = (\<lambda>n. ereal (g n)) sums ?c

goal (1 subgoal):
 1. (\<lambda>n. ereal (g n)) sums ereal r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (g n)) sums ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "g sums r"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (g n)) sums ereal r

goal (1 subgoal):
 1. g sums r
[PROOF STEP]
by (simp add: sums_ereal)
[PROOF STATE]
proof (state)
this:
g sums r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. -g n) sums -r"
[PROOF STATE]
proof (prove)
using this:
g sums r

goal (1 subgoal):
 1. (\<lambda>n. - g n) sums - r
[PROOF STEP]
using sums_minus[of g]
[PROOF STATE]
proof (prove)
using this:
g sums r
g sums ?a \<Longrightarrow> (\<lambda>n. - g n) sums - ?a

goal (1 subgoal):
 1. (\<lambda>n. - g n) sums - r
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - g n) sums - r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. ereal (- g n)) sums ereal (-r)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - g n) sums - r

goal (1 subgoal):
 1. (\<lambda>n. ereal (- g n)) sums ereal (- r)
[PROOF STEP]
by (simp add: sums_ereal)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. ereal (- g n)) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
hence "(\<lambda>n. - f n) sums (ereal (-r))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (- g n)) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums ereal (- r)
[PROOF STEP]
using \<open>\<And>n. - f n = ereal (-g n)\<close>
      sums_cong[of f "\<lambda>n. ereal (g n)"]
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. ereal (- g n)) sums ereal (- r)
- f ?n = ereal (- g ?n)
(\<And>n. f n = ereal (g n)) \<Longrightarrow> f sums ?c = (\<lambda>n. ereal (g n)) sums ?c

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums ereal (- r)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - f n) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - f n) sums ereal (- r)

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
using \<open>a = ereal r\<close>
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - f n) sums ereal (- r)
a = ereal r

goal (1 subgoal):
 1. (\<lambda>n. - f n) sums - a
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - f n) sums - a

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma iTILL_add_neg: "[\<dots>n] \<oplus>- k = (if k \<le> n then [\<dots>n - k] else {})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [\<dots>n] \<oplus>- k = (if k \<le> n then [\<dots>n - k] else {})
[PROOF STEP]
by (force simp add: set_eq_iff iT_Plus_neg_mem_iff iT_iff)


[STATEMENT]
lemma zeros_is_alpha: "list_all (is_alph v) (zeros n v)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. list_all (is_alph v) (zeros n v)
[PROOF STEP]
by (induct n) (simp add: zeros_def is_alph_def)+


[STATEMENT]
lemma Amax_ge:"\<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> Z\<^sub>-\<^sub>\<infinity>; j \<in> {j. j \<le> n}\<rbrakk> \<Longrightarrow>
                                                 (f j) \<le> (Amax n f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>f \<in> {j. j \<le> n} \<rightarrow> Z\<^sub>-\<^sub>\<infinity>; j \<in> {j. j \<le> n}\<rbrakk> \<Longrightarrow> f j \<le> Amax n f
[PROOF STEP]
apply (simp add:Amax_geTr)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma inj_on_inv_image_inv_of_rat_Pow_rat: "inj_on (image (inv of_rat)) (Pow \<rat>)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inj_on ((`) (inv of_rat)) (Pow \<rat>)
[PROOF STEP]
by (simp add: inj_on_inv_of_rat_rat inj_on_image_Pow)


[STATEMENT]
lemma app_tl_empty_length[rule_format]: "tl (map f [0..<length l] @ [a]) = []
                                        \<Longrightarrow> l = []"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tl (map f [0..<length l] @ [a]) = [] \<Longrightarrow> l = []
[PROOF STEP]
by (drule tl_hd_empty, simp)


[STATEMENT]
lemma eqclass_empty_iff[simp]: "r `` {x} = {} \<longleftrightarrow> x \<notin> Domain r"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (r `` {x} = {}) = (x \<notin> Domain r)
[PROOF STEP]
by auto


[STATEMENT]
lemma lemma_2_5_13_a: "a \<le> b \<Longrightarrow>  b l\<rightarrow> c \<le> a l\<rightarrow> c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> b l\<rightarrow> c \<le> a l\<rightarrow> c
[PROOF STEP]
apply (simp add: left_residual [THEN sym])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b l\<rightarrow> c) * a \<le> c
[PROOF STEP]
apply (rule_tac y = "(b l\<rightarrow> c) * b" in order_trans)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. a \<le> b \<Longrightarrow> (b l\<rightarrow> c) * a \<le> (b l\<rightarrow> c) * b
 2. a \<le> b \<Longrightarrow> (b l\<rightarrow> c) * b \<le> c
[PROOF STEP]
apply (simp add: mult_left_mono)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a \<le> b \<Longrightarrow> (b l\<rightarrow> c) * b \<le> c
[PROOF STEP]
by (simp add: left_residual)


[STATEMENT]
lemma nneg_bounded_by_nneg[dest]:
  "\<lbrakk> bounded_by b P; nneg P \<rbrakk> \<Longrightarrow> 0 \<le> (b::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>bounded_by b P; nneg P\<rbrakk> \<Longrightarrow> 0 \<le> b
[PROOF STEP]
by (blast intro:order_trans)


[STATEMENT]
lemma sum_upto_ln_conv_sum_upto_mangoldt:
  "sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * nat \<lfloor>x / real n\<rfloor>) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
have "sum_upto (\<lambda>n. ln (real n)) x =
          sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x
[PROOF STEP]
by (intro sum_upto_cong) (simp_all add: mangoldt_sum)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>k. sum_upto (\<lambda>d. mangoldt k) (x / real k)) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x = sum_upto (\<lambda>k. sum_upto (\<lambda>d. mangoldt k) (x / real k)) x
[PROOF STEP]
by (rule sum_upto_sum_divisors)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x = sum_upto (\<lambda>k. sum_upto (\<lambda>d. mangoldt k) (x / real k)) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. \<Sum>d | d dvd n. mangoldt d) x = sum_upto (\<lambda>k. sum_upto (\<lambda>d. mangoldt k) (x / real k)) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
have "\<dots> = sum_upto (\<lambda>n. mangoldt n * nat \<lfloor>x / real n\<rfloor>) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum_upto (\<lambda>k. sum_upto (\<lambda>d. mangoldt k) (x / real k)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
unfolding sum_upto_altdef
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<in>{0<..nat \<lfloor>x\<rfloor>}. \<Sum>d\<in>{0<..nat \<lfloor>x / real k\<rfloor>}. mangoldt k) = (\<Sum>n\<in>{0<..nat \<lfloor>x\<rfloor>}. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>))
[PROOF STEP]
by (simp add: mult_ac)
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>k. sum_upto (\<lambda>d. mangoldt k) (x / real k)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x

goal (1 subgoal):
 1. sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
sum_upto (\<lambda>n. ln (real n)) x = sum_upto (\<lambda>n. mangoldt n * real (nat \<lfloor>x / real n\<rfloor>)) x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma dot2_rearrange:
  fixes u x :: "real^2"
  assumes "u \<bullet> x = 0" and "x \<noteq> 0"
  shows "\<exists>k. u = k *\<^sub>R (rotate2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
proof cases
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?P \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
 2. \<not> ?P \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
assume "x$1 = 0"
[PROOF STATE]
proof (state)
this:
x $ 1 = 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
 2. \<not> ?P \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
with real2_eq [of x 0] and \<open>x \<noteq> 0\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>x $ 1 = 0 $ 1; x $ 2 = 0 $ 2\<rbrakk> \<Longrightarrow> x = 0
x \<noteq> 0
x $ 1 = 0
[PROOF STEP]
have "x$2 \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>x $ 1 = 0 $ 1; x $ 2 = 0 $ 2\<rbrakk> \<Longrightarrow> x = 0
x \<noteq> 0
x $ 1 = 0

goal (1 subgoal):
 1. x $ 2 \<noteq> 0
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x $ 2 \<noteq> 0

goal (2 subgoals):
 1. ?P \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
 2. \<not> ?P \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
with dot2_rearrange_2 and \<open>u \<bullet> x = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?u \<bullet> ?x = 0; ?x $ 2 \<noteq> 0\<rbrakk> \<Longrightarrow> ?u = - (?u $ 1 / ?x $ 2) *\<^sub>R rotate2 ?x
u \<bullet> x = 0
x $ 2 \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<bullet> ?x = 0; ?x $ 2 \<noteq> 0\<rbrakk> \<Longrightarrow> ?u = - (?u $ 1 / ?x $ 2) *\<^sub>R rotate2 ?x
u \<bullet> x = 0
x $ 2 \<noteq> 0

goal (1 subgoal):
 1. \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>k. u = k *\<^sub>R rotate2 x

goal (1 subgoal):
 1. x $ 1 \<noteq> 0 \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x $ 1 \<noteq> 0 \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
assume "x$1 \<noteq> 0"
[PROOF STATE]
proof (state)
this:
x $ 1 \<noteq> 0

goal (1 subgoal):
 1. x $ 1 \<noteq> 0 \<Longrightarrow> \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
with dot2_rearrange_1 and \<open>u \<bullet> x = 0\<close>
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>?u \<bullet> ?x = 0; ?x $ 1 \<noteq> 0\<rbrakk> \<Longrightarrow> ?u = (?u $ 2 / ?x $ 1) *\<^sub>R rotate2 ?x
u \<bullet> x = 0
x $ 1 \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?u \<bullet> ?x = 0; ?x $ 1 \<noteq> 0\<rbrakk> \<Longrightarrow> ?u = (?u $ 2 / ?x $ 1) *\<^sub>R rotate2 ?x
u \<bullet> x = 0
x $ 1 \<noteq> 0

goal (1 subgoal):
 1. \<exists>k. u = k *\<^sub>R rotate2 x
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>k. u = k *\<^sub>R rotate2 x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma the_enat_0_simp [simp]:
  "the_enat_0 0 = 0"
  "the_enat_0 1 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. the_enat_0 0 = 0 &&& the_enat_0 1 = 1
[PROOF STEP]
by (simp add: zero_enat_def one_enat_def)+


[STATEMENT]
lemma splus_adds_term_iff: "t \<oplus> u adds\<^sub>t v \<longleftrightarrow> (t adds\<^sub>p v \<and> u adds\<^sub>t (v \<ominus> t))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (t \<oplus> u adds\<^sub>t v) = (t adds\<^sub>p v \<and> u adds\<^sub>t v \<ominus> t)
[PROOF STEP]
by (metis adds_ppI adds_pp_splus adds_termE splus_adds_termI_1 splus_adds_term_0)


[STATEMENT]
lemma pivot_valuation_id: "\<lbrakk>\<triangle> (\<T> s); x\<^sub>i \<in> lvars (\<T> s); x\<^sub>j \<in> rvars_of_lvar (\<T> s) x\<^sub>i\<rbrakk> \<Longrightarrow> \<V> (pivot x\<^sub>i x\<^sub>j s) = \<V> s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>\<triangle> (\<T> s); x\<^sub>i \<in> lvars (\<T> s); x\<^sub>j \<in> rvars_eq (eq_for_lvar (\<T> s) x\<^sub>i)\<rbrakk> \<Longrightarrow> \<V> (pivot x\<^sub>i x\<^sub>j s) = \<V> s
[PROOF STEP]
using pivot_id
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>\<triangle> (\<T> ?s); ?x\<^sub>i \<in> lvars (\<T> ?s); ?x\<^sub>j \<in> rvars_eq (eq_for_lvar (\<T> ?s) ?x\<^sub>i)\<rbrakk> \<Longrightarrow> let s' = pivot ?x\<^sub>i ?x\<^sub>j ?s in \<V> s' = \<V> ?s \<and> \<B>\<^sub>i s' = \<B>\<^sub>i ?s \<and> \<U> s' = \<U> ?s \<and> \<U>\<^sub>c s' = \<U>\<^sub>c ?s

goal (1 subgoal):
 1. \<lbrakk>\<triangle> (\<T> s); x\<^sub>i \<in> lvars (\<T> s); x\<^sub>j \<in> rvars_eq (eq_for_lvar (\<T> s) x\<^sub>i)\<rbrakk> \<Longrightarrow> \<V> (pivot x\<^sub>i x\<^sub>j s) = \<V> s
[PROOF STEP]
by (simp add: Let_def)


[STATEMENT]
lemma Pi_gr_1[simp]: "Pi n > Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 < Pi n
[PROOF STEP]
proof(induct n, auto simp: Pi.simps Np.simps)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. Suc 0 < Pi n \<Longrightarrow> Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
fix n
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. Suc 0 < Pi n \<Longrightarrow> Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
let ?setx = "{y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>n. Suc 0 < Pi n \<Longrightarrow> Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
have "finite ?setx"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
finite {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}

goal (1 subgoal):
 1. \<And>n. Suc 0 < Pi n \<Longrightarrow> Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
finite {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}

goal (1 subgoal):
 1. \<And>n. Suc 0 < Pi n \<Longrightarrow> Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
have "?setx \<noteq> {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y} \<noteq> {}
[PROOF STEP]
using prime_ex[of "Pi n"]
[PROOF STATE]
proof (prove)
using this:
\<exists>p>Pi n. p \<le> Suc (Pi n!) \<and> Prime p

goal (1 subgoal):
 1. {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y} \<noteq> {}
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
{y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y} \<noteq> {}

goal (1 subgoal):
 1. \<And>n. Suc 0 < Pi n \<Longrightarrow> Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
finite {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
{y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y} \<noteq> {}
[PROOF STEP]
show "Suc 0 < Min ?setx"
[PROOF STATE]
proof (prove)
using this:
finite {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
{y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y} \<noteq> {}

goal (1 subgoal):
 1. Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}
[PROOF STEP]
apply(simp add: Min_gr_iff)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>x>Pi n. x \<le> Suc (Pi n!) \<and> Prime x \<Longrightarrow> \<forall>x. x \<le> Suc (Pi n!) \<and> Pi n < x \<and> Prime x \<longrightarrow> Suc 0 < x
[PROOF STEP]
apply(auto simp: Prime.simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
Suc 0 < Min {y. y \<le> Suc (Pi n!) \<and> Pi n < y \<and> Prime y}

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma omega_le_Aleph [simp]: "\<omega> \<le> \<aleph>\<alpha>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<omega> \<le> \<aleph>\<alpha>
[PROOF STEP]
using InfCard_def
[PROOF STATE]
proof (prove)
using this:
InfCard ?\<kappa> \<equiv> Card ?\<kappa> \<and> \<omega> \<le> ?\<kappa>

goal (1 subgoal):
 1. \<omega> \<le> \<aleph>\<alpha>
[PROOF STEP]
by auto


[STATEMENT]
lemma conjl2_iff: "x \<lhd> y \<le> z \<longleftrightarrow> y \<le> -(-z \<rhd> x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<lhd> y \<le> z) = (y \<le> - (- z \<rhd> x))
[PROOF STEP]
by (metis conjl1_iff conjugate_r_def compl_le_swap2 double_compl resr_galois)


[STATEMENT]
lemma degree_le_iff: "MPoly_Type.degree p x \<le> k \<longleftrightarrow> (\<forall>m\<in>monomials p. lookup m x \<le> k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (MPoly_Type.degree p x \<le> k) = (\<forall>m\<in>monomials p. lookup m x \<le> k)
[PROOF STEP]
by transfer simp


[STATEMENT]
theorem sum_max_code_correct:
  assumes "ls.\<alpha> V \<noteq> {}"
  shows "sum_max_code V = dRETURN (s,m) \<Longrightarrow> s=\<Sum>(ls.\<alpha> V) \<and> m=Max (ls.\<alpha> V)"
    and "sum_max_code V \<noteq> dFAIL"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum_max_code V = dRETURN (s, m) \<Longrightarrow> s = \<Sum> (ls.\<alpha> V) \<and> m = Max (ls.\<alpha> V)) &&& sum_max_code V \<noteq> dFAIL
[PROOF STEP]
txt \<open>The proof is done by transitivity, and unfolding some
    definitions:\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sum_max_code V = dRETURN (s, m) \<Longrightarrow> s = \<Sum> (ls.\<alpha> V) \<and> m = Max (ls.\<alpha> V)) &&& sum_max_code V \<noteq> dFAIL
[PROOF STEP]
using nres_correctD[OF order_trans[OF sum_max_code.refine sum_max_impl_correct,
    of V "ls.\<alpha> V"]] assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>(V, ls.\<alpha> V) \<in> br ls.\<alpha> ls.invar; ls.\<alpha> V \<noteq> {}; sum_max_code V = dRETURN ?x\<rbrakk> \<Longrightarrow> case ?x of (s, m) \<Rightarrow> s = \<Sum> (ls.\<alpha> V) \<and> m = Max (ls.\<alpha> V)
\<lbrakk>(V, ls.\<alpha> V) \<in> br ls.\<alpha> ls.invar; ls.\<alpha> V \<noteq> {}\<rbrakk> \<Longrightarrow> sum_max_code V \<noteq> dFAIL
ls.\<alpha> V \<noteq> {}

goal (1 subgoal):
 1. (sum_max_code V = dRETURN (s, m) \<Longrightarrow> s = \<Sum> (ls.\<alpha> V) \<and> m = Max (ls.\<alpha> V)) &&& sum_max_code V \<noteq> dFAIL
[PROOF STEP]
by (auto simp: refine_rel_defs)


[STATEMENT]
lemma pre_post_compose_3:
  "(-p\<stileturn>-q)*(-q\<stileturn>-q) = -p\<stileturn>-q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (- p \<stileturn> - q) * (- q \<stileturn> - q) = - p \<stileturn> - q
[PROOF STEP]
by (metis order.antisym mult_right_isotone mult_1_right pre_post_compose_1 pre_post_reflexive)


[STATEMENT]
lemma bernoulli_denom_dvd: "bernoulli_denom n dvd (2 * (2 ^ n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
proof (cases "even n \<and> n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
even n \<and> 0 < n

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
hence "bernoulli_denom n = \<Prod>{p. prime p \<and> (p - 1) dvd n}"
[PROOF STATE]
proof (prove)
using this:
even n \<and> 0 < n

goal (1 subgoal):
 1. bernoulli_denom n = \<Prod>{p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
by (auto simp: bernoulli_denom_def)
[PROOF STATE]
proof (state)
this:
bernoulli_denom n = \<Prod>{p. prime p \<and> p - 1 dvd n}

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
bernoulli_denom n = \<Prod>{p. prime p \<and> p - 1 dvd n}

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
have "\<dots> dvd (2 * (2 ^ n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>{p. prime p \<and> p - 1 dvd n} dvd 2 * (2 ^ n - 1)
[PROOF STEP]
proof (rule prime_prod_dvdI; clarify?)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. finite {p. prime p \<and> p - 1 dvd n}
 2. \<And>x. \<lbrakk>prime x; x - 1 dvd n\<rbrakk> \<Longrightarrow> x dvd 2 * (2 ^ n - 1)
 3. inj_on (\<lambda>x. x) {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
from True
[PROOF STATE]
proof (chain)
picking this:
even n \<and> 0 < n
[PROOF STEP]
show "finite {p. prime p \<and> (p - 1) dvd n}"
[PROOF STATE]
proof (prove)
using this:
even n \<and> 0 < n

goal (1 subgoal):
 1. finite {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
by (intro finite_bernoulli_denom_set) auto
[PROOF STATE]
proof (state)
this:
finite {p. prime p \<and> p - 1 dvd n}

goal (2 subgoals):
 1. \<And>x. \<lbrakk>prime x; x - 1 dvd n\<rbrakk> \<Longrightarrow> x dvd 2 * (2 ^ n - 1)
 2. inj_on (\<lambda>x. x) {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>prime x; x - 1 dvd n\<rbrakk> \<Longrightarrow> x dvd 2 * (2 ^ n - 1)
 2. inj_on (\<lambda>x. x) {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
fix p
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. \<lbrakk>prime x; x - 1 dvd n\<rbrakk> \<Longrightarrow> x dvd 2 * (2 ^ n - 1)
 2. inj_on (\<lambda>x. x) {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
assume p: "prime p" "(p - 1) dvd n"
[PROOF STATE]
proof (state)
this:
prime p
p - 1 dvd n

goal (2 subgoals):
 1. \<And>x. \<lbrakk>prime x; x - 1 dvd n\<rbrakk> \<Longrightarrow> x dvd 2 * (2 ^ n - 1)
 2. inj_on (\<lambda>x. x) {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
show "p dvd (2 * (2 ^ n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
proof (cases "p = 2")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. p = 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
 2. p \<noteq> 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
p \<noteq> 2

goal (2 subgoals):
 1. p = 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
 2. p \<noteq> 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
with p
[PROOF STATE]
proof (chain)
picking this:
prime p
p - 1 dvd n
p \<noteq> 2
[PROOF STEP]
have "p > 2"
[PROOF STATE]
proof (prove)
using this:
prime p
p - 1 dvd n
p \<noteq> 2

goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
using prime_gt_1_nat[of p]
[PROOF STATE]
proof (prove)
using this:
prime p
p - 1 dvd n
p \<noteq> 2
prime p \<Longrightarrow> 1 < p

goal (1 subgoal):
 1. 2 < p
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
2 < p

goal (2 subgoals):
 1. p = 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
 2. p \<noteq> 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
have "[2 ^ n - 1 = 1 - 1] (mod p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [2 ^ n - 1 = 1 - 1] (mod p)
[PROOF STEP]
using p \<open>p > 2\<close> prime_odd_nat
[PROOF STATE]
proof (prove)
using this:
prime p
p - 1 dvd n
2 < p
\<lbrakk>prime ?p; 2 < ?p\<rbrakk> \<Longrightarrow> odd ?p

goal (1 subgoal):
 1. [2 ^ n - 1 = 1 - 1] (mod p)
[PROOF STEP]
by (intro cong_diff_nat Carmichael_divides) (auto simp: Carmichael_prime)
[PROOF STATE]
proof (state)
this:
[2 ^ n - 1 = 1 - 1] (mod p)

goal (2 subgoals):
 1. p = 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
 2. p \<noteq> 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
hence "p dvd (2 ^ n - 1)"
[PROOF STATE]
proof (prove)
using this:
[2 ^ n - 1 = 1 - 1] (mod p)

goal (1 subgoal):
 1. p dvd 2 ^ n - 1
[PROOF STEP]
by (simp add: cong_0_iff)
[PROOF STATE]
proof (state)
this:
p dvd 2 ^ n - 1

goal (2 subgoals):
 1. p = 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
 2. p \<noteq> 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
p dvd 2 ^ n - 1

goal (1 subgoal):
 1. p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
p dvd 2 * (2 ^ n - 1)

goal (1 subgoal):
 1. p = 2 \<Longrightarrow> p dvd 2 * (2 ^ n - 1)
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
p dvd 2 * (2 ^ n - 1)

goal (1 subgoal):
 1. inj_on (\<lambda>x. x) {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
\<Prod>{p. prime p \<and> p - 1 dvd n} dvd 2 * (2 ^ n - 1)

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
bernoulli_denom n dvd 2 * (2 ^ n - 1)

goal (1 subgoal):
 1. bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
bernoulli_denom n dvd 2 * (2 ^ n - 1)

goal (1 subgoal):
 1. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n dvd 2 * (2 ^ n - 1)
[PROOF STEP]
qed (auto simp: bernoulli_denom_def)


[STATEMENT]
lemma repeat_zmset_distrib_add_zmset[simp]:
  "repeat_zmset n (add_zmset a A) = replicate_zmset n a + repeat_zmset n A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. repeat_zmset n (add_zmset a A) = replicate_zmset n a + repeat_zmset n A
[PROOF STEP]
by (auto simp: zmultiset_eq_iff int_distrib(2))


[STATEMENT]
lemma cnj_units [simp]: "cnj e1 = -e1" "cnj e2 = -e2" "cnj e3 = -e3"
 "cnj e4 = -e4"   "cnj e5 = -e5"   "cnj e6 = -e6"  "cnj e7 = -e7"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Octonions.cnj e1 = - e1 &&& Octonions.cnj e2 = - e2 &&& Octonions.cnj e3 = - e3) &&& (Octonions.cnj e4 = - e4 &&& Octonions.cnj e5 = - e5) &&& Octonions.cnj e6 = - e6 &&& Octonions.cnj e7 = - e7
[PROOF STEP]
by (simp_all add: octo_eq_iff)


[STATEMENT]
lemma plus_times_le_one_lemma: "i + u - i * u \<le> 1" if "i \<le> 1" "u \<le> 1" for i u::real
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. i + u - i * u \<le> 1
[PROOF STEP]
by (simp add: diff_le_eq sum_le_prod1 that)


[STATEMENT]
lemma nn_integral_spmf_neq_top: "(\<integral>\<^sup>+ x. spmf p x \<partial>count_space UNIV) \<noteq> \<top>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV \<noteq> \<top>
[PROOF STEP]
using nn_integral_measure_spmf[where f="\<lambda>_. 1", of p, symmetric]
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+ x. ennreal (spmf p x) * 1 \<partial>count_space UNIV = \<integral>\<^sup>+ x. 1 \<partial>measure_spmf p

goal (1 subgoal):
 1. \<integral>\<^sup>+ x. ennreal (spmf p x) \<partial>count_space UNIV \<noteq> \<top>
[PROOF STEP]
by simp


[STATEMENT]
lemma comp_sym_sym [simp]:
    assumes "ide a0" and "ide a1"
    shows "\<s>[a1, a0] \<cdot> \<s>[a0, a1] = (a0 \<otimes> a1)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<s>[a1, a0] \<cdot> \<s>[a0, a1] = a0 \<otimes> a1
[PROOF STEP]
using assms sym_def comp_tuple_arr
[PROOF STATE]
proof (prove)
using this:
ide a0
ide a1
\<s>[?a1.0, ?a0.0] \<equiv> if ide ?a0.0 \<and> ide ?a1.0 then \<langle>\<pp>\<^sub>0[?a1.0, ?a0.0], \<pp>\<^sub>1[?a1.0, ?a0.0]\<rangle> else null
\<lbrakk>span ?f ?g; arr ?h; local.dom ?f = cod ?h\<rbrakk> \<Longrightarrow> \<langle>?f, ?g\<rangle> \<cdot> ?h = \<langle>?f \<cdot> ?h, ?g \<cdot> ?h\<rangle>

goal (1 subgoal):
 1. \<s>[a1, a0] \<cdot> \<s>[a0, a1] = a0 \<otimes> a1
[PROOF STEP]
by auto


[STATEMENT]
lemma f1'_gr0[arith]: "f1' > 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < f1'
[PROOF STEP]
using f1_less_f1'
[PROOF STATE]
proof (prove)
using this:
f1 < f1'

goal (1 subgoal):
 1. 0 < f1'
[PROOF STEP]
by linarith


[STATEMENT]
lemma l_suc: "n > 1 \<Longrightarrow> \<not> n \<le> Suc 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 < n \<Longrightarrow> \<not> n \<le> Suc 0
[PROOF STEP]
by simp


[STATEMENT]
lemma zmset_of_subset_iff[simp]: "zmset_of M \<subset>#\<^sub>z zmset_of N \<longleftrightarrow> M \<subset># N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (zmset_of M \<subset>#\<^sub>z zmset_of N) = (M \<subset># N)
[PROOF STEP]
by (simp add: subset_zmset_def subset_mset_def)


[STATEMENT]
lemma Always_allocAsk_le_ask: "System \<in> Always (INT i: lessThan Nclients.
                       {s. (sub i o allocAsk) s \<le> (ask o sub i o client) s})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. System \<in> Always (\<Inter>i<Nclients. {s. (sub i \<circ> allocAsk) s \<le> (ask \<circ> sub i \<circ> client) s})
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x. x < Nclients \<Longrightarrow> System \<in> Always {s. (sub x \<circ> allocAsk) s \<le> (ask \<circ> sub x \<circ> client) s}
[PROOF STEP]
apply (erule System_Follows_ask [THEN Follows_Bounded])
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma measure_pmf_eq_density: "measure_pmf p = density (count_space UNIV) (pmf p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. measure_pmf p = density (count_space UNIV) (\<lambda>x. ennreal (pmf p x))
[PROOF STEP]
proof (transfer, elim conjE)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>prob_space p; sets p = UNIV; AE x in p. Sigma_Algebra.measure p {x} \<noteq> 0\<rbrakk> \<Longrightarrow> p = density (count_space UNIV) (\<lambda>x. ennreal (Sigma_Algebra.measure p {x}))
[PROOF STEP]
fix M :: "'a measure"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>prob_space p; sets p = UNIV; AE x in p. Sigma_Algebra.measure p {x} \<noteq> 0\<rbrakk> \<Longrightarrow> p = density (count_space UNIV) (\<lambda>x. ennreal (Sigma_Algebra.measure p {x}))
[PROOF STEP]
assume [simp]: "sets M = UNIV" and ae: "AE x in M. measure M {x} \<noteq> 0"
[PROOF STATE]
proof (state)
this:
sets M = UNIV
AE x in M. Sigma_Algebra.measure M {x} \<noteq> 0

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prob_space p; sets p = UNIV; AE x in p. Sigma_Algebra.measure p {x} \<noteq> 0\<rbrakk> \<Longrightarrow> p = density (count_space UNIV) (\<lambda>x. ennreal (Sigma_Algebra.measure p {x}))
[PROOF STEP]
assume "prob_space M"
[PROOF STATE]
proof (state)
this:
prob_space M

goal (1 subgoal):
 1. \<And>p. \<lbrakk>prob_space p; sets p = UNIV; AE x in p. Sigma_Algebra.measure p {x} \<noteq> 0\<rbrakk> \<Longrightarrow> p = density (count_space UNIV) (\<lambda>x. ennreal (Sigma_Algebra.measure p {x}))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
prob_space M
[PROOF STEP]
interpret prob_space M
[PROOF STATE]
proof (prove)
using this:
prob_space M

goal (1 subgoal):
 1. prob_space M
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>prob_space p; sets p = UNIV; AE x in p. Sigma_Algebra.measure p {x} \<noteq> 0\<rbrakk> \<Longrightarrow> p = density (count_space UNIV) (\<lambda>x. ennreal (Sigma_Algebra.measure p {x}))
[PROOF STEP]
show "M = density (count_space UNIV) (\<lambda>x. ennreal (measure M {x}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. M = density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))
[PROOF STEP]
proof (rule measure_eqI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
fix A :: "'a set"
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
have "(\<integral>\<^sup>+ x. ennreal (measure M {x}) * indicator A x \<partial>count_space UNIV) =
      (\<integral>\<^sup>+ x. emeasure M {x} * indicator (A \<inter> {x. measure M {x} \<noteq> 0}) x \<partial>count_space UNIV)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A. ennreal (prob {x})\<partial>count_space UNIV = \<integral>\<^sup>+x\<in>A \<inter> {x. prob {x} \<noteq> 0}. emeasure M {x}\<partial>count_space UNIV
[PROOF STEP]
by (auto intro!: nn_integral_cong simp: emeasure_eq_measure split: split_indicator)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. ennreal (prob {x})\<partial>count_space UNIV = \<integral>\<^sup>+x\<in>A \<inter> {x. prob {x} \<noteq> 0}. emeasure M {x}\<partial>count_space UNIV

goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A. ennreal (prob {x})\<partial>count_space UNIV = \<integral>\<^sup>+x\<in>A \<inter> {x. prob {x} \<noteq> 0}. emeasure M {x}\<partial>count_space UNIV

goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
have "\<dots> = (\<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space (A \<inter> {x. measure M {x} \<noteq> 0}))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+x\<in>A \<inter> {x. prob {x} \<noteq> 0}. emeasure M {x}\<partial>count_space UNIV = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space (A \<inter> {x. prob {x} \<noteq> 0})
[PROOF STEP]
by (subst nn_integral_restrict_space[symmetric]) (auto simp: restrict_count_space)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A \<inter> {x. prob {x} \<noteq> 0}. emeasure M {x}\<partial>count_space UNIV = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space (A \<inter> {x. prob {x} \<noteq> 0})

goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+x\<in>A \<inter> {x. prob {x} \<noteq> 0}. emeasure M {x}\<partial>count_space UNIV = \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space (A \<inter> {x. prob {x} \<noteq> 0})

goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
have "\<dots> = emeasure M (\<Union>x\<in>(A \<inter> {x. measure M {x} \<noteq> 0}). {x})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space (A \<inter> {x. prob {x} \<noteq> 0}) = emeasure M (\<Union>x\<in>A \<inter> {x. prob {x} \<noteq> 0}. {x})
[PROOF STEP]
by (intro emeasure_UN_countable[symmetric] countable_Int2 countable_support)
         (auto simp: disjoint_family_on_def)
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space (A \<inter> {x. prob {x} \<noteq> 0}) = emeasure M (\<Union>x\<in>A \<inter> {x. prob {x} \<noteq> 0}. {x})

goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<integral>\<^sup>+ x. emeasure M {x} \<partial>count_space (A \<inter> {x. prob {x} \<noteq> 0}) = emeasure M (\<Union>x\<in>A \<inter> {x. prob {x} \<noteq> 0}. {x})

goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
have "\<dots> = emeasure M A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. emeasure M (\<Union>x\<in>A \<inter> {x. prob {x} \<noteq> 0}. {x}) = emeasure M A
[PROOF STEP]
using ae
[PROOF STATE]
proof (prove)
using this:
AE x in M. prob {x} \<noteq> 0

goal (1 subgoal):
 1. emeasure M (\<Union>x\<in>A \<inter> {x. prob {x} \<noteq> 0}. {x}) = emeasure M A
[PROOF STEP]
by (intro emeasure_eq_AE) auto
[PROOF STATE]
proof (state)
this:
emeasure M (\<Union>x\<in>A \<inter> {x. prob {x} \<noteq> 0}. {x}) = emeasure M A

goal (2 subgoals):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
 2. \<And>A. A \<in> events \<Longrightarrow> emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<integral>\<^sup>+x\<in>A. ennreal (prob {x})\<partial>count_space UNIV = emeasure M A
[PROOF STEP]
show " emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (measure M {x}))) A"
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>A. ennreal (prob {x})\<partial>count_space UNIV = emeasure M A

goal (1 subgoal):
 1. emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
using emeasure_space_1
[PROOF STATE]
proof (prove)
using this:
\<integral>\<^sup>+x\<in>A. ennreal (prob {x})\<partial>count_space UNIV = emeasure M A
emeasure M (space M) = 1

goal (1 subgoal):
 1. emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A
[PROOF STEP]
by (simp add: emeasure_density)
[PROOF STATE]
proof (state)
this:
emeasure M A = emeasure (density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))) A

goal (1 subgoal):
 1. events = sets (density (count_space UNIV) (\<lambda>x. ennreal (prob {x})))
[PROOF STEP]
qed simp
[PROOF STATE]
proof (state)
this:
M = density (count_space UNIV) (\<lambda>x. ennreal (prob {x}))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cosh_ln_complex: "x \<noteq> 0 \<Longrightarrow> cosh (ln x :: complex) = (x + inverse x) / 2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> cosh (Ln x) = (x + inverse x) / 2
[PROOF STEP]
by (simp add: cosh_def exp_minus scaleR_conv_of_real)


[STATEMENT]
lemma union_fset [simp]:
  shows "fset (xs |\<union>| ys) = fset xs \<union> fset ys"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fset (xs |\<union>| ys) = fset xs \<union> fset ys
[PROOF STEP]
by (lifting set_append)


[STATEMENT]
lemma smooth_compat_D2:
  "k-smooth_on (c2 ` (domain c1 \<inter> domain c2)) (c1 \<circ> inv_chart c2)"
  if "k-smooth_compat c1 c2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
have "open (c2 ` (domain c1 \<inter> domain c2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. open (apply_chart c2 ` (domain c1 \<inter> domain c2))
[PROOF STEP]
by (rule open_chart_image) auto
[PROOF STATE]
proof (state)
this:
open (apply_chart c2 ` (domain c1 \<inter> domain c2))

goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
open (apply_chart c2 ` (domain c1 \<inter> domain c2))

goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
have "k-smooth_on (c2 ` (domain c1 \<inter> domain c2)) (c1 \<circ> inv_chart c2) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
using that(1)
[PROOF STATE]
proof (prove)
using this:
k-smooth_compat c1 c2

goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
by (auto simp: smooth_compat_def)
[PROOF STATE]
proof (state)
this:
k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)

goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
open (apply_chart c2 ` (domain c1 \<inter> domain c2))
k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
open (apply_chart c2 ` (domain c1 \<inter> domain c2))
k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)

goal (1 subgoal):
 1. k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
k-smooth_on (apply_chart c2 ` (domain c1 \<inter> domain c2)) (apply_chart c1 \<circ> inv_chart c2)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in field) associated_polynomials_imp_same_roots:
  assumes "p \<in> carrier (poly_ring R)" "p \<noteq> []" and "q \<in> carrier (poly_ring R)" "q \<noteq> []"
  shows "roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
interpret UP: domain "poly_ring R"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. domain (poly_ring R)
[PROOF STEP]
using univ_poly_is_domain[OF carrier_is_subring]
[PROOF STATE]
proof (prove)
using this:
domain (poly_ring R)

goal (1 subgoal):
 1. domain (poly_ring R)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
p \<in> carrier (poly_ring R)
p \<noteq> []
q \<in> carrier (poly_ring R)
q \<noteq> []
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (poly_ring R)
p \<noteq> []
q \<in> carrier (poly_ring R)
q \<noteq> []

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
proof (induction "degree p" arbitrary: p rule: less_induct)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>degree pa < degree p; pa \<in> carrier (poly_ring R); pa \<noteq> []; q \<in> carrier (poly_ring R); q \<noteq> []\<rbrakk> \<Longrightarrow> roots (pa \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots pa + roots q; p \<in> carrier (poly_ring R); p \<noteq> []; q \<in> carrier (poly_ring R); q \<noteq> []\<rbrakk> \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
case less
[PROOF STATE]
proof (state)
this:
\<lbrakk>degree ?p < degree p; ?p \<in> carrier (poly_ring R); ?p \<noteq> []; q \<in> carrier (poly_ring R); q \<noteq> []\<rbrakk> \<Longrightarrow> roots (?p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ?p + roots q
p \<in> carrier (poly_ring R)
p \<noteq> []
q \<in> carrier (poly_ring R)
q \<noteq> []

goal (1 subgoal):
 1. \<And>p. \<lbrakk>\<And>pa. \<lbrakk>degree pa < degree p; pa \<in> carrier (poly_ring R); pa \<noteq> []; q \<in> carrier (poly_ring R); q \<noteq> []\<rbrakk> \<Longrightarrow> roots (pa \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots pa + roots q; p \<in> carrier (poly_ring R); p \<noteq> []; q \<in> carrier (poly_ring R); q \<noteq> []\<rbrakk> \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
proof (cases "roots p = {#}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. roots p = {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. roots p \<noteq> {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
roots p = {#}

goal (2 subgoals):
 1. roots p = {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. roots p \<noteq> {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
roots p = {#}

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
using no_roots_imp_same_roots[of p q] less
[PROOF STATE]
proof (prove)
using this:
roots p = {#}
\<lbrakk>p \<in> carrier (poly_ring R); p \<noteq> []; q \<in> carrier (poly_ring R); roots p = {#}\<rbrakk> \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots q
\<lbrakk>degree ?p < degree p; ?p \<in> carrier (poly_ring R); ?p \<noteq> []; q \<in> carrier (poly_ring R); q \<noteq> []\<rbrakk> \<Longrightarrow> roots (?p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ?p + roots q
p \<in> carrier (poly_ring R)
p \<noteq> []
q \<in> carrier (poly_ring R)
q \<noteq> []

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q

goal (1 subgoal):
 1. roots p \<noteq> {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. roots p \<noteq> {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
roots p \<noteq> {#}

goal (1 subgoal):
 1. roots p \<noteq> {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
with \<open>p \<in> carrier (poly_ring R)\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<in> carrier (poly_ring R)
roots p \<noteq> {#}
[PROOF STEP]
obtain a where a: "a \<in> carrier R" and "a \<in># roots p" and pdiv: "[ \<one>, \<ominus> a ] pdivides p"
          and in_carrier: "[ \<one>, \<ominus> a ] \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (poly_ring R)
roots p \<noteq> {#}

goal (1 subgoal):
 1. (\<And>a. \<lbrakk>a \<in> carrier R; a \<in># roots p; [\<one>, \<ominus> a] pdivides p; [\<one>, \<ominus> a] \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
a \<in> carrier R
a \<in># roots p
[\<one>, \<ominus> a] pdivides p
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. roots p \<noteq> {#} \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
proof (cases "degree p = 1")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree p = 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
degree p = 1

goal (2 subgoals):
 1. degree p = 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
with \<open>p \<in> carrier (poly_ring R)\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<in> carrier (poly_ring R)
degree p = 1
[PROOF STEP]
obtain b c where p: "p = [ b, c ]" and b: "b \<in> carrier R" "b \<noteq> \<zero>" and c: "c \<in> carrier R"
[PROOF STATE]
proof (prove)
using this:
p \<in> carrier (poly_ring R)
degree p = 1

goal (1 subgoal):
 1. (\<And>b c. \<lbrakk>p = [b, c]; b \<in> carrier R; b \<noteq> \<zero>; c \<in> carrier R\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = [b, c]
b \<in> carrier R
b \<noteq> \<zero>
c \<in> carrier R

goal (2 subgoals):
 1. degree p = 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
with \<open>a \<in># roots p\<close>
[PROOF STATE]
proof (chain)
picking this:
a \<in># roots p
p = [b, c]
b \<in> carrier R
b \<noteq> \<zero>
c \<in> carrier R
[PROOF STEP]
have roots: "roots p = {# a #}" and a: "\<ominus> a = inv b \<otimes> c" "a \<in> carrier R"
          and lead: "lead_coeff p = b" and const: "const_term p = c"
[PROOF STATE]
proof (prove)
using this:
a \<in># roots p
p = [b, c]
b \<in> carrier R
b \<noteq> \<zero>
c \<in> carrier R

goal (1 subgoal):
 1. (roots p = {#a#} &&& \<ominus> a = inv b \<otimes> c &&& a \<in> carrier R) &&& lead_coeff p = b &&& const_term p = c
[PROOF STEP]
using degree_one_imp_singleton_roots[of p] less(2) field_Units
[PROOF STATE]
proof (prove)
using this:
a \<in># roots p
p = [b, c]
b \<in> carrier R
b \<noteq> \<zero>
c \<in> carrier R
\<lbrakk>p \<in> carrier (poly_ring R); degree p = 1\<rbrakk> \<Longrightarrow> roots p = {#\<ominus> (inv lead_coeff p \<otimes> const_term p)#}
p \<in> carrier (poly_ring R)
Units R = carrier R - {\<zero>}

goal (1 subgoal):
 1. (roots p = {#a#} &&& \<ominus> a = inv b \<otimes> c &&& a \<in> carrier R) &&& lead_coeff p = b &&& const_term p = c
[PROOF STEP]
unfolding const_term_def
[PROOF STATE]
proof (prove)
using this:
a \<in># roots p
p = [b, c]
b \<in> carrier R
b \<noteq> \<zero>
c \<in> carrier R
\<lbrakk>p \<in> carrier (poly_ring R); degree p = 1\<rbrakk> \<Longrightarrow> roots p = {#\<ominus> (inv lead_coeff p \<otimes> local.eval p \<zero>)#}
p \<in> carrier (poly_ring R)
Units R = carrier R - {\<zero>}

goal (1 subgoal):
 1. (roots p = {#a#} &&& \<ominus> a = inv b \<otimes> c &&& a \<in> carrier R) &&& lead_coeff p = b &&& local.eval p \<zero> = c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
roots p = {#a#}
\<ominus> a = inv b \<otimes> c
a \<in> carrier R
lead_coeff p = b
const_term p = c

goal (2 subgoals):
 1. degree p = 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
hence "(p \<otimes>\<^bsub>poly_ring R\<^esub> q) \<sim>\<^bsub>poly_ring R\<^esub> ([ \<one>, \<ominus> a ] \<otimes>\<^bsub>poly_ring R\<^esub> q)"
[PROOF STATE]
proof (prove)
using this:
roots p = {#a#}
\<ominus> a = inv b \<otimes> c
a \<in> carrier R
lead_coeff p = b
const_term p = c

goal (1 subgoal):
 1. p \<otimes>\<^bsub>poly_ring R\<^esub> q \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q
[PROOF STEP]
using UP.mult_cong_l[OF degree_one_associatedI[OF carrier_is_subfield _ True]] less(2,4)
[PROOF STATE]
proof (prove)
using this:
roots p = {#a#}
\<ominus> a = inv b \<otimes> c
a \<in> carrier R
lead_coeff p = b
const_term p = c
\<lbrakk>p \<in> carrier (poly_ring R); p \<in> carrier (poly_ring R); [\<one>, inv lead_coeff p \<otimes> const_term p] \<in> carrier (poly_ring R); ?b \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> p \<otimes>\<^bsub>poly_ring R\<^esub> ?b \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, inv lead_coeff p \<otimes> const_term p] \<otimes>\<^bsub>poly_ring R\<^esub> ?b
p \<in> carrier (poly_ring R)
q \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. p \<otimes>\<^bsub>poly_ring R\<^esub> q \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q
[PROOF STEP]
by (auto simp add: a lead const)
[PROOF STATE]
proof (state)
this:
p \<otimes>\<^bsub>poly_ring R\<^esub> q \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q

goal (2 subgoals):
 1. degree p = 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
hence "roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ([ \<one>, \<ominus> a ] \<otimes>\<^bsub>poly_ring R\<^esub> q)"
[PROOF STATE]
proof (prove)
using this:
p \<otimes>\<^bsub>poly_ring R\<^esub> q \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ([\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q)
[PROOF STEP]
using associated_polynomials_imp_same_roots in_carrier less(2,4)
[PROOF STATE]
proof (prove)
using this:
p \<otimes>\<^bsub>poly_ring R\<^esub> q \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q
\<lbrakk>?p \<in> carrier (poly_ring R); ?q \<in> carrier (poly_ring R); ?p \<sim>\<^bsub>poly_ring R\<^esub> ?q\<rbrakk> \<Longrightarrow> roots ?p = roots ?q
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)
p \<in> carrier (poly_ring R)
q \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ([\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q)
[PROOF STEP]
unfolding a
[PROOF STATE]
proof (prove)
using this:
p \<otimes>\<^bsub>poly_ring R\<^esub> q \<sim>\<^bsub>poly_ring R\<^esub> [\<one>, inv b \<otimes> c] \<otimes>\<^bsub>poly_ring R\<^esub> q
\<lbrakk>?p \<in> carrier (poly_ring R); ?q \<in> carrier (poly_ring R); ?p \<sim>\<^bsub>poly_ring R\<^esub> ?q\<rbrakk> \<Longrightarrow> roots ?p = roots ?q
[\<one>, inv b \<otimes> c] \<in> carrier (poly_ring R)
p \<in> carrier (poly_ring R)
q \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ([\<one>, inv b \<otimes> c] \<otimes>\<^bsub>poly_ring R\<^esub> q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ([\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q)

goal (2 subgoals):
 1. degree p = 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
 2. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots ([\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> q)

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
unfolding poly_mult_degree_one_monic_imp_same_roots[OF a(2) less(4,5)] roots
[PROOF STATE]
proof (prove)
using this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = add_mset a (roots q)

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = {#a#} + roots q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
degree p \<noteq> 1

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
from \<open>[ \<one>, \<ominus> a ] pdivides p\<close>
[PROOF STATE]
proof (chain)
picking this:
[\<one>, \<ominus> a] pdivides p
[PROOF STEP]
obtain r where p: "p = [ \<one>, \<ominus> a ] \<otimes>\<^bsub>poly_ring R\<^esub> r" and r: "r \<in> carrier (poly_ring R)"
[PROOF STATE]
proof (prove)
using this:
[\<one>, \<ominus> a] pdivides p

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r; r \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding pdivides_def
[PROOF STATE]
proof (prove)
using this:
[\<one>, \<ominus> a] divides\<^bsub>poly_ring R\<^esub> p

goal (1 subgoal):
 1. (\<And>r. \<lbrakk>p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r; r \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
with \<open>p \<noteq> []\<close>
[PROOF STATE]
proof (chain)
picking this:
p \<noteq> []
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<in> carrier (poly_ring R)
[PROOF STEP]
have not_zero: "r \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
p \<noteq> []
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. r \<noteq> []
[PROOF STEP]
using in_carrier univ_poly_zero[of R "carrier R"] UP.integral_iff
[PROOF STATE]
proof (prove)
using this:
p \<noteq> []
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<in> carrier (poly_ring R)
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)
\<zero>\<^bsub>poly_ring R\<^esub> = []
\<lbrakk>?a \<in> carrier (poly_ring R); ?b \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> (?a \<otimes>\<^bsub>poly_ring R\<^esub> ?b = \<zero>\<^bsub>poly_ring R\<^esub>) = (?a = \<zero>\<^bsub>poly_ring R\<^esub> \<or> ?b = \<zero>\<^bsub>poly_ring R\<^esub>)

goal (1 subgoal):
 1. r \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r \<noteq> []

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
with \<open>p = [ \<one>, \<ominus> a ] \<otimes>\<^bsub>poly_ring R\<^esub> r\<close>
[PROOF STATE]
proof (chain)
picking this:
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<noteq> []
[PROOF STEP]
have deg: "degree p = Suc (degree r)"
[PROOF STATE]
proof (prove)
using this:
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<noteq> []

goal (1 subgoal):
 1. degree p = Suc (degree r)
[PROOF STEP]
using poly_mult_degree_eq[OF carrier_is_subring, of _ r] in_carrier r
[PROOF STATE]
proof (prove)
using this:
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<noteq> []
\<lbrakk>polynomial (carrier R) ?p1.0; polynomial (carrier R) r\<rbrakk> \<Longrightarrow> degree (poly_mult ?p1.0 r) = (if ?p1.0 = [] \<or> r = [] then 0 else degree ?p1.0 + degree r)
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)
r \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. degree p = Suc (degree r)
[PROOF STEP]
unfolding univ_poly_carrier sym[OF univ_poly_mult[of R "carrier R"]]
[PROOF STATE]
proof (prove)
using this:
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r
r \<noteq> []
\<lbrakk>?p1.0 \<in> carrier (poly_ring R); r \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> degree (?p1.0 \<otimes>\<^bsub>poly_ring R\<^esub> r) = (if ?p1.0 = [] \<or> r = [] then 0 else degree ?p1.0 + degree r)
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)
r \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. degree p = Suc (degree r)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree p = Suc (degree r)

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
with \<open>r \<noteq> []\<close> and \<open>q \<noteq> []\<close>
[PROOF STATE]
proof (chain)
picking this:
r \<noteq> []
q \<noteq> []
degree p = Suc (degree r)
[PROOF STEP]
have "r \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
r \<noteq> []
q \<noteq> []
degree p = Suc (degree r)

goal (1 subgoal):
 1. r \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> []
[PROOF STEP]
using in_carrier univ_poly_zero[of R "carrier R"] UP.integral less(4) r
[PROOF STATE]
proof (prove)
using this:
r \<noteq> []
q \<noteq> []
degree p = Suc (degree r)
[\<one>, \<ominus> a] \<in> carrier (poly_ring R)
\<zero>\<^bsub>poly_ring R\<^esub> = []
\<lbrakk>?a \<otimes>\<^bsub>poly_ring R\<^esub> ?b = \<zero>\<^bsub>poly_ring R\<^esub>; ?a \<in> carrier (poly_ring R); ?b \<in> carrier (poly_ring R)\<rbrakk> \<Longrightarrow> ?a = \<zero>\<^bsub>poly_ring R\<^esub> \<or> ?b = \<zero>\<^bsub>poly_ring R\<^esub>
q \<in> carrier (poly_ring R)
r \<in> carrier (poly_ring R)

goal (1 subgoal):
 1. r \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> []
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
r \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> []

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
hence "roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q))"
[PROOF STATE]
proof (prove)
using this:
r \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> []

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q))
[PROOF STEP]
using poly_mult_degree_one_monic_imp_same_roots[OF a UP.m_closed[OF r less(4)]]
                UP.m_assoc[OF in_carrier r less(4)] p
[PROOF STATE]
proof (prove)
using this:
r \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> []
r \<otimes>\<^bsub>poly_ring R\<^esub> q \<noteq> [] \<Longrightarrow> roots ([\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> (r \<otimes>\<^bsub>poly_ring R\<^esub> q)) = add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q))
[\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r \<otimes>\<^bsub>poly_ring R\<^esub> q = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> (r \<otimes>\<^bsub>poly_ring R\<^esub> q)
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q))

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q))

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
have " ... = add_mset a (roots r + roots q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q)) = add_mset a (roots r + roots q)
[PROOF STEP]
using less(1)[OF _ r not_zero less(4-5)] deg
[PROOF STATE]
proof (prove)
using this:
degree r < degree p \<Longrightarrow> roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots r + roots q
degree p = Suc (degree r)

goal (1 subgoal):
 1. add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q)) = add_mset a (roots r + roots q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q)) = add_mset a (roots r + roots q)

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
add_mset a (roots (r \<otimes>\<^bsub>poly_ring R\<^esub> q)) = add_mset a (roots r + roots q)

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
have " ... = (add_mset a (roots r)) + roots q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset a (roots r + roots q) = add_mset a (roots r) + roots q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
add_mset a (roots r + roots q) = add_mset a (roots r) + roots q

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
add_mset a (roots r + roots q) = add_mset a (roots r) + roots q

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
have " ... = roots p + roots q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_mset a (roots r) + roots q = roots p + roots q
[PROOF STEP]
using poly_mult_degree_one_monic_imp_same_roots[OF a r not_zero] p
[PROOF STATE]
proof (prove)
using this:
roots ([\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r) = add_mset a (roots r)
p = [\<one>, \<ominus> a] \<otimes>\<^bsub>poly_ring R\<^esub> r

goal (1 subgoal):
 1. add_mset a (roots r) + roots q = roots p + roots q
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
add_mset a (roots r) + roots q = roots p + roots q

goal (1 subgoal):
 1. degree p \<noteq> 1 \<Longrightarrow> roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q

goal (1 subgoal):
 1. roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
roots (p \<otimes>\<^bsub>poly_ring R\<^esub> q) = roots p + roots q

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma diff_gt_0_iff_gt_ennreal: "0 < a - b \<longleftrightarrow> (a = top \<and> b = top \<or> b < (a::ennreal))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 < a - b) = (a = top \<and> b = top \<or> b < a)
[PROOF STEP]
by (cases a; cases b) (auto simp: ennreal_minus_if ennreal_less_iff)


[STATEMENT]
lemma diff_divide_cancel:
  fixes z::real shows  "z \<noteq> 0  \<Longrightarrow> (a * z - a * (b * z)) / z = (a - a * b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z \<noteq> 0 \<Longrightarrow> (a * z - a * (b * z)) / z = a - a * b
[PROOF STEP]
by (auto simp: field_simps)


[STATEMENT]
lemma intpow_one [simp]: "x ^\<^sub>Z 1 = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x ^\<^sub>Z 1 = x
[PROOF STEP]
by (simp add: intpow_def)


[STATEMENT]
lemma the_cat_parallel_2_Cod_vdomain[cat_parallel_cs_simps]:
  "\<D>\<^sub>\<circ> (\<up>\<up>\<^sub>C \<aa> \<bb> \<gg> \<ff>\<lparr>Cod\<rparr>) = set {\<aa>, \<bb>, \<gg>, \<ff>}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<D>\<^sub>\<circ> (\<up>\<up>\<^sub>C \<aa> \<bb> \<gg> \<ff>\<lparr>Cod\<rparr>) = ZFC_in_HOL.set {\<aa>, \<bb>, \<gg>, \<ff>}
[PROOF STEP]
unfolding the_cat_parallel_2_def the_cat_parallel_Cod_vdomain
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ZFC_in_HOL.set {\<aa>, \<bb>} \<union>\<^sub>\<circ> ZFC_in_HOL.set {\<gg>, \<ff>} = ZFC_in_HOL.set {\<aa>, \<bb>, \<gg>, \<ff>}
[PROOF STEP]
by auto


[STATEMENT]
lemma sp_Cons :
  shows   "subpath g v1 (e # es) v2 subs \<longleftrightarrow> sub_rel_of g subs
                                           \<and> (v1 = src e  \<or> (v1,src e) \<in> subs\<^sup>+)
                                           \<and> e \<in> edges g
                                           \<and> subpath g (tgt e) es v2 subs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SubRel.subpath g v1 (e # es) v2 subs = (sub_rel_of g subs \<and> (v1 = src e \<or> (v1, src e) \<in> subs\<^sup>+) \<and> e \<in> edges g \<and> SubRel.subpath g (tgt e) es v2 subs)
[PROOF STEP]
using sub_rel_of.trancl_sub_rel_of[of g subs]
[PROOF STATE]
proof (prove)
using this:
sub_rel_of g subs \<Longrightarrow> sub_rel_of g (subs\<^sup>+)

goal (1 subgoal):
 1. SubRel.subpath g v1 (e # es) v2 subs = (sub_rel_of g subs \<and> (v1 = src e \<or> (v1, src e) \<in> subs\<^sup>+) \<and> e \<in> edges g \<and> SubRel.subpath g (tgt e) es v2 subs)
[PROOF STEP]
by (intro iffI, auto simp add : subpath_def vertices_def sub_rel_of_def)