[STATEMENT]
lemma pr_index_enumerator_increase1: "pr_index_enumerator n m < pr_index_enumerator (n+1) m"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pr_index_enumerator n m < pr_index_enumerator (n + 1) m
[PROOF STEP]
proof (induct m)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. pr_index_enumerator n 0 < pr_index_enumerator (n + 1) 0
 2. \<And>m. pr_index_enumerator n m < pr_index_enumerator (n + 1) m \<Longrightarrow> pr_index_enumerator n (Suc m) < pr_index_enumerator (n + 1) (Suc m)
[PROOF STEP]
show "pr_index_enumerator n 0 < pr_index_enumerator (n + 1) 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pr_index_enumerator n 0 < pr_index_enumerator (n + 1) 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pr_index_enumerator n 0 < pr_index_enumerator (n + 1) 0

goal (1 subgoal):
 1. \<And>m. pr_index_enumerator n m < pr_index_enumerator (n + 1) m \<Longrightarrow> pr_index_enumerator n (Suc m) < pr_index_enumerator (n + 1) (Suc m)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. pr_index_enumerator n m < pr_index_enumerator (n + 1) m \<Longrightarrow> pr_index_enumerator n (Suc m) < pr_index_enumerator (n + 1) (Suc m)
[PROOF STEP]
fix na
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>m. pr_index_enumerator n m < pr_index_enumerator (n + 1) m \<Longrightarrow> pr_index_enumerator n (Suc m) < pr_index_enumerator (n + 1) (Suc m)
[PROOF STEP]
assume A: "pr_index_enumerator n na < pr_index_enumerator (n + 1) na"
[PROOF STATE]
proof (state)
this:
pr_index_enumerator n na < pr_index_enumerator (n + 1) na

goal (1 subgoal):
 1. \<And>m. pr_index_enumerator n m < pr_index_enumerator (n + 1) m \<Longrightarrow> pr_index_enumerator n (Suc m) < pr_index_enumerator (n + 1) (Suc m)
[PROOF STEP]
show "pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
let ?a = "pr_index_enumerator n na"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
let ?b = "pr_index_enumerator (n+1) na"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
have S1: "pr_index_enumerator n (Suc na) = comp_by_index index_of_id ?a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) = comp_by_index index_of_id (pr_index_enumerator n na)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pr_index_enumerator n (Suc na) = comp_by_index index_of_id (pr_index_enumerator n na)

goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
have L1: "pr_index_enumerator (n+1) (Suc na) = comp_by_index index_of_id ?b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. pr_index_enumerator (n + 1) (Suc na) = comp_by_index index_of_id (pr_index_enumerator (n + 1) na)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
pr_index_enumerator (n + 1) (Suc na) = comp_by_index index_of_id (pr_index_enumerator (n + 1) na)

goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
from A
[PROOF STATE]
proof (chain)
picking this:
pr_index_enumerator n na < pr_index_enumerator (n + 1) na
[PROOF STEP]
have "c_pair index_of_id ?a < c_pair index_of_id ?b"
[PROOF STATE]
proof (prove)
using this:
pr_index_enumerator n na < pr_index_enumerator (n + 1) na

goal (1 subgoal):
 1. c_pair index_of_id (pr_index_enumerator n na) < c_pair index_of_id (pr_index_enumerator (n + 1) na)
[PROOF STEP]
by (rule c_pair_strict_mono2)
[PROOF STATE]
proof (state)
this:
c_pair index_of_id (pr_index_enumerator n na) < c_pair index_of_id (pr_index_enumerator (n + 1) na)

goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_pair index_of_id (pr_index_enumerator n na) < c_pair index_of_id (pr_index_enumerator (n + 1) na)
[PROOF STEP]
have "c_pair 4 (c_pair index_of_id ?a) < c_pair 4 (c_pair index_of_id ?b)"
[PROOF STATE]
proof (prove)
using this:
c_pair index_of_id (pr_index_enumerator n na) < c_pair index_of_id (pr_index_enumerator (n + 1) na)

goal (1 subgoal):
 1. c_pair 4 (c_pair index_of_id (pr_index_enumerator n na)) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))
[PROOF STEP]
by (rule c_pair_strict_mono2)
[PROOF STATE]
proof (state)
this:
c_pair 4 (c_pair index_of_id (pr_index_enumerator n na)) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))

goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_pair 4 (c_pair index_of_id (pr_index_enumerator n na)) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))
[PROOF STEP]
have "comp_by_index index_of_id ?a < c_pair 4 (c_pair index_of_id ?b)"
[PROOF STATE]
proof (prove)
using this:
c_pair 4 (c_pair index_of_id (pr_index_enumerator n na)) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))

goal (1 subgoal):
 1. comp_by_index index_of_id (pr_index_enumerator n na) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))
[PROOF STEP]
by (simp add: comp_by_index_def)
[PROOF STATE]
proof (state)
this:
comp_by_index index_of_id (pr_index_enumerator n na) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))

goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
comp_by_index index_of_id (pr_index_enumerator n na) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))
[PROOF STEP]
have "comp_by_index index_of_id ?a < comp_by_index index_of_id ?b"
[PROOF STATE]
proof (prove)
using this:
comp_by_index index_of_id (pr_index_enumerator n na) < c_pair 4 (c_pair index_of_id (pr_index_enumerator (n + 1) na))

goal (1 subgoal):
 1. comp_by_index index_of_id (pr_index_enumerator n na) < comp_by_index index_of_id (pr_index_enumerator (n + 1) na)
[PROOF STEP]
by (simp add: comp_by_index_def)
[PROOF STATE]
proof (state)
this:
comp_by_index index_of_id (pr_index_enumerator n na) < comp_by_index index_of_id (pr_index_enumerator (n + 1) na)

goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
with S1 L1
[PROOF STATE]
proof (chain)
picking this:
pr_index_enumerator n (Suc na) = comp_by_index index_of_id (pr_index_enumerator n na)
pr_index_enumerator (n + 1) (Suc na) = comp_by_index index_of_id (pr_index_enumerator (n + 1) na)
comp_by_index index_of_id (pr_index_enumerator n na) < comp_by_index index_of_id (pr_index_enumerator (n + 1) na)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
pr_index_enumerator n (Suc na) = comp_by_index index_of_id (pr_index_enumerator n na)
pr_index_enumerator (n + 1) (Suc na) = comp_by_index index_of_id (pr_index_enumerator (n + 1) na)
comp_by_index index_of_id (pr_index_enumerator n na) < comp_by_index index_of_id (pr_index_enumerator (n + 1) na)

goal (1 subgoal):
 1. pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
pr_index_enumerator n (Suc na) < pr_index_enumerator (n + 1) (Suc na)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma triangle_num_less_iff: "triangle_num m < triangle_num n \<longleftrightarrow> m < n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (triangle_num m < triangle_num n) = (m < n)
[PROOF STEP]
using strict_mono_less[OF strict_mono_triangle_num]
[PROOF STATE]
proof (prove)
using this:
(triangle_num ?x < triangle_num ?y) = (?x < ?y)

goal (1 subgoal):
 1. (triangle_num m < triangle_num n) = (m < n)
[PROOF STEP]
.


[STATEMENT]
lemma set_of_vector_cart_basis':
  shows "(set_of_vector cart_basis') = {axis i 1 :: 'a::{field}^'n | i. i \<in> (UNIV :: 'n set)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set_of_vector cart_basis' = {axis i (1::'a) |i. i \<in> UNIV}
[PROOF STEP]
unfolding set_of_vector_def cart_basis'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {(\<chi>i. axis i (1::'a)) $ i |i. i \<in> UNIV} = {axis i (1::'a) |i. i \<in> UNIV}
[PROOF STEP]
by auto


[STATEMENT]
lemma Suc_0_mod_card [simp]: "Suc 0 mod CARD('a::nontriv) = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 mod CARD('a) = 1
[PROOF STEP]
using one_mod_card
[PROOF STATE]
proof (prove)
using this:
1 mod CARD(?'a) = 1

goal (1 subgoal):
 1. Suc 0 mod CARD('a) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma prime_elem_multiplicity_prod_distrib:
  assumes "prime_elem p" "0 \<notin> f ` A" "finite A"
  shows   "multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
have "multiplicity p (prod f A) = (\<Sum>x\<in>#mset_set A. multiplicity p (f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>#mset_set A. multiplicity p (f x))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
prime_elem p
(0::'a) \<notin> f ` A
finite A

goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>#mset_set A. multiplicity p (f x))
[PROOF STEP]
by (subst prod_unfold_prod_mset)
                   (simp_all add: prime_elem_multiplicity_prod_mset_distrib sum_unfold_sum_mset
                      multiset.map_comp o_def)
[PROOF STATE]
proof (state)
this:
multiplicity p (prod f A) = (\<Sum>x\<in>#mset_set A. multiplicity p (f x))

goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
multiplicity p (prod f A) = (\<Sum>x\<in>#mset_set A. multiplicity p (f x))

goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
from \<open>finite A\<close>
[PROOF STATE]
proof (chain)
picking this:
finite A
[PROOF STEP]
have "\<dots> = (\<Sum>x\<in>A. multiplicity p (f x))"
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. (\<Sum>x\<in>#mset_set A. multiplicity p (f x)) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
by (induction A rule: finite_induct) simp_all
[PROOF STATE]
proof (state)
this:
(\<Sum>x\<in>#mset_set A. multiplicity p (f x)) = (\<Sum>x\<in>A. multiplicity p (f x))

goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))

goal (1 subgoal):
 1. multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
multiplicity p (prod f A) = (\<Sum>x\<in>A. multiplicity p (f x))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma degree_m_mult_le:
  assumes eq: "f =m g * h"
  shows "degree_m f \<le> degree_m g + degree_m h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
have "degree_m f = degree_m (Mp g * Mp h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree_m f = degree_m (Mp g * Mp h)
[PROOF STEP]
using eq
[PROOF STATE]
proof (prove)
using this:
f =m g * h

goal (1 subgoal):
 1. degree_m f = degree_m (Mp g * Mp h)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
degree_m f = degree_m (Mp g * Mp h)

goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree_m f = degree_m (Mp g * Mp h)

goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
have "\<dots> \<le> degree (Mp g * Mp h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree_m (Mp g * Mp h) \<le> degree (Mp g * Mp h)
[PROOF STEP]
by (rule degree_m_le)
[PROOF STATE]
proof (state)
this:
degree_m (Mp g * Mp h) \<le> degree (Mp g * Mp h)

goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
degree_m (Mp g * Mp h) \<le> degree (Mp g * Mp h)

goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
have "\<dots> \<le> degree_m g + degree_m h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. degree (Mp g * Mp h) \<le> degree_m g + degree_m h
[PROOF STEP]
by (rule degree_mult_le)
[PROOF STATE]
proof (state)
this:
degree (Mp g * Mp h) \<le> degree_m g + degree_m h

goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree_m f \<le> degree_m g + degree_m h

goal (1 subgoal):
 1. degree_m f \<le> degree_m g + degree_m h
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
degree_m f \<le> degree_m g + degree_m h

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
theorem (in group) "x * 1 = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "x * 1 = x * (inverse x * x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (1::'a) = x * (inverse x * x)
[PROOF STEP]
by (simp only: group_left_inverse)
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x * (inverse x * x)

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
note calculation = this
    \<comment> \<open>first calculational step: init calculation register\<close>
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x * (inverse x * x)

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "\<dots> = x * inverse x * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * (inverse x * x) = x * inverse x * x
[PROOF STEP]
by (simp only: group_assoc)
[PROOF STATE]
proof (state)
this:
x * (inverse x * x) = x * inverse x * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
note calculation = trans [OF calculation this]
    \<comment> \<open>general calculational step: compose with transitivity rule\<close>
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x * inverse x * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "\<dots> = 1 * x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x * inverse x * x = (1::'a) * x
[PROOF STEP]
by (simp only: group_right_inverse)
[PROOF STATE]
proof (state)
this:
x * inverse x * x = (1::'a) * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
note calculation = trans [OF calculation this]
    \<comment> \<open>general calculational step: compose with transitivity rule\<close>
[PROOF STATE]
proof (state)
this:
x * (1::'a) = (1::'a) * x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
have "\<dots> = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (1::'a) * x = x
[PROOF STEP]
by (simp only: group_left_one)
[PROOF STATE]
proof (state)
this:
(1::'a) * x = x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
note calculation = trans [OF calculation this]
    \<comment> \<open>final calculational step: compose with transitivity rule \dots\<close>
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
from calculation
    \<comment> \<open>\dots\ and pick up the final result\<close>
[PROOF STATE]
proof (chain)
picking this:
x * (1::'a) = x
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x * (1::'a) = x

goal (1 subgoal):
 1. x * (1::'a) = x
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
x * (1::'a) = x

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma deg_pm_minus:
  assumes "s adds (t::_ \<Rightarrow>\<^sub>0 _::comm_monoid_add)"
  shows "deg_pm (t - s) = deg_pm t - deg_pm s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_pm (t - s) = deg_pm t - deg_pm s
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. deg_pm (t - s) = deg_pm t - deg_pm s
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
s adds t
[PROOF STEP]
have "(t - s) + s = t"
[PROOF STATE]
proof (prove)
using this:
s adds t

goal (1 subgoal):
 1. t - s + s = t
[PROOF STEP]
by (rule adds_minus)
[PROOF STATE]
proof (state)
this:
t - s + s = t

goal (1 subgoal):
 1. deg_pm (t - s) = deg_pm t - deg_pm s
[PROOF STEP]
hence "deg_pm t = deg_pm ((t - s) + s)"
[PROOF STATE]
proof (prove)
using this:
t - s + s = t

goal (1 subgoal):
 1. deg_pm t = deg_pm (t - s + s)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
deg_pm t = deg_pm (t - s + s)

goal (1 subgoal):
 1. deg_pm (t - s) = deg_pm t - deg_pm s
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
deg_pm t = deg_pm (t - s + s)

goal (1 subgoal):
 1. deg_pm (t - s) = deg_pm t - deg_pm s
[PROOF STEP]
have "\<dots> = deg_pm (t - s) + deg_pm s"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deg_pm (t - s + s) = deg_pm (t - s) + deg_pm s
[PROOF STEP]
by (simp only: deg_pm_plus)
[PROOF STATE]
proof (state)
this:
deg_pm (t - s + s) = deg_pm (t - s) + deg_pm s

goal (1 subgoal):
 1. deg_pm (t - s) = deg_pm t - deg_pm s
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
deg_pm t = deg_pm (t - s) + deg_pm s
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deg_pm t = deg_pm (t - s) + deg_pm s

goal (1 subgoal):
 1. deg_pm (t - s) = deg_pm t - deg_pm s
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
deg_pm (t - s) = deg_pm t - deg_pm s

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma check_all_const_deg_prop:
  shows "check_all_const_deg l = True \<longleftrightarrow> (\<forall>p \<in> set(l). degree p = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0)
[PROOF STEP]
proof (induct l)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (check_all_const_deg [] = True) = (\<forall>p\<in>set []. degree p = 0)
 2. \<And>a l. (check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0) \<Longrightarrow> (check_all_const_deg (a # l) = True) = (\<forall>p\<in>set (a # l). degree p = 0)
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. (check_all_const_deg [] = True) = (\<forall>p\<in>set []. degree p = 0)
 2. \<And>a l. (check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0) \<Longrightarrow> (check_all_const_deg (a # l) = True) = (\<forall>p\<in>set (a # l). degree p = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (check_all_const_deg [] = True) = (\<forall>p\<in>set []. degree p = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(check_all_const_deg [] = True) = (\<forall>p\<in>set []. degree p = 0)

goal (1 subgoal):
 1. \<And>a l. (check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0) \<Longrightarrow> (check_all_const_deg (a # l) = True) = (\<forall>p\<in>set (a # l). degree p = 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a l. (check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0) \<Longrightarrow> (check_all_const_deg (a # l) = True) = (\<forall>p\<in>set (a # l). degree p = 0)
[PROOF STEP]
case (Cons a l)
[PROOF STATE]
proof (state)
this:
(check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0)

goal (1 subgoal):
 1. \<And>a l. (check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0) \<Longrightarrow> (check_all_const_deg (a # l) = True) = (\<forall>p\<in>set (a # l). degree p = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
(check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
(check_all_const_deg l = True) = (\<forall>p\<in>set l. degree p = 0)

goal (1 subgoal):
 1. (check_all_const_deg (a # l) = True) = (\<forall>p\<in>set (a # l). degree p = 0)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(check_all_const_deg (a # l) = True) = (\<forall>p\<in>set (a # l). degree p = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma pderiv_eq_0_iff: "pderiv p = 0 \<longleftrightarrow> degree p = 0"
  for p :: "'a::{comm_semiring_1,semiring_no_zero_divisors,semiring_char_0} poly"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
proof (cases "degree p")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. degree p = 0 \<Longrightarrow> (pderiv p = 0) = (degree p = 0)
 2. \<And>nat. degree p = Suc nat \<Longrightarrow> (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
degree p = 0

goal (2 subgoals):
 1. degree p = 0 \<Longrightarrow> (pderiv p = 0) = (degree p = 0)
 2. \<And>nat. degree p = Suc nat \<Longrightarrow> (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree p = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree p = 0

goal (1 subgoal):
 1. (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
by (metis degree_eq_zeroE pderiv.simps)
[PROOF STATE]
proof (state)
this:
(pderiv p = 0) = (degree p = 0)

goal (1 subgoal):
 1. \<And>nat. degree p = Suc nat \<Longrightarrow> (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>nat. degree p = Suc nat \<Longrightarrow> (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
degree p = Suc n

goal (1 subgoal):
 1. \<And>nat. degree p = Suc nat \<Longrightarrow> (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
degree p = Suc n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
degree p = Suc n

goal (1 subgoal):
 1. (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
using coeff_0 coeff_pderiv degree_0 leading_coeff_0_iff mult_eq_0_iff nat.distinct(1) of_nat_eq_0_iff
[PROOF STATE]
proof (prove)
using this:
degree p = Suc n
coeff 0 ?n = (0::?'a)
coeff (pderiv ?p) ?n = of_nat (Suc ?n) * coeff ?p (Suc ?n)
degree 0 = 0
(lead_coeff ?p = (0::?'a)) = (?p = 0)
(?a * ?b = (0::?'a)) = (?a = (0::?'a) \<or> ?b = (0::?'a))
0 \<noteq> Suc ?x2.0
(of_nat ?m = (0::?'a)) = (?m = 0)

goal (1 subgoal):
 1. (pderiv p = 0) = (degree p = 0)
[PROOF STEP]
by (metis coeff_0 coeff_pderiv degree_0 leading_coeff_0_iff mult_eq_0_iff nat.distinct(1) of_nat_eq_0_iff)
[PROOF STATE]
proof (state)
this:
(pderiv p = 0) = (degree p = 0)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Polygamma_approx_1_complex:
  "Re x > 0 \<Longrightarrow>
     Polygamma_approx (Suc 0) m x = ln x - 1 / (2*x) + stirling_sum (Suc 0) m x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re x \<Longrightarrow> Polygamma_approx (Suc 0) m x = Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x
[PROOF STEP]
unfolding Polygamma_approx_Suc Polygamma_approx_0
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < Re x \<Longrightarrow> deriv (\<lambda>x. (x - 1 / 2) * Ln x - x + complex_of_real (ln (2 * pi)) / 2 + stirling_sum 0 m x) x = Ln x - 1 / (2 * x) + stirling_sum (Suc 0) m x
[PROOF STEP]
by (intro DERIV_imp_deriv)
     (auto intro!: derivative_eq_intros elim!: nonpos_Reals_cases simp: field_simps)


[STATEMENT]
lemma arith_modZero2:
  "Suc (n + (t + n * t)) mod Suc n = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc (n + (t + n * t)) mod Suc n = 0
[PROOF STEP]
by (metis add_Suc_right add_Suc_shift mod_mult_self1_is_0 mult_Suc mult.commute)


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


[STATEMENT]
lemma pi_not_less_zero [simp]: "\<not> pi < 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> pi < 0
[PROOF STEP]
by (simp add: linorder_not_less)


[STATEMENT]
lemma list_of_set [simp] :
  assumes fin_s: "finite s"
  shows "set (list_of_set s) = s"
        "distinct (list_of_set s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (list_of_set s) = s &&& distinct (list_of_set s)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. set (list_of_set s) = s
 2. distinct (list_of_set s)
[PROOF STEP]
from fin_s list_of_set_set_is_empty[of s]
[PROOF STATE]
proof (chain)
picking this:
finite s
(list_of_set_set s = {}) = infinite s
[PROOF STEP]
have "\<not> (list_of_set_set s = {})"
[PROOF STATE]
proof (prove)
using this:
finite s
(list_of_set_set s = {}) = infinite s

goal (1 subgoal):
 1. list_of_set_set s \<noteq> {}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
list_of_set_set s \<noteq> {}

goal (2 subgoals):
 1. set (list_of_set s) = s
 2. distinct (list_of_set s)
[PROOF STEP]
hence "list_of_set s \<in> list_of_set_set s"
[PROOF STATE]
proof (prove)
using this:
list_of_set_set s \<noteq> {}

goal (1 subgoal):
 1. list_of_set s \<in> list_of_set_set s
[PROOF STEP]
unfolding list_of_set_def
[PROOF STATE]
proof (prove)
using this:
list_of_set_set s \<noteq> {}

goal (1 subgoal):
 1. set_choose (list_of_set_set s) \<in> list_of_set_set s
[PROOF STEP]
by (rule set_choose_thm)
[PROOF STATE]
proof (state)
this:
list_of_set s \<in> list_of_set_set s

goal (2 subgoals):
 1. set (list_of_set s) = s
 2. distinct (list_of_set s)
[PROOF STEP]
thus "set (list_of_set s) = s"
       "distinct (list_of_set s)"
[PROOF STATE]
proof (prove)
using this:
list_of_set s \<in> list_of_set_set s

goal (1 subgoal):
 1. set (list_of_set s) = s &&& distinct (list_of_set s)
[PROOF STEP]
unfolding list_of_set_set_def
[PROOF STATE]
proof (prove)
using this:
list_of_set s \<in> {l. set l = s \<and> distinct l}

goal (1 subgoal):
 1. set (list_of_set s) = s &&& distinct (list_of_set s)
[PROOF STEP]
by simp_all
[PROOF STATE]
proof (state)
this:
set (list_of_set s) = s
distinct (list_of_set s)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma one_element_vec_dotP:
  assumes "dim_vec x = n"
  shows "(one_element_vec n e) \<bullet> x = (\<Sum>i\<in>{0 ..< dim_vec x}. e * x $ i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. one_element_vec n e \<bullet> x = (\<Sum>i = 0..<dim_vec x. e * x $ i)
[PROOF STEP]
by (metis (no_types, lifting) assms one_element_vec_access scalar_prod_def sum.ivl_cong)


[STATEMENT]
theorem p33: "(\<forall>x. p(a) \<and> (p(x) \<longrightarrow> p(b)) \<longrightarrow> p(c)) \<longleftrightarrow>
  (\<forall>x. (\<not>p(a) \<or> p(x) \<or> p(c)) \<and> (\<not>p(a) \<or> \<not>p(b) \<or> p(c)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<forall>x. p a \<and> (p x \<longrightarrow> p b) \<longrightarrow> p c) = (\<forall>x. (\<not> p a \<or> p x \<or> p c) \<and> (\<not> p a \<or> \<not> p b \<or> p c))
[PROOF STEP]
by auto2


[STATEMENT]
lemma (in group) FactGroup_order:
  assumes "subgroup H G" "finite H"
  shows "order G = order (G Mod H) * card H"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. order G = order (G Mod H) * card H
[PROOF STEP]
using lagrange assms
[PROOF STATE]
proof (prove)
using this:
subgroup ?H G \<Longrightarrow> card (rcosets ?H) * card ?H = order G
subgroup H G
finite H

goal (1 subgoal):
 1. order G = order (G Mod H) * card H
[PROOF STEP]
unfolding FactGroup_def order_def
[PROOF STATE]
proof (prove)
using this:
subgroup ?H G \<Longrightarrow> card (rcosets ?H) * card ?H = card (carrier G)
subgroup H G
finite H

goal (1 subgoal):
 1. card (carrier G) = card (carrier \<lparr>carrier = rcosets H, monoid.mult = (<#>), one = H\<rparr>) * card H
[PROOF STEP]
by simp


[STATEMENT]
lemma fold_random_permutation_foldl:
  assumes "finite A"
  shows   "fold_random_permutation f x A =
             map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A

goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
proof (induction f x A rule: fold_random_permutation.induct [case_names empty infinite remove])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
 3. \<And>A f x. \<lbrakk>finite A; A \<noteq> {}; \<And>xa. \<lbrakk>xa \<in> set_pmf (pmf_of_set A); finite (A - {xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f xa x) (A - {xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f xa x)) (pmf_of_set (permutations_of_set (A - {xa}))); finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
case (remove A f x)
[PROOF STATE]
proof (state)
this:
finite A
A \<noteq> {}
\<lbrakk>?xa \<in> set_pmf (pmf_of_set A); finite (A - {?xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f ?xa x) (A - {?xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f ?xa x)) (pmf_of_set (permutations_of_set (A - {?xa})))
finite A

goal (3 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
 3. \<And>A f x. \<lbrakk>finite A; A \<noteq> {}; \<And>xa. \<lbrakk>xa \<in> set_pmf (pmf_of_set A); finite (A - {xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f xa x) (A - {xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f xa x)) (pmf_of_set (permutations_of_set (A - {xa}))); finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
from remove
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
\<lbrakk>?xa \<in> set_pmf (pmf_of_set A); finite (A - {?xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f ?xa x) (A - {?xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f ?xa x)) (pmf_of_set (permutations_of_set (A - {?xa})))
finite A
[PROOF STEP]
have "fold_random_permutation f x A =
            pmf_of_set A \<bind> (\<lambda>a. fold_random_permutation f (f a x) (A - {a}))"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
\<lbrakk>?xa \<in> set_pmf (pmf_of_set A); finite (A - {?xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f ?xa x) (A - {?xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f ?xa x)) (pmf_of_set (permutations_of_set (A - {?xa})))
finite A

goal (1 subgoal):
 1. fold_random_permutation f x A = pmf_of_set A \<bind> (\<lambda>a. fold_random_permutation f (f a x) (A - {a}))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
fold_random_permutation f x A = pmf_of_set A \<bind> (\<lambda>a. fold_random_permutation f (f a x) (A - {a}))

goal (3 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
 3. \<And>A f x. \<lbrakk>finite A; A \<noteq> {}; \<And>xa. \<lbrakk>xa \<in> set_pmf (pmf_of_set A); finite (A - {xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f xa x) (A - {xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f xa x)) (pmf_of_set (permutations_of_set (A - {xa}))); finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
fold_random_permutation f x A = pmf_of_set A \<bind> (\<lambda>a. fold_random_permutation f (f a x) (A - {a}))

goal (3 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
 3. \<And>A f x. \<lbrakk>finite A; A \<noteq> {}; \<And>xa. \<lbrakk>xa \<in> set_pmf (pmf_of_set A); finite (A - {xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f xa x) (A - {xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f xa x)) (pmf_of_set (permutations_of_set (A - {xa}))); finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
from remove
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
\<lbrakk>?xa \<in> set_pmf (pmf_of_set A); finite (A - {?xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f ?xa x) (A - {?xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f ?xa x)) (pmf_of_set (permutations_of_set (A - {?xa})))
finite A
[PROOF STEP]
have "\<dots> = pmf_of_set A \<bind> (\<lambda>a. map_pmf (foldl (\<lambda>x y. f y x) x)
                 (map_pmf ((#) a) (pmf_of_set (permutations_of_set (A - {a})))))"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
\<lbrakk>?xa \<in> set_pmf (pmf_of_set A); finite (A - {?xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f ?xa x) (A - {?xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f ?xa x)) (pmf_of_set (permutations_of_set (A - {?xa})))
finite A

goal (1 subgoal):
 1. pmf_of_set A \<bind> (\<lambda>a. fold_random_permutation f (f a x) (A - {a})) = pmf_of_set A \<bind> (\<lambda>a. map_pmf (foldl (\<lambda>x y. f y x) x) (map_pmf ((#) a) (pmf_of_set (permutations_of_set (A - {a})))))
[PROOF STEP]
by (intro bind_pmf_cong) (simp_all add: pmf.map_comp o_def)
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>a. fold_random_permutation f (f a x) (A - {a})) = pmf_of_set A \<bind> (\<lambda>a. map_pmf (foldl (\<lambda>x y. f y x) x) (map_pmf ((#) a) (pmf_of_set (permutations_of_set (A - {a})))))

goal (3 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
 3. \<And>A f x. \<lbrakk>finite A; A \<noteq> {}; \<And>xa. \<lbrakk>xa \<in> set_pmf (pmf_of_set A); finite (A - {xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f xa x) (A - {xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f xa x)) (pmf_of_set (permutations_of_set (A - {xa}))); finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>a. fold_random_permutation f (f a x) (A - {a})) = pmf_of_set A \<bind> (\<lambda>a. map_pmf (foldl (\<lambda>x y. f y x) x) (map_pmf ((#) a) (pmf_of_set (permutations_of_set (A - {a})))))

goal (3 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
 3. \<And>A f x. \<lbrakk>finite A; A \<noteq> {}; \<And>xa. \<lbrakk>xa \<in> set_pmf (pmf_of_set A); finite (A - {xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f xa x) (A - {xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f xa x)) (pmf_of_set (permutations_of_set (A - {xa}))); finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
from remove
[PROOF STATE]
proof (chain)
picking this:
finite A
A \<noteq> {}
\<lbrakk>?xa \<in> set_pmf (pmf_of_set A); finite (A - {?xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f ?xa x) (A - {?xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f ?xa x)) (pmf_of_set (permutations_of_set (A - {?xa})))
finite A
[PROOF STEP]
have "\<dots> = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))"
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
\<lbrakk>?xa \<in> set_pmf (pmf_of_set A); finite (A - {?xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f ?xa x) (A - {?xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f ?xa x)) (pmf_of_set (permutations_of_set (A - {?xa})))
finite A

goal (1 subgoal):
 1. pmf_of_set A \<bind> (\<lambda>a. map_pmf (foldl (\<lambda>x y. f y x) x) (map_pmf ((#) a) (pmf_of_set (permutations_of_set (A - {a}))))) = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
by (simp_all add: random_permutation_of_set map_bind_pmf map_pmf_def [symmetric])
[PROOF STATE]
proof (state)
this:
pmf_of_set A \<bind> (\<lambda>a. map_pmf (foldl (\<lambda>x y. f y x) x) (map_pmf ((#) a) (pmf_of_set (permutations_of_set (A - {a}))))) = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))

goal (3 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
 3. \<And>A f x. \<lbrakk>finite A; A \<noteq> {}; \<And>xa. \<lbrakk>xa \<in> set_pmf (pmf_of_set A); finite (A - {xa})\<rbrakk> \<Longrightarrow> fold_random_permutation f (f xa x) (A - {xa}) = map_pmf (foldl (\<lambda>x y. f y x) (f xa x)) (pmf_of_set (permutations_of_set (A - {xa}))); finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))

goal (1 subgoal):
 1. fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))

goal (2 subgoals):
 1. \<And>f x. finite {} \<Longrightarrow> fold_random_permutation f x {} = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set {}))
 2. \<And>A f x. \<lbrakk>infinite A; finite A\<rbrakk> \<Longrightarrow> fold_random_permutation f x A = map_pmf (foldl (\<lambda>x y. f y x) x) (pmf_of_set (permutations_of_set A))
[PROOF STEP]
qed (simp_all add: pmf_of_set_singleton)


[STATEMENT]
lemma set_of_subset_iff: "set_of X \<subseteq> set_of Y \<longleftrightarrow> lower Y \<le> lower X \<and> upper X \<le> upper Y"
  for X Y::"'a::linorder interval"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (set_of X \<subseteq> set_of Y) = (lower Y \<le> lower X \<and> upper X \<le> upper Y)
[PROOF STEP]
by (auto simp: set_of_eq subset_iff)


[STATEMENT]
lemma openin_prod_topology_alt:
     "openin (prod_topology X Y) S \<longleftrightarrow>
      (\<forall>x y. (x,y) \<in> S \<longrightarrow> (\<exists>U V. openin X U \<and> openin Y V \<and> x \<in> U \<and> y \<in> V \<and> U \<times> V \<subseteq> S))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. openin (prod_topology X Y) S = (\<forall>x y. (x, y) \<in> S \<longrightarrow> (\<exists>U V. openin X U \<and> openin Y V \<and> x \<in> U \<and> y \<in> V \<and> U \<times> V \<subseteq> S))
[PROOF STEP]
apply (auto simp: openin_prod_topology arbitrary_union_of_alt, fastforce)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. \<lbrakk>\<forall>x y. (x, y) \<in> S \<longrightarrow> (\<exists>U. openin X U \<and> (\<exists>V. openin Y V \<and> x \<in> U \<and> y \<in> V \<and> U \<times> V \<subseteq> S)); (a, b) \<in> S\<rbrakk> \<Longrightarrow> \<exists>U. (\<exists>S T. U = S \<times> T \<and> openin X S \<and> openin Y T) \<and> (a, b) \<in> U \<and> U \<subseteq> S
[PROOF STEP]
by (metis mem_Sigma_iff)


[STATEMENT]
lemma cos_x_y_le_one: "\<bar>x / sqrt (x\<^sup>2 + y\<^sup>2)\<bar> \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<bar>x / sqrt (x\<^sup>2 + y\<^sup>2)\<bar> \<le> 1
[PROOF STEP]
by (rule power2_le_imp_le [OF _ zero_le_one])
    (simp add: power_divide divide_le_eq not_sum_power2_lt_zero)


[STATEMENT]
lemma LIMSEQ_prod_nonneg:
  fixes f :: "nat \<Rightarrow> 'a::{linordered_semidom,linorder_topology}"
  assumes 0: "\<And>n. 0 \<le> f n" and a: "(\<lambda>n. prod f {..n}) \<longlonglongrightarrow> a"
  shows "a \<ge> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0::'a) \<le> a
[PROOF STEP]
by (simp add: "0" prod_nonneg LIMSEQ_le_const [OF a])


[STATEMENT]
lemma closure_eq_rel_interior_eq:
  fixes S1 S2 :: "'n::euclidean_space set"
  assumes "convex S1"
    and "convex S2"
  shows "closure S1 = closure S2 \<longleftrightarrow> rel_interior S1 = rel_interior S2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (closure S1 = closure S2) = (rel_interior S1 = rel_interior S2)
[PROOF STEP]
by (metis convex_rel_interior_closure convex_closure_rel_interior assms)


[STATEMENT]
lemma frontier_inside_subset:
    fixes S :: "'a::real_normed_vector set"
    assumes "closed S"
      shows "frontier(inside S) \<subseteq> S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
have "closure (inside S) \<inter> - inside S = closure (inside S) - interior (inside S)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (inside S) \<inter> - inside S = closure (inside S) - interior (inside S)
[PROOF STEP]
by (metis (no_types) Diff_Compl assms closure_closed interior_closure open_closed open_inside)
[PROOF STATE]
proof (state)
this:
closure (inside S) \<inter> - inside S = closure (inside S) - interior (inside S)

goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
closure (inside S) \<inter> - inside S = closure (inside S) - interior (inside S)

goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
have "- inside S \<inter> - outside S = S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - inside S \<inter> - outside S = S
[PROOF STEP]
by (metis (no_types) compl_sup double_compl inside_Un_outside)
[PROOF STATE]
proof (state)
this:
- inside S \<inter> - outside S = S

goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
- inside S \<inter> - outside S = S

goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
have "closure (inside S) \<subseteq> - outside S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure (inside S) \<subseteq> - outside S
[PROOF STEP]
by (metis (no_types) assms closure_inside_subset union_with_inside)
[PROOF STATE]
proof (state)
this:
closure (inside S) \<subseteq> - outside S

goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
closure (inside S) \<inter> - inside S = closure (inside S) - interior (inside S)
- inside S \<inter> - outside S = S
closure (inside S) \<subseteq> - outside S
[PROOF STEP]
have "closure (inside S) - interior (inside S) \<subseteq> S"
[PROOF STATE]
proof (prove)
using this:
closure (inside S) \<inter> - inside S = closure (inside S) - interior (inside S)
- inside S \<inter> - outside S = S
closure (inside S) \<subseteq> - outside S

goal (1 subgoal):
 1. closure (inside S) - interior (inside S) \<subseteq> S
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
closure (inside S) - interior (inside S) \<subseteq> S

goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
closure (inside S) - interior (inside S) \<subseteq> S
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
closure (inside S) - interior (inside S) \<subseteq> S

goal (1 subgoal):
 1. frontier (inside S) \<subseteq> S
[PROOF STEP]
by (simp add: frontier_def open_inside interior_open)
[PROOF STATE]
proof (state)
this:
frontier (inside S) \<subseteq> S

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma le_floor_add: "\<lfloor>x\<rfloor> + \<lfloor>y\<rfloor> \<le> \<lfloor>x + y\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lfloor>x\<rfloor> + \<lfloor>y\<rfloor> \<le> \<lfloor>x + y\<rfloor>
[PROOF STEP]
by (simp only: le_floor_iff of_int_add add_mono of_int_floor_le)


[STATEMENT]
lemma setPaireq: " {x, y} = {a, b} \<Longrightarrow> x = a \<and> y = b \<or> x = b \<and> y = a"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {x, y} = {a, b} \<Longrightarrow> x = a \<and> y = b \<or> x = b \<and> y = a
[PROOF STEP]
by (metis  doubleton_eq_iff)


[STATEMENT]
theorem has_absolute_integral_change_of_variables_compact:
  fixes f :: "real^'m::{finite,wellorder} \<Rightarrow> real^'n" and g :: "real^'m::_ \<Rightarrow> real^'m::_"
  assumes "compact S"
      and der_g: "\<And>x. x \<in> S \<Longrightarrow> (g has_derivative g' x) (at x within S)"
      and inj: "inj_on g S"
  shows "((\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f(g x)) absolutely_integrable_on S \<and>
             integral S (\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f(g x)) = b
      \<longleftrightarrow> f absolutely_integrable_on (g ` S) \<and> integral (g ` S) f = b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
obtain h where hg: "\<And>x. x \<in> S \<Longrightarrow> h(g x) = x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>h. (\<And>x. x \<in> S \<Longrightarrow> h (g x) = x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using inj
[PROOF STATE]
proof (prove)
using this:
inj_on g S

goal (1 subgoal):
 1. (\<And>h. (\<And>x. x \<in> S \<Longrightarrow> h (g x) = x) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (metis the_inv_into_f_f)
[PROOF STATE]
proof (state)
this:
?x \<in> S \<Longrightarrow> h (g ?x) = ?x

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
have conth: "continuous_on (g ` S) h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (g ` S) h
[PROOF STEP]
by (metis \<open>compact S\<close> continuous_on_inv der_g has_derivative_continuous_on hg)
[PROOF STATE]
proof (state)
this:
continuous_on (g ` S) h

goal (1 subgoal):
 1. ((\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)
[PROOF STEP]
by (rule has_absolute_integral_change_of_variables_invertible [OF der_g hg conth])
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) absolutely_integrable_on S \<and> integral S (\<lambda>x. \<bar>det (matrix (g' x))\<bar> *\<^sub>R f (g x)) = b) = (f absolutely_integrable_on g ` S \<and> integral (g ` S) f = b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma proj2_no_3_Col_span:
  assumes "proj2_no_3_Col S" and "p \<in> S"
  shows "span (proj2_rep ` (S - {p})) = UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. span (proj2_rep ` (S - {p})) = UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. span (proj2_rep ` (S - {p})) = UNIV
[PROOF STEP]
from \<open>proj2_no_3_Col S\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_no_3_Col S
[PROOF STEP]
have "card S = 4"
[PROOF STATE]
proof (prove)
using this:
proj2_no_3_Col S

goal (1 subgoal):
 1. card S = 4
[PROOF STEP]
unfolding proj2_no_3_Col_def
[PROOF STATE]
proof (prove)
using this:
card S = 4 \<and> (\<forall>p\<in>S. \<not> proj2_set_Col (S - {p}))

goal (1 subgoal):
 1. card S = 4
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
card S = 4

goal (1 subgoal):
 1. span (proj2_rep ` (S - {p})) = UNIV
[PROOF STEP]
with \<open>p \<in> S\<close> and \<open>card S = 4\<close> and card_gt_0_diff_singleton [of S p]
[PROOF STATE]
proof (chain)
picking this:
p \<in> S
card S = 4
\<lbrakk>0 < card S; p \<in> S\<rbrakk> \<Longrightarrow> card (S - {p}) = card S - 1
card S = 4
[PROOF STEP]
have "card (S - {p}) = 3"
[PROOF STATE]
proof (prove)
using this:
p \<in> S
card S = 4
\<lbrakk>0 < card S; p \<in> S\<rbrakk> \<Longrightarrow> card (S - {p}) = card S - 1
card S = 4

goal (1 subgoal):
 1. card (S - {p}) = 3
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
card (S - {p}) = 3

goal (1 subgoal):
 1. span (proj2_rep ` (S - {p})) = UNIV
[PROOF STEP]
from \<open>proj2_no_3_Col S\<close> and \<open>p \<in> S\<close>
[PROOF STATE]
proof (chain)
picking this:
proj2_no_3_Col S
p \<in> S
[PROOF STEP]
have "\<not> proj2_set_Col (S - {p})"
[PROOF STATE]
proof (prove)
using this:
proj2_no_3_Col S
p \<in> S

goal (1 subgoal):
 1. \<not> proj2_set_Col (S - {p})
[PROOF STEP]
unfolding proj2_no_3_Col_def
[PROOF STATE]
proof (prove)
using this:
card S = 4 \<and> (\<forall>p\<in>S. \<not> proj2_set_Col (S - {p}))
p \<in> S

goal (1 subgoal):
 1. \<not> proj2_set_Col (S - {p})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<not> proj2_set_Col (S - {p})

goal (1 subgoal):
 1. span (proj2_rep ` (S - {p})) = UNIV
[PROOF STEP]
with \<open>card (S - {p}) = 3\<close> and not_proj2_set_Col_iff_span
[PROOF STATE]
proof (chain)
picking this:
card (S - {p}) = 3
card ?S = 3 \<Longrightarrow> (\<not> proj2_set_Col ?S) = (span (proj2_rep ` ?S) = UNIV)
\<not> proj2_set_Col (S - {p})
[PROOF STEP]
show "span (proj2_rep ` (S - {p})) = UNIV"
[PROOF STATE]
proof (prove)
using this:
card (S - {p}) = 3
card ?S = 3 \<Longrightarrow> (\<not> proj2_set_Col ?S) = (span (proj2_rep ` ?S) = UNIV)
\<not> proj2_set_Col (S - {p})

goal (1 subgoal):
 1. span (proj2_rep ` (S - {p})) = UNIV
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
span (proj2_rep ` (S - {p})) = UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma integer_partitions_cardinality_aux:
  "card (integer_partitions n) = (\<Sum>k\<le>n. Partition n k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (integer_partitions n) = sum (Partition n) {..n}
[PROOF STEP]
using card_partitions_number_partition integer_partitions_number_partition_eq card_partitions
[PROOF STATE]
proof (prove)
using this:
card {p. p partitions ?n} = card {N. number_partition ?n N}
integer_partitions ?n = {N. number_partition ?n N}
card {p. p partitions ?n} = sum (Partition ?n) {..?n}

goal (1 subgoal):
 1. card (integer_partitions n) = sum (Partition n) {..n}
[PROOF STEP]
by simp


[STATEMENT]
lemma H_without_scalar_prod:
  "H = mat 2 2 (\<lambda>(i,j). if i\<noteq>j then 1/sqrt(2) else (if i=0 then 1/sqrt(2) else -(1/sqrt(2))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H = mat 2 2 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if i \<noteq> j then 1 / sqrt 2 else if i = 0 then 1 / sqrt 2 else - (1 / sqrt 2)))
[PROOF STEP]
using cong_mat
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>?nr = ?nr'; ?nc = ?nc'; \<And>i j. \<lbrakk>i < ?nr; j < ?nc\<rbrakk> \<Longrightarrow> ?f (i, j) = ?f' (i, j)\<rbrakk> \<Longrightarrow> mat ?nr ?nc ?f = mat ?nr' ?nc' ?f'

goal (1 subgoal):
 1. H = mat 2 2 (\<lambda>x. complex_of_real (case x of (i, j) \<Rightarrow> if i \<noteq> j then 1 / sqrt 2 else if i = 0 then 1 / sqrt 2 else - (1 / sqrt 2)))
[PROOF STEP]
by (auto simp: H_def)


[STATEMENT]
lemma has_integral_spike_set_eq:
  fixes f :: "'n::euclidean_space \<Rightarrow> 'a::banach"
  assumes "negligible {x \<in> S - T. f x \<noteq> 0}" "negligible {x \<in> T - S. f x \<noteq> 0}"
  shows "(f has_integral y) S \<longleftrightarrow> (f has_integral y) T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral y) S = (f has_integral y) T
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral y) S = (f has_integral y) T
[PROOF STEP]
have "((\<lambda>x. if x \<in> S then f x else 0) has_integral y) UNIV =
        ((\<lambda>x. if x \<in> T then f x else 0) has_integral y) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. if x \<in> S then f x else (0::'a)) has_integral y) UNIV = ((\<lambda>x. if x \<in> T then f x else (0::'a)) has_integral y) UNIV
[PROOF STEP]
proof (rule has_integral_spike_eq)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. negligible ?S
 2. \<And>x. x \<in> UNIV - ?S \<Longrightarrow> (if x \<in> T then f x else (0::'a)) = (if x \<in> S then f x else (0::'a))
[PROOF STEP]
show "negligible ({x \<in> S - T. f x \<noteq> 0} \<union> {x \<in> T - S. f x \<noteq> 0})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. negligible ({x \<in> S - T. f x \<noteq> (0::'a)} \<union> {x \<in> T - S. f x \<noteq> (0::'a)})
[PROOF STEP]
by (rule negligible_Un [OF assms])
[PROOF STATE]
proof (state)
this:
negligible ({x \<in> S - T. f x \<noteq> (0::'a)} \<union> {x \<in> T - S. f x \<noteq> (0::'a)})

goal (1 subgoal):
 1. \<And>x. x \<in> UNIV - ({x \<in> S - T. f x \<noteq> (0::'a)} \<union> {x \<in> T - S. f x \<noteq> (0::'a)}) \<Longrightarrow> (if x \<in> T then f x else (0::'a)) = (if x \<in> S then f x else (0::'a))
[PROOF STEP]
qed auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. if x \<in> S then f x else (0::'a)) has_integral y) UNIV = ((\<lambda>x. if x \<in> T then f x else (0::'a)) has_integral y) UNIV

goal (1 subgoal):
 1. (f has_integral y) S = (f has_integral y) T
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
((\<lambda>x. if x \<in> S then f x else (0::'a)) has_integral y) UNIV = ((\<lambda>x. if x \<in> T then f x else (0::'a)) has_integral y) UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
((\<lambda>x. if x \<in> S then f x else (0::'a)) has_integral y) UNIV = ((\<lambda>x. if x \<in> T then f x else (0::'a)) has_integral y) UNIV

goal (1 subgoal):
 1. (f has_integral y) S = (f has_integral y) T
[PROOF STEP]
by (simp add: has_integral_restrict_UNIV)
[PROOF STATE]
proof (state)
this:
(f has_integral y) S = (f has_integral y) T

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma (in comm_monoid) finprod_swap:
  assumes "finite A" "finite B" "\<And> a b. a \<in> A  \<Longrightarrow> b \<in> B \<Longrightarrow> g a b \<in> carrier G"
  shows "finprod G (\<lambda> (b,a). g a b) (B \<times> A) = finprod G (\<lambda> (a,b). g a b) (A \<times> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Otimes>(b, a)\<in>B \<times> A. g a b) = (\<Otimes>(a, b)\<in>A \<times> B. g a b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Otimes>(b, a)\<in>B \<times> A. g a b) = (\<Otimes>(a, b)\<in>A \<times> B. g a b)
[PROOF STEP]
have [simp]: "(\<lambda>(a, b). (b, a)) ` (A \<times> B) = B \<times> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>(a, b). (b, a)) ` (A \<times> B) = B \<times> A
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<lambda>(a, b). (b, a)) ` (A \<times> B) = B \<times> A

goal (1 subgoal):
 1. (\<Otimes>(b, a)\<in>B \<times> A. g a b) = (\<Otimes>(a, b)\<in>A \<times> B. g a b)
[PROOF STEP]
have [simp]: "(\<lambda> x. case case x of (a, b) \<Rightarrow> (b, a) of (a, b) \<Rightarrow> g b a) = (\<lambda> (a,b). g a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. case case x of (a, b) \<Rightarrow> (b, a) of (a, b) \<Rightarrow> g b a) = (\<lambda>(a, b). g a b)
[PROOF STEP]
by (intro ext, auto)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. case case x of (a, b) \<Rightarrow> (b, a) of (a, b) \<Rightarrow> g b a) = (\<lambda>(a, b). g a b)

goal (1 subgoal):
 1. (\<Otimes>(b, a)\<in>B \<times> A. g a b) = (\<Otimes>(a, b)\<in>A \<times> B. g a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Otimes>(b, a)\<in>B \<times> A. g a b) = (\<Otimes>(a, b)\<in>A \<times> B. g a b)
[PROOF STEP]
by (rule trans[OF trans[OF _ finprod_reindex[of "\<lambda> (a,b). g b a" "\<lambda> (a,b). (b,a)"]]],
    insert assms, auto simp: inj_on_def)
[PROOF STATE]
proof (state)
this:
(\<Otimes>(b, a)\<in>B \<times> A. g a b) = (\<Otimes>(a, b)\<in>A \<times> B. g a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma in_set_permutations:
  assumes "distinct xs"
  shows "ys \<in> set (permutations xs) \<longleftrightarrow> distinct ys \<and> set xs = set ys" (is "?L xs ys \<longleftrightarrow> ?R xs ys")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distinct xs

goal (1 subgoal):
 1. (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
proof (induct "length xs" arbitrary: xs ys)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>xs ys. \<lbrakk>0 = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
 2. \<And>x xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys); Suc x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:
0 = length xs
distinct xs

goal (2 subgoals):
 1. \<And>xs ys. \<lbrakk>0 = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
 2. \<And>x xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys); Suc x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
0 = length xs
distinct xs
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
0 = length xs
distinct xs

goal (1 subgoal):
 1. (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys); Suc x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys); Suc x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
case (Suc n)
[PROOF STATE]
proof (state)
this:
\<lbrakk>n = length ?xs; distinct ?xs\<rbrakk> \<Longrightarrow> (?ys \<in> set (permutations ?xs)) = (distinct ?ys \<and> set ?xs = set ?ys)
Suc n = length xs
distinct xs

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys); Suc x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>n = length ?xs; distinct ?xs\<rbrakk> \<Longrightarrow> (?ys \<in> set (permutations ?xs)) = (distinct ?ys \<and> set ?xs = set ?ys)
Suc n = length xs
distinct xs
[PROOF STEP]
have "xs \<noteq> []"
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>n = length ?xs; distinct ?xs\<rbrakk> \<Longrightarrow> (?ys \<in> set (permutations ?xs)) = (distinct ?ys \<and> set ?xs = set ?ys)
Suc n = length xs
distinct xs

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

goal (1 subgoal):
 1. \<And>x xs ys. \<lbrakk>\<And>xs ys. \<lbrakk>x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys); Suc x = length xs; distinct xs\<rbrakk> \<Longrightarrow> (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ys \<in> set (permutations xs) \<Longrightarrow> distinct ys \<and> set xs = set ys
 2. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
assume "?L xs ys"
[PROOF STATE]
proof (state)
this:
ys \<in> set (permutations xs)

goal (2 subgoals):
 1. ys \<in> set (permutations xs) \<Longrightarrow> distinct ys \<and> set xs = set ys
 2. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ys \<in> set (permutations xs)
[PROOF STEP]
obtain y ys' where "ys = y # ys'" "y \<in> set xs" "ys' \<in> set (permutations (remove1 (hd ys) xs))"
[PROOF STATE]
proof (prove)
using this:
ys \<in> set (permutations xs)

goal (1 subgoal):
 1. (\<And>y ys'. \<lbrakk>ys = y # ys'; y \<in> set xs; ys' \<in> set (permutations (remove1 (hd ys) xs))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using \<open>xs \<noteq> []\<close>
[PROOF STATE]
proof (prove)
using this:
ys \<in> set (permutations xs)
xs \<noteq> []

goal (1 subgoal):
 1. (\<And>y ys'. \<lbrakk>ys = y # ys'; y \<in> set xs; ys' \<in> set (permutations (remove1 (hd ys) xs))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (auto simp: permutations_not_nil)
[PROOF STATE]
proof (state)
this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))

goal (2 subgoals):
 1. ys \<in> set (permutations xs) \<Longrightarrow> distinct ys \<and> set xs = set ys
 2. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))

goal (2 subgoals):
 1. ys \<in> set (permutations xs) \<Longrightarrow> distinct ys \<and> set xs = set ys
 2. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))
[PROOF STEP]
have "?R (remove1 y xs) ys'"
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))

goal (1 subgoal):
 1. distinct ys' \<and> set (remove1 y xs) = set ys'
[PROOF STEP]
using Suc.prems Suc.hyps(2)
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))
distinct xs
Suc n = length xs

goal (1 subgoal):
 1. distinct ys' \<and> set (remove1 y xs) = set ys'
[PROOF STEP]
by (intro Suc.hyps(1)[THEN iffD1]) (auto simp: length_remove1)
[PROOF STATE]
proof (state)
this:
distinct ys' \<and> set (remove1 y xs) = set ys'

goal (2 subgoals):
 1. ys \<in> set (permutations xs) \<Longrightarrow> distinct ys \<and> set xs = set ys
 2. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))
distinct ys' \<and> set (remove1 y xs) = set ys'
[PROOF STEP]
show "?R xs ys"
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))
distinct ys' \<and> set (remove1 y xs) = set ys'

goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys
[PROOF STEP]
using Suc
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 (hd ys) xs))
distinct ys' \<and> set (remove1 y xs) = set ys'
\<lbrakk>n = length ?xs; distinct ?xs\<rbrakk> \<Longrightarrow> (?ys \<in> set (permutations ?xs)) = (distinct ?ys \<and> set ?xs = set ?ys)
Suc n = length xs
distinct xs

goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
distinct ys \<and> set xs = set ys

goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
assume "?R xs ys"
[PROOF STATE]
proof (state)
this:
distinct ys \<and> set xs = set ys

goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
with \<open>xs \<noteq> []\<close>
[PROOF STATE]
proof (chain)
picking this:
xs \<noteq> []
distinct ys \<and> set xs = set ys
[PROOF STEP]
obtain y ys' where "ys = y # ys'" "y \<in> set xs"
[PROOF STATE]
proof (prove)
using this:
xs \<noteq> []
distinct ys \<and> set xs = set ys

goal (1 subgoal):
 1. (\<And>y ys'. \<lbrakk>ys = y # ys'; y \<in> set xs\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (cases ys) auto
[PROOF STATE]
proof (state)
this:
ys = y # ys'
y \<in> set xs

goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
ys = y # ys'
y \<in> set xs

goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
ys = y # ys'
y \<in> set xs
[PROOF STEP]
have "ys' \<in> set (permutations (remove1 y xs))"
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs

goal (1 subgoal):
 1. ys' \<in> set (permutations (remove1 y xs))
[PROOF STEP]
using Suc \<open>?R xs ys\<close>
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs
\<lbrakk>n = length ?xs; distinct ?xs\<rbrakk> \<Longrightarrow> (?ys \<in> set (permutations ?xs)) = (distinct ?ys \<and> set ?xs = set ?ys)
Suc n = length xs
distinct xs
distinct ys \<and> set xs = set ys

goal (1 subgoal):
 1. ys' \<in> set (permutations (remove1 y xs))
[PROOF STEP]
by (intro Suc.hyps(1)[THEN iffD2]) (auto simp: length_remove1)
[PROOF STATE]
proof (state)
this:
ys' \<in> set (permutations (remove1 y xs))

goal (1 subgoal):
 1. distinct ys \<and> set xs = set ys \<Longrightarrow> ys \<in> set (permutations xs)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 y xs))
[PROOF STEP]
show "?L xs ys"
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 y xs))

goal (1 subgoal):
 1. ys \<in> set (permutations xs)
[PROOF STEP]
using \<open>xs \<noteq> []\<close>
[PROOF STATE]
proof (prove)
using this:
ys = y # ys'
y \<in> set xs
ys' \<in> set (permutations (remove1 y xs))
xs \<noteq> []

goal (1 subgoal):
 1. ys \<in> set (permutations xs)
[PROOF STEP]
by (auto simp: permutations_not_nil)
[PROOF STATE]
proof (state)
this:
ys \<in> set (permutations xs)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(ys \<in> set (permutations xs)) = (distinct ys \<and> set xs = set ys)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_minus_subset_fset:
  assumes "B |\<subseteq>| A"
  shows "card_fset (A - B) = card_fset A - card_fset B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card_fset (A - B) = card_fset A - card_fset B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
B |\<subseteq>| A

goal (1 subgoal):
 1. card_fset (A - B) = card_fset A - card_fset B
[PROOF STEP]
by (simp add: subset_fset card_fset card_Diff_subset)


[STATEMENT]
lemma real_sqrt_less_iff [simp]: "sqrt x < sqrt y \<longleftrightarrow> x < y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sqrt x < sqrt y) = (x < y)
[PROOF STEP]
unfolding sqrt_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (root 2 x < root 2 y) = (x < y)
[PROOF STEP]
by (rule real_root_less_iff [OF pos2])


[STATEMENT]
lemma one_minus_const_fps_X_neg_power':
  fixes c :: "'a :: field_char_0"
  assumes "n > 0"
  shows "inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat ((n + k - 1) choose k) * c^k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)
[PROOF STEP]
have \<section>: "\<And>j. Abs_fps (\<lambda>na. (- c) ^ na * fps_binomial (- of_nat n) $ na) $ j =
          Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k) $ j"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>j. Abs_fps (\<lambda>na. (- c) ^ na * fps_binomial (- of_nat n) $ na) $ j = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k) $ j
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
0 < n

goal (1 subgoal):
 1. \<And>j. Abs_fps (\<lambda>na. (- c) ^ na * fps_binomial (- of_nat n) $ na) $ j = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k) $ j
[PROOF STEP]
by (simp add: gbinomial_minus binomial_gbinomial of_nat_diff flip: power_mult_distrib mult.assoc)
[PROOF STATE]
proof (state)
this:
Abs_fps (\<lambda>na. (- c) ^ na * fps_binomial (- of_nat n) $ na) $ ?j = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k) $ ?j

goal (1 subgoal):
 1. inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)
[PROOF STEP]
apply (rule fps_ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>na. inverse ((1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k) $ na
[PROOF STEP]
using \<section>
[PROOF STATE]
proof (prove)
using this:
Abs_fps (\<lambda>na. (- c) ^ na * fps_binomial (- of_nat n) $ na) $ ?j = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k) $ ?j

goal (1 subgoal):
 1. \<And>na. inverse ((1 - fps_const c * fps_X) ^ n) $ na = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k) $ na
[PROOF STEP]
by (metis (no_types, lifting) one_minus_fps_X_const_neg_power fps_const_neg fps_compose_linear fps_nth_Abs_fps)
[PROOF STATE]
proof (state)
this:
inverse ((1 - fps_const c * fps_X) ^ n) = Abs_fps (\<lambda>k. of_nat (n + k - 1 choose k) * c ^ k)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma card_bind_constant:
  assumes "finite S"
  assumes "\<forall>X \<in> S. finite (f X)"
  assumes "disjoint_family_on f S"
  assumes "\<And>x. x \<in> S \<Longrightarrow> card (f x) = k"
  shows "card (S \<bind> f) = card S * k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. card (S \<bind> f) = card S * k
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite S
\<forall>X\<in>S. finite (f X)
disjoint_family_on f S
?x \<in> S \<Longrightarrow> card (f ?x) = k

goal (1 subgoal):
 1. card (S \<bind> f) = card S * k
[PROOF STEP]
by (simp add: card_bind)


[STATEMENT]
lemma lead_coeff_map_poly_nz:
  assumes "f (lead_coeff p) \<noteq>0" "f 0=0"
  shows "lead_coeff (map_poly f p) = f (lead_coeff p) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (map_poly f p) = f (lead_coeff p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. lead_coeff (map_poly f p) = f (lead_coeff p)
[PROOF STEP]
have "lead_coeff (Poly (map f (coeffs p))) = f (lead_coeff p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lead_coeff (Poly (map f (coeffs p))) = f (lead_coeff p)
[PROOF STEP]
by (metis (mono_tags, lifting) antisym assms(1) assms(2) coeff_0_degree_minus_1 coeff_map_poly
        degree_Poly degree_eq_length_coeffs le_degree length_map map_poly_def)
[PROOF STATE]
proof (state)
this:
lead_coeff (Poly (map f (coeffs p))) = f (lead_coeff p)

goal (1 subgoal):
 1. lead_coeff (map_poly f p) = f (lead_coeff p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
lead_coeff (Poly (map f (coeffs p))) = f (lead_coeff p)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
lead_coeff (Poly (map f (coeffs p))) = f (lead_coeff p)

goal (1 subgoal):
 1. lead_coeff (map_poly f p) = f (lead_coeff p)
[PROOF STEP]
by (simp add: map_poly_def)
[PROOF STATE]
proof (state)
this:
lead_coeff (map_poly f p) = f (lead_coeff p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse_mat_base_case_2:
  shows "inverts_mat (mat_of_rows_list 2 [[1, 1], [1, -1]]::rat mat) (mat_of_rows_list 2 [[1/2, 1/2], [1/2, -(1/2)]]::rat mat) "
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverts_mat (mat_of_rows_list 2 [[1, 1], [1, - 1]]) (mat_of_rows_list 2 [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]])
[PROOF STEP]
unfolding inverts_mat_def mat_of_rows_list_def mat_eq_iff
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y) * mat (length [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]]) 2 (\<lambda>(i, y). [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]] ! i ! y)) = dim_row (1\<^sub>m (dim_row (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y)))) \<and> dim_col (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y) * mat (length [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]]) 2 (\<lambda>(i, y). [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]] ! i ! y)) = dim_col (1\<^sub>m (dim_row (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y)))) \<and> (\<forall>i j. i < dim_row (1\<^sub>m (dim_row (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y)))) \<longrightarrow> j < dim_col (1\<^sub>m (dim_row (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y)))) \<longrightarrow> (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y) * mat (length [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]]) 2 (\<lambda>(i, y). [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]] ! i ! y)) $$ (i, j) = 1\<^sub>m (dim_row (mat (length [[1, 1], [1, - 1]]) 2 (\<lambda>(i, y). [[1, 1], [1, - 1]] ! i ! y))) $$ (i, j))
[PROOF STEP]
apply auto
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. j < Suc (Suc 0) \<Longrightarrow> vec 2 ((!) ([[1, 1], [1, - 1]] ! j)) \<bullet> vec (Suc (Suc 0)) (\<lambda>i. [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]] ! i ! j) = 1
 2. \<And>i j. \<lbrakk>i < Suc (Suc 0); i \<noteq> j; j < Suc (Suc 0)\<rbrakk> \<Longrightarrow> vec 2 ((!) ([[1, 1], [1, - 1]] ! i)) \<bullet> vec (Suc (Suc 0)) (\<lambda>i. [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]] ! i ! j) = 0
[PROOF STEP]
unfolding less_two
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>j. j = 0 \<or> j = 1 \<Longrightarrow> vec 2 ((!) ([[1, 1], [1, - 1]] ! j)) \<bullet> vec (Suc (Suc 0)) (\<lambda>i. [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]] ! i ! j) = 1
 2. \<And>i j. \<lbrakk>i = 0 \<or> i = 1; i \<noteq> j; j = 0 \<or> j = 1\<rbrakk> \<Longrightarrow> vec 2 ((!) ([[1, 1], [1, - 1]] ! i)) \<bullet> vec (Suc (Suc 0)) (\<lambda>i. [[1 / 2, 1 / 2], [1 / 2, - (1 / 2)]] ! i ! j) = 0
[PROOF STEP]
by (auto simp add: scalar_prod_def)


[STATEMENT]
lemma de_morgans_2:
  "\<not>? (a \<and>? b) = (\<not>?a) \<or>? (\<not>?b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not>? a \<and>? b = (\<not>? a) \<or>? (\<not>? b)
[PROOF STEP]
by (metis de_morgans_1 maybe_double_negation)


[STATEMENT]
lemma dist_fs_finite:
  shows "dist_fs (of_complex z1) (of_complex z2) = 2 * cmod(z1 - z2) / (sqrt (1+(cmod z1)\<^sup>2) * sqrt (1+(cmod z2)\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dist_fs (of_complex z1) (of_complex z2) = 2 * cmod (z1 - z2) / (sqrt (1 + (cmod z1)\<^sup>2) * sqrt (1 + (cmod z2)\<^sup>2))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z1 z2. dist_fs_hcoords (of_complex_hcoords z1) (of_complex_hcoords z2) = 2 * cmod (z1 - z2) / (sqrt (1 + (cmod z1)\<^sup>2) * sqrt (1 + (cmod z2)\<^sup>2))
[PROOF STEP]
apply transfer
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z1 z2. dist_fs_cvec (of_complex_cvec z1) (of_complex_cvec z2) = 2 * cmod (z1 - z2) / (sqrt (1 + (cmod z1)\<^sup>2) * sqrt (1 + (cmod z2)\<^sup>2))
[PROOF STEP]
apply (subst cmod_square)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z1 z2. dist_fs_cvec (of_complex_cvec z1) (of_complex_cvec z2) = 2 * cmod (z1 - z2) / (sqrt (1 + Re (z1 * cnj z1)) * sqrt (1 + Re (z2 * cnj z2)))
[PROOF STEP]
apply (simp add: real_sqrt_divide cmod_def power2_eq_square)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z1 z2. 2 * sqrt ((Re z1 - Re z2) * (Re z1 - Re z2) - (Im z1 - Im z2) * (Im z2 - Im z1)) / sqrt ((Re z1 * Re z1 + Im z1 * Im z1 + 1) * (Re z2 * Re z2 + Im z2 * Im z2 + 1)) = 2 * sqrt ((Re z1 - Re z2) * (Re z1 - Re z2) + (Im z1 - Im z2) * (Im z1 - Im z2)) / (sqrt (1 + (Re z1 * Re z1 + Im z1 * Im z1)) * sqrt (1 + (Re z2 * Re z2 + Im z2 * Im z2)))
[PROOF STEP]
apply (subst real_sqrt_mult[symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>z1 z2. 2 * sqrt ((Re z1 - Re z2) * (Re z1 - Re z2) - (Im z1 - Im z2) * (Im z2 - Im z1)) / sqrt ((Re z1 * Re z1 + Im z1 * Im z1 + 1) * (Re z2 * Re z2 + Im z2 * Im z2 + 1)) = 2 * sqrt ((Re z1 - Re z2) * (Re z1 - Re z2) + (Im z1 - Im z2) * (Im z1 - Im z2)) / sqrt ((1 + (Re z1 * Re z1 + Im z1 * Im z1)) * (1 + (Re z2 * Re z2 + Im z2 * Im z2)))
[PROOF STEP]
apply (simp add: field_simps)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma invertible_matrix_mult_left_rank:
  fixes A::"'a::{field}^'n::{mod_type}^'m::{mod_type}"
  and P::"'a::{field}^'m::{mod_type}^'m::{mod_type}"
  assumes invertible_P: "invertible P"
  shows "rank (P**A) = rank A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
define TP where "TP = (\<lambda>x. P *v x)"
[PROOF STATE]
proof (state)
this:
TP = (*v) P

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
define TA where "TA = (\<lambda>x. A *v x)"
[PROOF STATE]
proof (state)
this:
TA = (*v) A

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
define TPA where "TPA = (\<lambda>x. (P**A) *v x)"
[PROOF STATE]
proof (state)
this:
TPA = (*v) (P ** A)

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
have sub: "vec.subspace (range ((*v) A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.subspace (range ((*v) A))
[PROOF STEP]
by (metis vec.subspace_UNIV vec.subspace_image)
[PROOF STATE]
proof (state)
this:
vec.subspace (range ((*v) A))

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
have "vec.dim (range TPA) = vec.dim (range (TP \<circ> TA))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (range TPA) = vec.dim (range (TP \<circ> TA))
[PROOF STEP]
unfolding TP_def TA_def TPA_def o_def matrix_vector_mul_assoc
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (range ((*v) (P ** A))) = vec.dim (range ((*v) (P ** A)))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
vec.dim (range TPA) = vec.dim (range (TP \<circ> TA))

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
vec.dim (range TPA) = vec.dim (range (TP \<circ> TA))

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
have "... = vec.dim (range TA)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vec.dim (range (TP \<circ> TA)) = vec.dim (range TA)
[PROOF STEP]
using dim_image_invertible_mat[OF invertible_P sub]
[PROOF STATE]
proof (prove)
using this:
vec.dim ((*v) P ` range ((*v) A)) = vec.dim (range ((*v) A))

goal (1 subgoal):
 1. vec.dim (range (TP \<circ> TA)) = vec.dim (range TA)
[PROOF STEP]
unfolding TP_def TA_def o_def fun.set_map[symmetric]
[PROOF STATE]
proof (prove)
using this:
vec.dim (range (\<lambda>x. P *v (A *v x))) = vec.dim (range ((*v) A))

goal (1 subgoal):
 1. vec.dim (range (\<lambda>x. P *v (A *v x))) = vec.dim (range ((*v) A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
vec.dim (range (TP \<circ> TA)) = vec.dim (range TA)

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
vec.dim (range TPA) = vec.dim (range TA)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
vec.dim (range TPA) = vec.dim (range TA)

goal (1 subgoal):
 1. rank (P ** A) = rank A
[PROOF STEP]
unfolding rank_eq_dim_image TPA_def TA_def
[PROOF STATE]
proof (prove)
using this:
vec.dim (range ((*v) (P ** A))) = vec.dim (range ((*v) A))

goal (1 subgoal):
 1. vec.dim (range ((*v) (P ** A))) = vec.dim (range ((*v) A))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
rank (P ** A) = rank A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma sin_zero_pi_iff:
  fixes x::real
  assumes "\<bar>x\<bar> < pi"
  shows "sin x = 0 \<longleftrightarrow> x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (sin x = 0) = (x = 0)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. sin x = 0 \<Longrightarrow> x = 0
 2. x = 0 \<Longrightarrow> sin x = 0
[PROOF STEP]
show "x = 0" if "sin x = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x = 0
[PROOF STEP]
using that assms
[PROOF STATE]
proof (prove)
using this:
sin x = 0
\<bar>x\<bar> < pi

goal (1 subgoal):
 1. x = 0
[PROOF STEP]
by (auto simp: sin_zero_iff)
[PROOF STATE]
proof (state)
this:
sin x = 0 \<Longrightarrow> x = 0

goal (1 subgoal):
 1. x = 0 \<Longrightarrow> sin x = 0
[PROOF STEP]
qed auto


[STATEMENT]
lemma vangle_nonneg: "vangle u v \<ge> 0" and vangle_le_pi: "vangle u v \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> vangle u v &&& vangle u v \<le> pi
[PROOF STEP]
using Cauchy_Schwarz_ineq2[of u v]
[PROOF STATE]
proof (prove)
using this:
\<bar>u \<bullet> v\<bar> \<le> norm u * norm v

goal (1 subgoal):
 1. 0 \<le> vangle u v &&& vangle u v \<le> pi
[PROOF STEP]
by (auto simp: vangle_def field_simps intro!: arccos_lbound arccos_ubound)


[STATEMENT]
lemma kronecker_one:
  shows "kronecker_product ((1\<^sub>m x)::'a :: ring_1 mat) (1\<^sub>m y) = 1\<^sub>m (x*y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. kronecker_product (1\<^sub>m x) (1\<^sub>m y) = 1\<^sub>m (x * y)
[PROOF STEP]
unfolding kronecker_product_def Let_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. mat (dim_row (1\<^sub>m x) * dim_row (1\<^sub>m y)) (dim_col (1\<^sub>m x) * dim_col (1\<^sub>m y)) (\<lambda>(i, j). 1\<^sub>m x $$ (i div dim_row (1\<^sub>m y), j div dim_col (1\<^sub>m y)) * 1\<^sub>m y $$ (i mod dim_row (1\<^sub>m y), j mod dim_col (1\<^sub>m y))) = 1\<^sub>m (x * y)
[PROOF STEP]
apply  (auto simp add:mat_eq_iff less_mult_imp_div_less less_mult_imp_mod_less)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < x * y; i div y = j div y; i mod y = j mod y; i \<noteq> j; j < x * y\<rbrakk> \<Longrightarrow> False
[PROOF STEP]
by (metis div_mult_mod_eq)


[STATEMENT]
theorem bij_upOne: "bij upOne"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij upOne
[PROOF STEP]
by (unfold bij_def, rule conjI [OF inj_upOne surj_upOne])


[STATEMENT]
lemma "((\<lambda>x::real. ((3 powr x + 4 powr x) / 4) powr (1/x)) \<longlongrightarrow> 4) at_top"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. ((3 powr x + 4 powr x) / 4) powr (1 / x)) \<longlongrightarrow> 4) at_top
[PROOF STEP]
by real_asymp


[STATEMENT]
lemma  det_linear_row_sum:
  assumes fS: "finite S"
  shows "det ((\<chi> i. if i = k then sum (a i) S else c i)::'a::comm_ring_1^'n^'n) =
    sum (\<lambda>j. det ((\<chi> i. if i = k then a  i j else c i)::'a^'n^'n)) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. det (\<chi>i. if i = k then sum (a i) S else c i) = (\<Sum>j\<in>S. det (\<chi>i. if i = k then a i j else c i))
[PROOF STEP]
using fS
[PROOF STATE]
proof (prove)
using this:
finite S

goal (1 subgoal):
 1. det (\<chi>i. if i = k then sum (a i) S else c i) = (\<Sum>j\<in>S. det (\<chi>i. if i = k then a i j else c i))
[PROOF STEP]
by (induct rule: finite_induct; simp add: det_row_0 det_row_add cong: if_cong)


[STATEMENT]
lemma eexp_strict_mono2 [mono_intros]:
  assumes "x < y"
  shows "eexp x < eexp y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. eexp x < eexp y
[PROOF STEP]
using eexp_strict_mono assms
[PROOF STATE]
proof (prove)
using this:
strict_mono eexp
x < y

goal (1 subgoal):
 1. eexp x < eexp y
[PROOF STEP]
unfolding strict_mono_def
[PROOF STATE]
proof (prove)
using this:
\<forall>x y. x < y \<longrightarrow> eexp x < eexp y
x < y

goal (1 subgoal):
 1. eexp x < eexp y
[PROOF STEP]
by auto


[STATEMENT]
lemma eventually_nat_real:
  assumes "eventually P (at_top :: real filter)"
  shows   "eventually (\<lambda>x. P (real x)) (at_top :: nat filter)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. P (real x)
[PROOF STEP]
using assms filterlim_real_sequentially
[PROOF STATE]
proof (prove)
using this:
eventually P at_top
filterlim real at_top sequentially

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. P (real x)
[PROOF STEP]
unfolding filterlim_def le_filter_def eventually_filtermap
[PROOF STATE]
proof (prove)
using this:
eventually P at_top
\<forall>P. eventually P at_top \<longrightarrow> (\<forall>\<^sub>F x in sequentially. P (real x))

goal (1 subgoal):
 1. \<forall>\<^sub>F x in sequentially. P (real x)
[PROOF STEP]
by auto


[STATEMENT]
lemma length_distincts:
  assumes "distincts xss"
  shows "length xss = card (set ` set xss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length xss = card (set ` set xss)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
distincts xss

goal (1 subgoal):
 1. length xss = card (set ` set xss)
[PROOF STEP]
proof (induct xss)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. distincts [] \<Longrightarrow> length [] = card (set ` set [])
 2. \<And>a xss. \<lbrakk>distincts xss \<Longrightarrow> length xss = card (set ` set xss); distincts (a # xss)\<rbrakk> \<Longrightarrow> length (a # xss) = card (set ` set (a # xss))
[PROOF STEP]
case Nil
[PROOF STATE]
proof (state)
this:
distincts []

goal (2 subgoals):
 1. distincts [] \<Longrightarrow> length [] = card (set ` set [])
 2. \<And>a xss. \<lbrakk>distincts xss \<Longrightarrow> length xss = card (set ` set xss); distincts (a # xss)\<rbrakk> \<Longrightarrow> length (a # xss) = card (set ` set (a # xss))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distincts []
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
distincts []

goal (1 subgoal):
 1. length [] = card (set ` set [])
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
length [] = card (set ` set [])

goal (1 subgoal):
 1. \<And>a xss. \<lbrakk>distincts xss \<Longrightarrow> length xss = card (set ` set xss); distincts (a # xss)\<rbrakk> \<Longrightarrow> length (a # xss) = card (set ` set (a # xss))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a xss. \<lbrakk>distincts xss \<Longrightarrow> length xss = card (set ` set xss); distincts (a # xss)\<rbrakk> \<Longrightarrow> length (a # xss) = card (set ` set (a # xss))
[PROOF STEP]
case (Cons xs xss)
[PROOF STATE]
proof (state)
this:
distincts xss \<Longrightarrow> length xss = card (set ` set xss)
distincts (xs # xss)

goal (1 subgoal):
 1. \<And>a xss. \<lbrakk>distincts xss \<Longrightarrow> length xss = card (set ` set xss); distincts (a # xss)\<rbrakk> \<Longrightarrow> length (a # xss) = card (set ` set (a # xss))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
distincts xss \<Longrightarrow> length xss = card (set ` set xss)
distincts (xs # xss)
[PROOF STEP]
have "set xs \<notin> set ` set xss"
[PROOF STATE]
proof (prove)
using this:
distincts xss \<Longrightarrow> length xss = card (set ` set xss)
distincts (xs # xss)

goal (1 subgoal):
 1. set xs \<notin> set ` set xss
[PROOF STEP]
using equals0I[of "set xs"]
[PROOF STATE]
proof (prove)
using this:
distincts xss \<Longrightarrow> length xss = card (set ` set xss)
distincts (xs # xss)
(\<And>y. y \<in> set xs \<Longrightarrow> False) \<Longrightarrow> set xs = {}

goal (1 subgoal):
 1. set xs \<notin> set ` set xss
[PROOF STEP]
by (auto simp: distincts_Cons disjoint_iff_not_equal )
[PROOF STATE]
proof (state)
this:
set xs \<notin> set ` set xss

goal (1 subgoal):
 1. \<And>a xss. \<lbrakk>distincts xss \<Longrightarrow> length xss = card (set ` set xss); distincts (a # xss)\<rbrakk> \<Longrightarrow> length (a # xss) = card (set ` set (a # xss))
[PROOF STEP]
with Cons
[PROOF STATE]
proof (chain)
picking this:
distincts xss \<Longrightarrow> length xss = card (set ` set xss)
distincts (xs # xss)
set xs \<notin> set ` set xss
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
distincts xss \<Longrightarrow> length xss = card (set ` set xss)
distincts (xs # xss)
set xs \<notin> set ` set xss

goal (1 subgoal):
 1. length (xs # xss) = card (set ` set (xs # xss))
[PROOF STEP]
by (auto simp add: distincts_Cons)
[PROOF STATE]
proof (state)
this:
length (xs # xss) = card (set ` set (xs # xss))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma inverse: assumes "gcd x q = 1"
  shows "[x * inverse x q = 1] (mod q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. [int x * Number_Theory_Aux.inverse x q = 1] (mod int q)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. [int x * Number_Theory_Aux.inverse x q = 1] (mod int q)
[PROOF STEP]
have 2: "fst (bezw x q) * x + snd (bezw x q) * int q = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q = 1
[PROOF STEP]
using bezw_aux assms int_minus
[PROOF STATE]
proof (prove)
using this:
int (gcd ?x ?y) = Number_Theory_Aux.inverse ?x ?y * int ?x + snd (bezw ?x ?y) * int ?y
gcd x q = 1
int (?n - ?m) = int (nat (int ?n - int ?m))

goal (1 subgoal):
 1. Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q = 1
[PROOF STEP]
by (metis Num.of_nat_simps(2))
[PROOF STATE]
proof (state)
this:
Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q = 1

goal (1 subgoal):
 1. [int x * Number_Theory_Aux.inverse x q = 1] (mod int q)
[PROOF STEP]
hence 3: "(fst (bezw x q) * x + snd (bezw x q) * int q) mod q = 1 mod q"
[PROOF STATE]
proof (prove)
using this:
Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q = 1

goal (1 subgoal):
 1. (Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q) mod int q = int (1 mod q)
[PROOF STEP]
by (metis assms bezw_aux of_nat_mod)
[PROOF STATE]
proof (state)
this:
(Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q) mod int q = int (1 mod q)

goal (1 subgoal):
 1. [int x * Number_Theory_Aux.inverse x q = 1] (mod int q)
[PROOF STEP]
hence 4: "(fst (bezw x q) * x) mod q = 1 mod q"
[PROOF STATE]
proof (prove)
using this:
(Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q) mod int q = int (1 mod q)

goal (1 subgoal):
 1. Number_Theory_Aux.inverse x q * int x mod int q = int (1 mod q)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Number_Theory_Aux.inverse x q * int x mod int q = int (1 mod q)

goal (1 subgoal):
 1. [int x * Number_Theory_Aux.inverse x q = 1] (mod int q)
[PROOF STEP]
hence 5:  "[(fst (bezw x q)) * x  = 1] (mod q)"
[PROOF STATE]
proof (prove)
using this:
Number_Theory_Aux.inverse x q * int x mod int q = int (1 mod q)

goal (1 subgoal):
 1. [Number_Theory_Aux.inverse x q * int x = 1] (mod int q)
[PROOF STEP]
using 2 3 cong_def
[PROOF STATE]
proof (prove)
using this:
Number_Theory_Aux.inverse x q * int x mod int q = int (1 mod q)
Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q = 1
(Number_Theory_Aux.inverse x q * int x + snd (bezw x q) * int q) mod int q = int (1 mod q)
[?b = ?c] (mod ?a) = (?b mod ?a = ?c mod ?a)

goal (1 subgoal):
 1. [Number_Theory_Aux.inverse x q * int x = 1] (mod int q)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
[Number_Theory_Aux.inverse x q * int x = 1] (mod int q)

goal (1 subgoal):
 1. [int x * Number_Theory_Aux.inverse x q = 1] (mod int q)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
[Number_Theory_Aux.inverse x q * int x = 1] (mod int q)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
[Number_Theory_Aux.inverse x q * int x = 1] (mod int q)

goal (1 subgoal):
 1. [int x * Number_Theory_Aux.inverse x q = 1] (mod int q)
[PROOF STEP]
by(simp add: mult.commute)
[PROOF STATE]
proof (state)
this:
[int x * Number_Theory_Aux.inverse x q = 1] (mod int q)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma bij_betw_eq:
  "bij_betw f A B \<longleftrightarrow>
    inj_on f A \<and> (\<forall>y\<in>B. \<exists>x\<in>A. f(x)=y) \<and> (\<forall>x\<in>A. f x \<in> B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bij_betw f A B = (inj_on f A \<and> (\<forall>y\<in>B. \<exists>x\<in>A. f x = y) \<and> (\<forall>x\<in>A. f x \<in> B))
[PROOF STEP]
unfolding bij_betw_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (inj_on f A \<and> f ` A = B) = (inj_on f A \<and> (\<forall>y\<in>B. \<exists>x\<in>A. f x = y) \<and> (\<forall>x\<in>A. f x \<in> B))
[PROOF STEP]
by auto


[STATEMENT]
lemma image_mset_mono:
  assumes
    mono_f: "\<forall>x \<in> set_mset M. \<forall>y \<in> set_mset N. x < y \<longrightarrow> f x < f y" and
    less: "M \<le> N"
  shows "image_mset f M \<le> image_mset f N"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. image_mset f M \<le> image_mset f N
[PROOF STEP]
by (metis eq_iff image_mset_strict_mono less less_imp_le mono_f order.not_eq_order_implies_strict)