[STATEMENT]
theorem primitive_principal_form:
  defines "\<chi>\<^sub>1 \<equiv> principal_dchar n"
  assumes "\<chi> \<noteq> principal_dchar n"
  shows "\<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi>(n) = \<Phi>(n) * \<chi>\<^sub>1(n))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
(*
    TODO: perhaps residues_nat should be relaxed to allow n = 1.
    Then we could remove the unnecessary precondition here.
    It makes no real difference though.
  *)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
from n
[PROOF STATE]
proof (chain)
picking this:
1 < n
[PROOF STEP]
have n_pos: "n > 0"
[PROOF STATE]
proof (prove)
using this:
1 < n

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

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
define d where "d = conductor"
[PROOF STATE]
proof (state)
this:
d = conductor

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
have induced: "induced_modulus d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. induced_modulus d
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. induced_modulus conductor
[PROOF STEP]
using conductor_induced
[PROOF STATE]
proof (prove)
using this:
induced_modulus conductor

goal (1 subgoal):
 1. induced_modulus conductor
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
induced_modulus d

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
induced_modulus d
[PROOF STEP]
have d_not_1: "d \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
induced_modulus d

goal (1 subgoal):
 1. d \<noteq> 1
[PROOF STEP]
using one_induced_iff_principal assms
[PROOF STATE]
proof (prove)
using this:
induced_modulus d
induced_modulus 1 = (\<chi> = principal_dchar n)
\<chi>\<^sub>1 \<equiv> principal_dchar n
\<chi> \<noteq> principal_dchar n

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

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
hence d_gt_1: "d > 1"
[PROOF STATE]
proof (prove)
using this:
d \<noteq> 1

goal (1 subgoal):
 1. 1 < d
[PROOF STEP]
using conductor_gr_0
[PROOF STATE]
proof (prove)
using this:
d \<noteq> 1
0 < conductor

goal (1 subgoal):
 1. 1 < d
[PROOF STEP]
by (auto simp: d_def)
[PROOF STATE]
proof (state)
this:
1 < d

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
from induced
[PROOF STATE]
proof (chain)
picking this:
induced_modulus d
[PROOF STEP]
obtain \<Phi> where \<Phi>_def: "dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)"
[PROOF STATE]
proof (prove)
using this:
induced_modulus d

goal (1 subgoal):
 1. (\<And>\<Phi>. dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using d_not_1
[PROOF STATE]
proof (prove)
using this:
induced_modulus d
d \<noteq> 1

goal (1 subgoal):
 1. (\<And>\<Phi>. dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by (subst (asm) induced_modulus_altdef2) (auto simp: d_def conductor_dvd \<chi>\<^sub>1_def)
[PROOF STATE]
proof (state)
this:
dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
have phi_dchars: "\<Phi> \<in> dcharacters d"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> \<in> dcharacters d
[PROOF STEP]
using \<Phi>_def dcharacters_def
[PROOF STATE]
proof (prove)
using this:
dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
dcharacters ?n = {\<chi>. dcharacter ?n \<chi>}

goal (1 subgoal):
 1. \<Phi> \<in> dcharacters d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<Phi> \<in> dcharacters d

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
interpret \<Phi>: dcharacter d "residue_mult_group d" \<Phi>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dcharacter d \<Phi> &&& residue_mult_group d \<equiv> residue_mult_group d
[PROOF STEP]
using \<Phi>_def
[PROOF STATE]
proof (prove)
using this:
dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)

goal (1 subgoal):
 1. dcharacter d \<Phi> &&& residue_mult_group d \<equiv> residue_mult_group d
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
have \<Phi>_prim: "primitive_dchar d \<Phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. primitive_dchar d \<Phi>
[PROOF STEP]
proof (rule ccontr)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<not> primitive_dchar d \<Phi> \<Longrightarrow> False
[PROOF STEP]
assume "\<not> primitive_dchar d \<Phi>"
[PROOF STATE]
proof (state)
this:
\<not> primitive_dchar d \<Phi>

goal (1 subgoal):
 1. \<not> primitive_dchar d \<Phi> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> primitive_dchar d \<Phi>
[PROOF STEP]
obtain q where
      1: "q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q"
[PROOF STATE]
proof (prove)
using this:
\<not> primitive_dchar d \<Phi>

goal (1 subgoal):
 1. (\<And>q. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding \<Phi>.induced_modulus_def \<Phi>.primitive_dchar_iff
[PROOF STATE]
proof (prove)
using this:
\<not> \<not> (\<exists>da<d. da dvd d \<and> (\<forall>a. coprime a d \<and> [a = 1] (mod da) \<longrightarrow> \<Phi> a = 1))

goal (1 subgoal):
 1. (\<And>q. q dvd d \<and> q < d \<and> q dvd d \<and> (\<forall>a. coprime a d \<and> [a = 1] (mod q) \<longrightarrow> \<Phi> a = 1) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q

goal (1 subgoal):
 1. \<not> primitive_dchar d \<Phi> \<Longrightarrow> False
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q
[PROOF STEP]
have 2: "induced_modulus q"
[PROOF STATE]
proof (prove)
using this:
q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q

goal (1 subgoal):
 1. induced_modulus q
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
{
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
fix k
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
assume mod_1: "[k = 1] (mod q)"
[PROOF STATE]
proof (state)
this:
[k = 1] (mod q)

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
assume cop: "coprime k n"
[PROOF STATE]
proof (state)
this:
coprime k n

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
have "\<chi>(k) = \<Phi>(k)*\<chi>\<^sub>1(k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<chi> k = \<Phi> k * \<chi>\<^sub>1 k
[PROOF STEP]
using \<Phi>_def
[PROOF STATE]
proof (prove)
using this:
dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)

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

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<chi> k = \<Phi> k * \<chi>\<^sub>1 k

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
have "\<dots> = \<Phi>(k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> k * \<chi>\<^sub>1 k = \<Phi> k
[PROOF STEP]
using cop
[PROOF STATE]
proof (prove)
using this:
coprime k n

goal (1 subgoal):
 1. \<Phi> k * \<chi>\<^sub>1 k = \<Phi> k
[PROOF STEP]
by (simp add: assms principal_dchar_def)
[PROOF STATE]
proof (state)
this:
\<Phi> k * \<chi>\<^sub>1 k = \<Phi> k

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
\<Phi> k * \<chi>\<^sub>1 k = \<Phi> k

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
have "\<dots> = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Phi> k = 1
[PROOF STEP]
using 1 mod_1 \<Phi>.induced_modulus_def
                \<open>induced_modulus d\<close> cop induced_modulus_def
[PROOF STATE]
proof (prove)
using this:
q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q
[k = 1] (mod q)
\<Phi>.induced_modulus ?d = (?d dvd d \<and> (\<forall>a. coprime a d \<and> [a = 1] (mod ?d) \<longrightarrow> \<Phi> a = 1))
induced_modulus d
coprime k n
induced_modulus ?d = (?d dvd n \<and> (\<forall>a. coprime a n \<and> [a = 1] (mod ?d) \<longrightarrow> \<chi> a = 1))

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

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
\<chi> k = 1
[PROOF STEP]
have "\<chi>(k) = 1"
[PROOF STATE]
proof (prove)
using this:
\<chi> k = 1

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

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<lbrakk>[?k3 = 1] (mod q); coprime ?k3 n\<rbrakk> \<Longrightarrow> \<chi> ?k3 = 1

goal (1 subgoal):
 1. q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q \<Longrightarrow> induced_modulus q
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<lbrakk>[?k3 = 1] (mod q); coprime ?k3 n\<rbrakk> \<Longrightarrow> \<chi> ?k3 = 1
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>[?k3 = 1] (mod q); coprime ?k3 n\<rbrakk> \<Longrightarrow> \<chi> ?k3 = 1

goal (1 subgoal):
 1. induced_modulus q
[PROOF STEP]
using induced_modulus_def "1" \<open>induced_modulus d\<close>
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>[?k3 = 1] (mod q); coprime ?k3 n\<rbrakk> \<Longrightarrow> \<chi> ?k3 = 1
induced_modulus ?d = (?d dvd n \<and> (\<forall>a. coprime a n \<and> [a = 1] (mod ?d) \<longrightarrow> \<chi> a = 1))
q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q
induced_modulus d

goal (1 subgoal):
 1. induced_modulus q
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
induced_modulus q

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
induced_modulus q

goal (1 subgoal):
 1. \<not> primitive_dchar d \<Phi> \<Longrightarrow> False
[PROOF STEP]
from 1
[PROOF STATE]
proof (chain)
picking this:
q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q
[PROOF STEP]
have "q < d"
[PROOF STATE]
proof (prove)
using this:
q dvd d \<and> q < d \<and> \<Phi>.induced_modulus q

goal (1 subgoal):
 1. q < d
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
q < d

goal (1 subgoal):
 1. \<not> primitive_dchar d \<Phi> \<Longrightarrow> False
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
q < d

goal (1 subgoal):
 1. \<not> primitive_dchar d \<Phi> \<Longrightarrow> False
[PROOF STEP]
have "d \<le> q"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. d \<le> q
[PROOF STEP]
unfolding d_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. conductor \<le> q
[PROOF STEP]
by (intro conductor_leI) fact
[PROOF STATE]
proof (state)
this:
d \<le> q

goal (1 subgoal):
 1. \<not> primitive_dchar d \<Phi> \<Longrightarrow> False
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
q < d
d \<le> q
[PROOF STEP]
show False
[PROOF STATE]
proof (prove)
using this:
q < d
d \<le> q

goal (1 subgoal):
 1. False
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
False

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
primitive_dchar d \<Phi>

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
from \<Phi>_def \<Phi>_prim d_def phi_dchars
[PROOF STATE]
proof (chain)
picking this:
dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
primitive_dchar d \<Phi>
d = conductor
\<Phi> \<in> dcharacters d
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
dcharacter d \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
primitive_dchar d \<Phi>
d = conductor
\<Phi> \<in> dcharacters d

goal (1 subgoal):
 1. \<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>\<Phi>. primitive_dchar conductor \<Phi> \<and> (\<forall>n. \<chi> n = \<Phi> n * \<chi>\<^sub>1 n)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma summset_add_mset[simp]:
  assumes a: "a \<in> carrier G" and MG: "set_mset M \<subseteq> carrier G"
  shows "summset (add_mset a M) = a \<oplus> summset M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summset (add_mset a M) = a \<oplus> summset M
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
a \<in> carrier G
set_mset M \<subseteq> carrier G

goal (1 subgoal):
 1. summset (add_mset a M) = a \<oplus> summset M
[PROOF STEP]
by (auto simp add: summset_def)
   (rule comp_fun_commute_on.fold_mset_add_mset, unfold_locales, auto simp add: a_lcomm)


[STATEMENT]
lemma akiyama_tanigawa_row_0 [code]:
  "akiyama_tanigawa_row 0 l u = map (\<lambda>n. inverse (real (Suc n))) [l..<u]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. akiyama_tanigawa_row 0 l u = map (\<lambda>n. inverse (real (Suc n))) [l..<u]
[PROOF STEP]
by (simp add: akiyama_tanigawa_row_def akiyama_tanigawa_def divide_simps)


[STATEMENT]
lemma next_ofsm_table_keys_invar: "Mapping.keys (next_ofsm_table M prev_table) = states M"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Mapping.keys (next_ofsm_table M prev_table) = FSM.states M
[PROOF STEP]
using states_as_list_set[of M]
[PROOF STATE]
proof (prove)
using this:
set (states_as_list M) = FSM.states M

goal (1 subgoal):
 1. Mapping.keys (next_ofsm_table M prev_table) = FSM.states M
[PROOF STEP]
by simp


[STATEMENT]
lemma face_of_disjoint_rel_interior:
      fixes S :: "'a::real_normed_vector set"
      assumes "T face_of S" "T \<noteq> S"
        shows "T \<inter> rel_interior S = {}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. T \<inter> rel_interior S = {}
[PROOF STEP]
by (meson assms subset_of_face_of face_of_imp_subset order_refl subset_antisym)


[STATEMENT]
lemma midpoint_def:
  assumes "Bet A B C" and
    "Cong A B B C"
  shows "B Midpoint A C"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B Midpoint A C
[PROOF STEP]
using Midpoint_def assms(1) assms(2)
[PROOF STATE]
proof (prove)
using this:
?M Midpoint ?A ?B \<equiv> Bet ?A ?M ?B \<and> Cong ?A ?M ?M ?B
Bet A B C
Cong A B B C

goal (1 subgoal):
 1. B Midpoint A C
[PROOF STEP]
by blast


[STATEMENT]
lemma norm_ket_k:
  "inner_prod (ket_k k) (ket_k k) \<le> 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inner_prod (ket_k k) (ket_k k) \<le> 1
[PROOF STEP]
apply (case_tac "k < K")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. k < K \<Longrightarrow> inner_prod (ket_k k) (ket_k k) \<le> 1
 2. \<not> k < K \<Longrightarrow> inner_prod (ket_k k) (ket_k k) \<le> 1
[PROOF STEP]
using norm_ket_k_lt_K norm_ket_k_ge_K
[PROOF STATE]
proof (prove)
using this:
?k < K \<Longrightarrow> inner_prod (ket_k ?k) (ket_k ?k) = 1
K \<le> ?k \<Longrightarrow> inner_prod (ket_k ?k) (ket_k ?k) = 0

goal (2 subgoals):
 1. k < K \<Longrightarrow> inner_prod (ket_k k) (ket_k k) \<le> 1
 2. \<not> k < K \<Longrightarrow> inner_prod (ket_k k) (ket_k k) \<le> 1
[PROOF STEP]
by (auto simp: less_eq_complex_def)


[STATEMENT]
lemma Finite_imp_cardinal_cons [simp]:
  assumes FA: "finite A" and a: "a \<notin> A"
  shows "vcard (set (insert a A)) = csucc(vcard (set A))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (set (insert a A)) = csucc (vcard (set A))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vcard (set (insert a A)) = csucc (vcard (set A))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (set (insert a A)) = csucc (vcard (set A))
[PROOF STEP]
unfolding csucc_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (set (insert a A)) = (LEAST \<kappa>'. Ord \<kappa>' \<and> Card \<kappa>' \<and> vcard (set A) < \<kappa>')
[PROOF STEP]
proof (rule Least_equality [THEN sym])
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. Ord (vcard (set (insert a A))) \<and> Card (vcard (set (insert a A))) \<and> vcard (set A) < vcard (set (insert a A))
 2. \<And>y. Ord y \<and> Card y \<and> vcard (set A) < y \<Longrightarrow> vcard (set (insert a A)) \<le> y
[PROOF STEP]
have "small A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. small A
[PROOF STEP]
by (simp add: FA Finite_V)
[PROOF STATE]
proof (state)
this:
small A

goal (2 subgoals):
 1. Ord (vcard (set (insert a A))) \<and> Card (vcard (set (insert a A))) \<and> vcard (set A) < vcard (set (insert a A))
 2. \<And>y. Ord y \<and> Card y \<and> vcard (set A) < y \<Longrightarrow> vcard (set (insert a A)) \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
small A
[PROOF STEP]
have "\<not> elts (set A) \<approx> elts (set (insert a A))"
[PROOF STATE]
proof (prove)
using this:
small A

goal (1 subgoal):
 1. \<not> elts (set A) \<approx> elts (set (insert a A))
[PROOF STEP]
using FA a eqpoll_imp_lepoll eqpoll_sym finite_insert_lepoll
[PROOF STATE]
proof (prove)
using this:
small A
finite A
a \<notin> A
?A \<approx> ?B \<Longrightarrow> ?A \<lesssim> ?B
?A \<approx> ?B \<Longrightarrow> ?B \<approx> ?A
finite ?A \<Longrightarrow> (insert ?a ?A \<lesssim> ?A) = (?a \<in> ?A)

goal (1 subgoal):
 1. \<not> elts (set A) \<approx> elts (set (insert a A))
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<not> elts (set A) \<approx> elts (set (insert a A))

goal (2 subgoals):
 1. Ord (vcard (set (insert a A))) \<and> Card (vcard (set (insert a A))) \<and> vcard (set A) < vcard (set (insert a A))
 2. \<And>y. Ord y \<and> Card y \<and> vcard (set A) < y \<Longrightarrow> vcard (set (insert a A)) \<le> y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
\<not> elts (set A) \<approx> elts (set (insert a A))
[PROOF STEP]
show "Ord (vcard (set (insert a A))) \<and> Card (vcard (set (insert a A))) \<and> vcard (set A) < vcard (set (insert a A))"
[PROOF STATE]
proof (prove)
using this:
\<not> elts (set A) \<approx> elts (set (insert a A))

goal (1 subgoal):
 1. Ord (vcard (set (insert a A))) \<and> Card (vcard (set (insert a A))) \<and> vcard (set A) < vcard (set (insert a A))
[PROOF STEP]
by (simp add: Card_def lesspoll_imp_Card_less lesspoll_def subset_imp_lepoll subset_insertI)
[PROOF STATE]
proof (state)
this:
Ord (vcard (set (insert a A))) \<and> Card (vcard (set (insert a A))) \<and> vcard (set A) < vcard (set (insert a A))

goal (1 subgoal):
 1. \<And>y. Ord y \<and> Card y \<and> vcard (set A) < y \<Longrightarrow> vcard (set (insert a A)) \<le> y
[PROOF STEP]
show "vcard (set (insert a A)) \<le> i"
      if "Ord i \<and> Card i \<and> vcard (set A) < i" for i
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (set (insert a A)) \<le> i
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. vcard (set (insert a A)) \<le> i
[PROOF STEP]
have "elts (vcard (set A)) \<approx> A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. elts (vcard (set A)) \<approx> A
[PROOF STEP]
by (metis FA finite_imp_small cardinal_eqpoll elts_of_set)
[PROOF STATE]
proof (state)
this:
elts (vcard (set A)) \<approx> A

goal (1 subgoal):
 1. vcard (set (insert a A)) \<le> i
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
elts (vcard (set A)) \<approx> A
[PROOF STEP]
have less: "A \<prec> elts i"
[PROOF STATE]
proof (prove)
using this:
elts (vcard (set A)) \<approx> A

goal (1 subgoal):
 1. A \<prec> elts i
[PROOF STEP]
using eq_lesspoll_trans eqpoll_sym lt_Card_imp_lesspoll that
[PROOF STATE]
proof (prove)
using this:
elts (vcard (set A)) \<approx> A
\<lbrakk>?X \<approx> ?Y; ?Y \<prec> ?Z\<rbrakk> \<Longrightarrow> ?X \<prec> ?Z
?A \<approx> ?B \<Longrightarrow> ?B \<approx> ?A
\<lbrakk>?i < ?a; Card ?a; Ord ?i\<rbrakk> \<Longrightarrow> elts ?i \<prec> elts ?a
Ord i \<and> Card i \<and> vcard (set A) < i

goal (1 subgoal):
 1. A \<prec> elts i
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A \<prec> elts i

goal (1 subgoal):
 1. vcard (set (insert a A)) \<le> i
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vcard (set (insert a A)) \<le> i
[PROOF STEP]
using that less
[PROOF STATE]
proof (prove)
using this:
Ord i \<and> Card i \<and> vcard (set A) < i
A \<prec> elts i

goal (1 subgoal):
 1. vcard (set (insert a A)) \<le> i
[PROOF STEP]
by (auto simp: less_imp_insert_lepoll lepoll_cardinal_le)
[PROOF STATE]
proof (state)
this:
vcard (set (insert a A)) \<le> i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
Ord ?i \<and> Card ?i \<and> vcard (set A) < ?i \<Longrightarrow> vcard (set (insert a A)) \<le> ?i

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
vcard (set (insert a A)) = csucc (vcard (set A))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma rsum_bound:
  assumes p: "p tagged_division_of (cbox a b)"
      and "\<forall>x\<in>cbox a b. norm (f x) \<le> e"
    shows "norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p) \<le> e * content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
proof (cases "cbox a b = {}")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cbox a b = {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
 2. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
cbox a b = {}

goal (2 subgoals):
 1. cbox a b = {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
 2. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
using p
[PROOF STATE]
proof (prove)
using this:
p tagged_division_of cbox a b

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
unfolding True tagged_division_of_trivial
[PROOF STATE]
proof (prove)
using this:
p = {}

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content {}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
cbox a b \<noteq> {}

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cbox a b \<noteq> {}
[PROOF STEP]
have e: "e \<ge> 0"
[PROOF STATE]
proof (prove)
using this:
cbox a b \<noteq> {}

goal (1 subgoal):
 1. 0 \<le> e
[PROOF STEP]
by (meson ex_in_conv assms(2) norm_ge_zero order_trans)
[PROOF STATE]
proof (state)
this:
0 \<le> e

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
have sum_le: "sum (content \<circ> snd) p \<le> content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (content \<circ> snd) p \<le> content (cbox a b)
[PROOF STEP]
unfolding additive_content_tagged_division[OF p, symmetric] split_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sum (content \<circ> snd) p \<le> (\<Sum>p\<in>p. content (snd p))
[PROOF STEP]
by (auto intro: eq_refl)
[PROOF STATE]
proof (state)
this:
sum (content \<circ> snd) p \<le> content (cbox a b)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
have con: "\<And>xk. xk \<in> p \<Longrightarrow> 0 \<le> content (snd xk)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xk. xk \<in> p \<Longrightarrow> 0 \<le> content (snd xk)
[PROOF STEP]
using tagged_division_ofD(4) [OF p] content_pos_le
[PROOF STATE]
proof (prove)
using this:
(?x, ?K) \<in> p \<Longrightarrow> \<exists>a b. ?K = cbox a b
0 \<le> content ?X

goal (1 subgoal):
 1. \<And>xk. xk \<in> p \<Longrightarrow> 0 \<le> content (snd xk)
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
?xk \<in> p \<Longrightarrow> 0 \<le> content (snd ?xk)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
have "norm (sum (\<lambda>(x,k). content k *\<^sub>R f x) p) \<le> (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x))
[PROOF STEP]
by (rule norm_sum)
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x))

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x))

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
have "...  \<le> e * content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)
[PROOF STEP]
have "\<And>xk. xk \<in> p \<Longrightarrow> norm (f (fst xk)) \<le> e"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>xk. xk \<in> p \<Longrightarrow> norm (f (fst xk)) \<le> e
[PROOF STEP]
using assms(2) p tag_in_interval
[PROOF STATE]
proof (prove)
using this:
\<forall>x\<in>cbox a b. norm (f x) \<le> e
p tagged_division_of cbox a b
\<lbrakk>?p tagged_division_of ?i; (?x, ?k) \<in> ?p\<rbrakk> \<Longrightarrow> ?x \<in> ?i

goal (1 subgoal):
 1. \<And>xk. xk \<in> p \<Longrightarrow> norm (f (fst xk)) \<le> e
[PROOF STEP]
by force
[PROOF STATE]
proof (state)
this:
?xk \<in> p \<Longrightarrow> norm (f (fst ?xk)) \<le> e

goal (1 subgoal):
 1. (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?xk \<in> p \<Longrightarrow> norm (f (fst ?xk)) \<le> e

goal (1 subgoal):
 1. (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)
[PROOF STEP]
have "(\<Sum>i\<in>p. \<bar>content (snd i)\<bar> * e) \<le> e * content (cbox a b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>p. \<bar>content (snd i)\<bar> * e) \<le> e * content (cbox a b)
[PROOF STEP]
unfolding sum_distrib_right[symmetric]
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>i\<in>p. \<bar>content (snd i)\<bar>) * e \<le> e * content (cbox a b)
[PROOF STEP]
using con sum_le
[PROOF STATE]
proof (prove)
using this:
?xk \<in> p \<Longrightarrow> 0 \<le> content (snd ?xk)
sum (content \<circ> snd) p \<le> content (cbox a b)

goal (1 subgoal):
 1. (\<Sum>i\<in>p. \<bar>content (snd i)\<bar>) * e \<le> e * content (cbox a b)
[PROOF STEP]
by (auto simp: mult.commute intro: mult_left_mono [OF _ e])
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>p. \<bar>content (snd i)\<bar> * e) \<le> e * content (cbox a b)

goal (1 subgoal):
 1. (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
?xk \<in> p \<Longrightarrow> norm (f (fst ?xk)) \<le> e
(\<Sum>i\<in>p. \<bar>content (snd i)\<bar> * e) \<le> e * content (cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
?xk \<in> p \<Longrightarrow> norm (f (fst ?xk)) \<le> e
(\<Sum>i\<in>p. \<bar>content (snd i)\<bar> * e) \<le> e * content (cbox a b)

goal (1 subgoal):
 1. (\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)
[PROOF STEP]
unfolding split_def norm_scaleR
[PROOF STATE]
proof (prove)
using this:
?xk \<in> p \<Longrightarrow> norm (f (fst ?xk)) \<le> e
(\<Sum>i\<in>p. \<bar>content (snd i)\<bar> * e) \<le> e * content (cbox a b)

goal (1 subgoal):
 1. (\<Sum>i\<in>p. \<bar>content (snd i)\<bar> * norm (f (fst i))) \<le> e * content (cbox a b)
[PROOF STEP]
by (metis (no_types, lifting) mult_left_mono[OF _ abs_ge_zero]   order_trans[OF sum_mono])
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<Sum>i\<in>p. norm (case i of (x, k) \<Rightarrow> content k *\<^sub>R f x)) \<le> e * content (cbox a b)

goal (1 subgoal):
 1. cbox a b \<noteq> {} \<Longrightarrow> norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)

goal (1 subgoal):
 1. norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
norm (\<Sum>(x, k)\<in>p. content k *\<^sub>R f x) \<le> e * content (cbox a b)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mirror_elem_inj_on: "finite I \<Longrightarrow> inj_on (\<lambda>x. mirror_elem x I) I"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite I \<Longrightarrow> inj_on (\<lambda>x. mirror_elem x I) I
[PROOF STEP]
unfolding mirror_elem_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite I \<Longrightarrow> inj_on (\<lambda>x. nat_mirror x (iMin I) (Max I)) I
[PROOF STEP]
by (metis Max_le_imp_subset_atMost nat_mirror_inj_on not_add_less2 not_le_imp_less subset_inj_on)


[STATEMENT]
lemma rcis_cnj:
  shows "cnj a = rcis (cmod a) (- Arg a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cnj a = rcis (cmod a) (- Arg a)
[PROOF STEP]
by (metis cis_cnj complex_cnj_complex_of_real complex_cnj_mult rcis_cmod_Arg rcis_def)


[STATEMENT]
lemma eq_diff0:
  assumes "x \<in> carrier R" "y \<in> carrier R"
  shows "x \<ominus> y = \<zero> \<longleftrightarrow> x = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x \<ominus> y = \<zero>) = (x = y)
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x \<ominus> y = \<zero> \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> x \<ominus> y = \<zero>
[PROOF STEP]
assume "x \<ominus> y = \<zero>"
[PROOF STATE]
proof (state)
this:
x \<ominus> y = \<zero>

goal (2 subgoals):
 1. x \<ominus> y = \<zero> \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> x \<ominus> y = \<zero>
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
x \<ominus> y = \<zero>
[PROOF STEP]
have "x \<oplus> (\<ominus> y \<oplus> y) = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
x \<ominus> y = \<zero>

goal (1 subgoal):
 1. x \<oplus> (\<ominus> y \<oplus> y) = y
[PROOF STEP]
by (simp add: minus_eq a_assoc [symmetric])
[PROOF STATE]
proof (state)
this:
x \<oplus> (\<ominus> y \<oplus> y) = y

goal (2 subgoals):
 1. x \<ominus> y = \<zero> \<Longrightarrow> x = y
 2. x = y \<Longrightarrow> x \<ominus> y = \<zero>
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
x \<oplus> (\<ominus> y \<oplus> y) = y
[PROOF STEP]
show "x = y"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
x \<oplus> (\<ominus> y \<oplus> y) = y

goal (1 subgoal):
 1. x = y
[PROOF STEP]
by (simp add: l_neg)
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. x = y \<Longrightarrow> x \<ominus> y = \<zero>
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x = y \<Longrightarrow> x \<ominus> y = \<zero>
[PROOF STEP]
assume "x = y"
[PROOF STATE]
proof (state)
this:
x = y

goal (1 subgoal):
 1. x = y \<Longrightarrow> x \<ominus> y = \<zero>
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
x \<in> carrier R
y \<in> carrier R
x = y
[PROOF STEP]
show "x \<ominus> y = \<zero>"
[PROOF STATE]
proof (prove)
using this:
x \<in> carrier R
y \<in> carrier R
x = y

goal (1 subgoal):
 1. x \<ominus> y = \<zero>
[PROOF STEP]
by (simp add: minus_eq r_neg)
[PROOF STATE]
proof (state)
this:
x \<ominus> y = \<zero>

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma set_sel_aux'_1_if_notfin: "\<not>finite X \<Longrightarrow> set_sel_aux' f X y = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite X \<Longrightarrow> set_sel_aux' f X y = 1
[PROOF STEP]
unfolding set_sel_aux'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. infinite X \<Longrightarrow> (\<Prod>x\<in>X. f x y) = 1
[PROOF STEP]
by simp


[STATEMENT]
lemma char_Pg_eq[simp]: "(Abs_Pg (eq_game_rel `` {g}) = Abs_Pg (eq_game_rel `` {h})) = (eq_game g h)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Abs_Pg (eq_game_rel `` {g}) = Abs_Pg (eq_game_rel `` {h})) = eq_game g h
[PROOF STEP]
apply (simp add: Rep_Pg_inject [symmetric])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (eq_game_rel `` {g} = eq_game_rel `` {h}) = eq_game g h
[PROOF STEP]
apply (subst eq_equiv_class_iff[of UNIV])
[PROOF STATE]
proof (prove)
goal (4 subgoals):
 1. equiv UNIV eq_game_rel
 2. g \<in> UNIV
 3. h \<in> UNIV
 4. ((g, h) \<in> eq_game_rel) = eq_game g h
[PROOF STEP]
apply (simp_all)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((g, h) \<in> eq_game_rel) = eq_game g h
[PROOF STEP]
apply (simp add: eq_game_rel_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma square_free_iff_separable:
  "square_free (f :: 'a :: {field_char_0,factorial_ring_gcd,semiring_gcd_mult_normalize} poly) = separable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. square_free f = separable f
[PROOF STEP]
using separable_imp_square_free[of f] square_free_imp_separable[of f]
[PROOF STATE]
proof (prove)
using this:
separable f \<Longrightarrow> square_free f
square_free f \<Longrightarrow> separable f

goal (1 subgoal):
 1. square_free f = separable f
[PROOF STEP]
by auto


[STATEMENT]
lemma has_integral_integral_lborel:
  assumes f: "integrable lborel f"
  shows "(f has_integral (integral\<^sup>L lborel f)) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
have "((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. integral\<^sup>L lborel (\<lambda>x. f x \<bullet> b) *\<^sub>R b)) UNIV"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. (LINT x|lborel. f x \<bullet> b) *\<^sub>R b)) UNIV
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
integrable lborel f

goal (1 subgoal):
 1. ((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. (LINT x|lborel. f x \<bullet> b) *\<^sub>R b)) UNIV
[PROOF STEP]
by (intro has_integral_sum finite_Basis ballI has_integral_scaleR_left has_integral_integral_real) auto
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. (LINT x|lborel. f x \<bullet> b) *\<^sub>R b)) UNIV

goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
((\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) has_integral (\<Sum>b\<in>Basis. (LINT x|lborel. f x \<bullet> b) *\<^sub>R b)) UNIV

goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
have eq_f: "(\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) = f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) = f
[PROOF STEP]
by (simp add: fun_eq_iff euclidean_representation)
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) = f

goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>x. \<Sum>b\<in>Basis. (f x \<bullet> b) *\<^sub>R b) = f

goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
have "(\<Sum>b\<in>Basis. integral\<^sup>L lborel (\<lambda>x. f x \<bullet> b) *\<^sub>R b) = integral\<^sup>L lborel f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>b\<in>Basis. (LINT x|lborel. f x \<bullet> b) *\<^sub>R b) = integral\<^sup>L lborel f
[PROOF STEP]
using f
[PROOF STATE]
proof (prove)
using this:
integrable lborel f

goal (1 subgoal):
 1. (\<Sum>b\<in>Basis. (LINT x|lborel. f x \<bullet> b) *\<^sub>R b) = integral\<^sup>L lborel f
[PROOF STEP]
by (subst (2) eq_f[symmetric]) simp
[PROOF STATE]
proof (state)
this:
(\<Sum>b\<in>Basis. (LINT x|lborel. f x \<bullet> b) *\<^sub>R b) = integral\<^sup>L lborel f

goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(f has_integral integral\<^sup>L lborel f) UNIV

goal (1 subgoal):
 1. (f has_integral integral\<^sup>L lborel f) UNIV
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(f has_integral integral\<^sup>L lborel f) UNIV

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma geseq_iff:
  "(f, g) \<in> geseq \<longleftrightarrow>
    f \<in> SEQ A \<and> g \<in> SEQ A \<and> (f = g \<or> (\<exists>i. size (g i) < size (f i) \<and> (\<forall>j < i. f j = g j)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((f, g) \<in> geseq) = (f \<in> SEQ A \<and> g \<in> SEQ A \<and> (f = g \<or> (\<exists>i. size (g i) < size (f i) \<and> (\<forall>j<i. f j = g j))))
[PROOF STEP]
by (auto simp: geseq_def)


[STATEMENT]
lemma prod_Suc_Suc_fact: "prod Suc {Suc 0..<n} = fact n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
proof (cases "n = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. n = 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
 2. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
n = 0

goal (2 subgoals):
 1. n = 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
 2. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
n = 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
n = 0

goal (1 subgoal):
 1. prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod Suc {Suc 0..<n} = fact n

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
n \<noteq> 0

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
have "prod Suc {Suc 0..<n} = Suc 0 * prod Suc {Suc 0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod Suc {Suc 0..<n} = Suc 0 * prod Suc {Suc 0..<n}
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
prod Suc {Suc 0..<n} = Suc 0 * prod Suc {Suc 0..<n}

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod Suc {Suc 0..<n} = Suc 0 * prod Suc {Suc 0..<n}

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
have "\<dots> = prod Suc (insert 0 {Suc 0..<n})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Suc 0 * prod Suc {Suc 0..<n} = prod Suc (insert 0 {Suc 0..<n})
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
Suc 0 * prod Suc {Suc 0..<n} = prod Suc (insert 0 {Suc 0..<n})

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Suc 0 * prod Suc {Suc 0..<n} = prod Suc (insert 0 {Suc 0..<n})

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
have "insert 0 {Suc 0..<n} = {0..<n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. insert 0 {Suc 0..<n} = {0..<n}
[PROOF STEP]
using False
[PROOF STATE]
proof (prove)
using this:
n \<noteq> 0

goal (1 subgoal):
 1. insert 0 {Suc 0..<n} = {0..<n}
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
insert 0 {Suc 0..<n} = {0..<n}

goal (1 subgoal):
 1. n \<noteq> 0 \<Longrightarrow> prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
prod Suc {Suc 0..<n} = prod Suc {0..<n}
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
prod Suc {Suc 0..<n} = prod Suc {0..<n}

goal (1 subgoal):
 1. prod Suc {Suc 0..<n} = fact n
[PROOF STEP]
by (simp add: fact_prod_Suc)
[PROOF STATE]
proof (state)
this:
prod Suc {Suc 0..<n} = fact n

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma openin_trans[trans]:
  "openin (top_of_set T) S \<Longrightarrow> openin (top_of_set U) T \<Longrightarrow>
    openin (top_of_set U) S"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>openin (top_of_set T) S; openin (top_of_set U) T\<rbrakk> \<Longrightarrow> openin (top_of_set U) S
[PROOF STEP]
by (metis openin_Int_open openin_open)


[STATEMENT]
lemma integrable_periodic_offset:
  fixes f :: "real \<Rightarrow> real"
  assumes f: "integrable (lebesgue_on {a..b}) f" and periodic: "\<And>x. f(x + (b-a)) = f x"
  shows "integrable (lebesgue_on {a..b}) (\<lambda>x. f(x + c))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) (\<lambda>x. f (x + c))
[PROOF STEP]
using f has_integral_periodic_offset periodic
[PROOF STATE]
proof (prove)
using this:
integrable (lebesgue_on {a..b}) f
\<lbrakk>has_bochner_integral (lebesgue_on {?a..?b}) ?f ?i; \<And>x. ?f (x + (?b - ?a)) = ?f x\<rbrakk> \<Longrightarrow> has_bochner_integral (lebesgue_on {?a..?b}) (\<lambda>x. ?f (x + ?c)) ?i
f (?x + (b - a)) = f ?x

goal (1 subgoal):
 1. integrable (lebesgue_on {a..b}) (\<lambda>x. f (x + c))
[PROOF STEP]
by (simp add: has_bochner_integral_iff)


[STATEMENT]
lemma hom_deg_set_closed_plus:
  assumes "\<And>a1 a2. a1 \<in> A \<Longrightarrow> a2 \<in> A \<Longrightarrow> a1 + a2 \<in> A"
    and "p \<in> hom_deg_set z A" and "q \<in> hom_deg_set z A"
  shows "p + q \<in> hom_deg_set z A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
from assms(2)
[PROOF STATE]
proof (chain)
picking this:
p \<in> hom_deg_set z A
[PROOF STEP]
obtain a1 where "a1 \<in> A" and p: "p = hom_component a1 z"
[PROOF STATE]
proof (prove)
using this:
p \<in> hom_deg_set z A

goal (1 subgoal):
 1. (\<And>a1. \<lbrakk>a1 \<in> A; p = hom_component a1 z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding hom_deg_set_def
[PROOF STATE]
proof (prove)
using this:
p \<in> (\<lambda>a. hom_component a z) ` A

goal (1 subgoal):
 1. (\<And>a1. \<lbrakk>a1 \<in> A; p = hom_component a1 z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a1 \<in> A
p = hom_component a1 z

goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
from assms(3)
[PROOF STATE]
proof (chain)
picking this:
q \<in> hom_deg_set z A
[PROOF STEP]
obtain a2 where "a2 \<in> A" and q: "q = hom_component a2 z"
[PROOF STATE]
proof (prove)
using this:
q \<in> hom_deg_set z A

goal (1 subgoal):
 1. (\<And>a2. \<lbrakk>a2 \<in> A; q = hom_component a2 z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding hom_deg_set_def
[PROOF STATE]
proof (prove)
using this:
q \<in> (\<lambda>a. hom_component a z) ` A

goal (1 subgoal):
 1. (\<And>a2. \<lbrakk>a2 \<in> A; q = hom_component a2 z\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
a2 \<in> A
q = hom_component a2 z

goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
from \<open>a1 \<in> A\<close> this(1)
[PROOF STATE]
proof (chain)
picking this:
a1 \<in> A
a2 \<in> A
[PROOF STEP]
have "a1 + a2 \<in> A"
[PROOF STATE]
proof (prove)
using this:
a1 \<in> A
a2 \<in> A

goal (1 subgoal):
 1. a1 + a2 \<in> A
[PROOF STEP]
by (rule assms(1))
[PROOF STATE]
proof (state)
this:
a1 + a2 \<in> A

goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
a1 + a2 \<in> A

goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
have "p + q = hom_component (a1 + a2) z"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. p + q = hom_component (a1 + a2) z
[PROOF STEP]
by (simp only: p q hom_component_plus)
[PROOF STATE]
proof (state)
this:
p + q = hom_component (a1 + a2) z

goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
a1 + a2 \<in> A
p + q = hom_component (a1 + a2) z
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
a1 + a2 \<in> A
p + q = hom_component (a1 + a2) z

goal (1 subgoal):
 1. p + q \<in> hom_deg_set z A
[PROOF STEP]
unfolding hom_deg_set_def
[PROOF STATE]
proof (prove)
using this:
a1 + a2 \<in> A
p + q = hom_component (a1 + a2) z

goal (1 subgoal):
 1. p + q \<in> (\<lambda>a. hom_component a z) ` A
[PROOF STEP]
by (rule rev_image_eqI)
[PROOF STATE]
proof (state)
this:
p + q \<in> hom_deg_set z A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma mult_eq_inf:
  assumes "z *\<^sub>h w = \<infinity>\<^sub>h"
  shows "z = \<infinity>\<^sub>h \<or> w = \<infinity>\<^sub>h"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = \<infinity>\<^sub>h
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
z *\<^sub>h w = \<infinity>\<^sub>h

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = \<infinity>\<^sub>h
[PROOF STEP]
using inf_or_of_complex[of z]
[PROOF STATE]
proof (prove)
using this:
z *\<^sub>h w = \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = \<infinity>\<^sub>h
[PROOF STEP]
using inf_or_of_complex[of w]
[PROOF STATE]
proof (prove)
using this:
z *\<^sub>h w = \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)
w = \<infinity>\<^sub>h \<or> (\<exists>x. w = of_complex x)

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = \<infinity>\<^sub>h
[PROOF STEP]
using inf_or_of_complex[of "z *\<^sub>h w"]
[PROOF STATE]
proof (prove)
using this:
z *\<^sub>h w = \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)
w = \<infinity>\<^sub>h \<or> (\<exists>x. w = of_complex x)
z *\<^sub>h w = \<infinity>\<^sub>h \<or> (\<exists>x. z *\<^sub>h w = of_complex x)

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = \<infinity>\<^sub>h
[PROOF STEP]
using of_complex_mult_of_complex
[PROOF STATE]
proof (prove)
using this:
z *\<^sub>h w = \<infinity>\<^sub>h
z = \<infinity>\<^sub>h \<or> (\<exists>x. z = of_complex x)
w = \<infinity>\<^sub>h \<or> (\<exists>x. w = of_complex x)
z *\<^sub>h w = \<infinity>\<^sub>h \<or> (\<exists>x. z *\<^sub>h w = of_complex x)
of_complex ?z1.0 *\<^sub>h of_complex ?z2.0 = of_complex (?z1.0 * ?z2.0)

goal (1 subgoal):
 1. z = \<infinity>\<^sub>h \<or> w = \<infinity>\<^sub>h
[PROOF STEP]
by auto


[STATEMENT]
lemma set_scf_list [simp]:
  assumes "\<forall>i < length xs. scf i > 0"
  shows "set (scf_list scf xs) = set xs"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (scf_list scf xs) = set xs
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
\<forall>i<length xs. 0 < scf i

goal (1 subgoal):
 1. set (scf_list scf xs) = set xs
[PROOF STEP]
by (auto simp: scf_list_def set_zip set_conv_nth[of xs])


[STATEMENT]
lemma wf_set_bits_int_simps: "wf_set_bits_int f \<longleftrightarrow> (\<exists>n. (\<forall>n'\<ge>n. \<not> f n') \<or> (\<forall>n'\<ge>n. f n'))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. wf_set_bits_int f = (\<exists>n. (\<forall>n'\<ge>n. \<not> f n') \<or> (\<forall>n'\<ge>n. f n'))
[PROOF STEP]
by(auto simp add: wf_set_bits_int.simps)


[STATEMENT]
lemma sqrt_nat_floor_code[code]: "sqrt_nat_floor x = sqrt_int_floor_pos (int x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sqrt_nat_floor x = sqrt_int_floor_pos (int x)
[PROOF STEP]
unfolding sqrt_nat_floor_def root_nat_floor_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. root_int_floor_pos 2 (int x) = sqrt_int_floor_pos (int x)
[PROOF STEP]
by simp


[STATEMENT]
lemma interval_real_split:
  "{a .. b::real} \<inter> {x. x \<le> c} = {a .. min b c}"
  "{a .. b} \<inter> {x. c \<le> x} = {max a c .. b}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} \<inter> {x. x \<le> c} = {a..min b c} &&& {a..b} \<inter> {x. c \<le> x} = {max a c..b}
[PROOF STEP]
apply (metis Int_atLeastAtMostL1 atMost_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {a..b} \<inter> {x. c \<le> x} = {max a c..b}
[PROOF STEP]
apply (metis Int_atLeastAtMostL2 atLeast_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma gcd_primitive_part:
  "gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
proof(cases "f = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. f = 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
 2. f \<noteq> 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
f = 0

goal (2 subgoals):
 1. f = 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
 2. f \<noteq> 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
unfolding gcd_poly_decompose[of f g] gcd_0_left primitive_part_0 True
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (primitive_part g) = normalize (primitive_part (normalize g))
[PROOF STEP]
by (simp add: associatedI primitive_part_dvd_primitive_partI)
[PROOF STATE]
proof (state)
this:
gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
f \<noteq> 0

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
have "normalize 1 = normalize (unit_factor (gcd (content f) (content g)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. normalize (1::'a) = normalize (unit_factor (gcd (content f) (content g)))
[PROOF STEP]
by (simp add: False)
[PROOF STATE]
proof (state)
this:
normalize (1::'a) = normalize (unit_factor (gcd (content f) (content g)))

goal (1 subgoal):
 1. f \<noteq> 0 \<Longrightarrow> gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
normalize (1::'a) = normalize (unit_factor (gcd (content f) (content g)))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
normalize (1::'a) = normalize (unit_factor (gcd (content f) (content g)))

goal (1 subgoal):
 1. gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))
[PROOF STEP]
unfolding gcd_poly_decompose[of f g]
[PROOF STATE]
proof (prove)
using this:
normalize (1::'a) = normalize (unit_factor (gcd (content f) (content g)))

goal (1 subgoal):
 1. gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (smult (gcd (content f) (content g)) (gcd (primitive_part f) (primitive_part g))))
[PROOF STEP]
by (metis (no_types) Polynomial.normalize_smult content_gcd_primitive(1)[OF False] content_times_primitive_part normalize_gcd primitive_part_smult)
[PROOF STATE]
proof (state)
this:
gcd (primitive_part f) (primitive_part g) = normalize (primitive_part (gcd f g))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma reverse_arc_in_G:
  assumes "graph G" and "e1 \<in> arcs T"
  shows "\<exists>e2 \<in> arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>e2\<in>arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>e2\<in>arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2
[PROOF STEP]
interpret graph G
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. graph G
[PROOF STEP]
using assms(1)
[PROOF STATE]
proof (prove)
using this:
graph G

goal (1 subgoal):
 1. graph G
[PROOF STEP]
.
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>e2\<in>arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2
[PROOF STEP]
have "e1 \<in> arcs G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. e1 \<in> arcs G
[PROOF STEP]
using assms(2) sub_G
[PROOF STATE]
proof (prove)
using this:
e1 \<in> arcs T
Digraph_Component.subgraph T G

goal (1 subgoal):
 1. e1 \<in> arcs G
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
e1 \<in> arcs G

goal (1 subgoal):
 1. \<exists>e2\<in>arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
e1 \<in> arcs G
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
e1 \<in> arcs G

goal (1 subgoal):
 1. \<exists>e2\<in>arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2
[PROOF STEP]
using sym_arcs symmetric_conv
[PROOF STATE]
proof (prove)
using this:
e1 \<in> arcs G
symmetric G
symmetric ?G = (\<forall>e1\<in>arcs ?G. \<exists>e2\<in>arcs ?G. tail ?G e1 = head ?G e2 \<and> head ?G e1 = tail ?G e2)

goal (1 subgoal):
 1. \<exists>e2\<in>arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
\<exists>e2\<in>arcs G. head G e2 = tail G e1 \<and> head G e1 = tail G e2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma HNatInfinite_upward_closed: "x \<in> HNatInfinite \<Longrightarrow> x \<le> y \<Longrightarrow> y \<in> HNatInfinite"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> HNatInfinite; x \<le> y\<rbrakk> \<Longrightarrow> y \<in> HNatInfinite
[PROOF STEP]
using HNatInfinite_not_Nats_iff Nats_downward_closed
[PROOF STATE]
proof (prove)
using this:
(?x \<in> HNatInfinite) = (?x \<notin> \<nat>)
\<lbrakk>?x \<in> \<nat>; ?y \<le> ?x\<rbrakk> \<Longrightarrow> ?y \<in> \<nat>

goal (1 subgoal):
 1. \<lbrakk>x \<in> HNatInfinite; x \<le> y\<rbrakk> \<Longrightarrow> y \<in> HNatInfinite
[PROOF STEP]
by blast


[STATEMENT]
lemma Rat_closure:
  shows "closure \<rat> = (UNIV :: real set)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closure \<rat> = UNIV
[PROOF STEP]
unfolding closure_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<rat> \<union> {x. x islimpt \<rat>} = UNIV
[PROOF STEP]
using Rat_real_limpt
[PROOF STATE]
proof (prove)
using this:
?x islimpt \<rat>

goal (1 subgoal):
 1. \<rat> \<union> {x. x islimpt \<rat>} = UNIV
[PROOF STEP]
by blast


[STATEMENT]
lemma vconst_on_vunion: "vconst_on (A \<union>\<^sub>\<circ> B) c = vconst_on A c \<union>\<^sub>\<circ> vconst_on B c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. vconst_on (A \<union>\<^sub>\<circ> B) c = vconst_on A c \<union>\<^sub>\<circ> vconst_on B c
[PROOF STEP]
by auto


[STATEMENT]
lemma bernoulli_denom_code [code]:
  "bernoulli_denom n =
     (if n = 1 then 2 else if n = 0 \<or> odd n then 1
        else prod_list (filter (\<lambda>p. (p - 1) dvd n) (primes_upto (n + 1))))" (is "_ = ?rhs")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
proof (cases "even n \<and> n > 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
even n \<and> 0 < n

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
hence "?rhs = prod_list (filter (\<lambda>p. (p - 1) dvd n) (primes_upto (n + 1)))"
[PROOF STATE]
proof (prove)
using this:
even n \<and> 0 < n

goal (1 subgoal):
 1. (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))) = prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))) = prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))) = prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
have "\<dots> = \<Prod>(set (filter (\<lambda>p. (p - 1) dvd n) (primes_upto (n + 1))))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))) = \<Prod>(set (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
by (subst prod.distinct_set_conv_list) auto
[PROOF STATE]
proof (state)
this:
prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))) = \<Prod>(set (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))) = \<Prod>(set (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
have "(set (filter (\<lambda>p. (p - 1) dvd n) (primes_upto (n + 1)))) =
               {p\<in>{..n+1}. prime p \<and> (p - 1) dvd n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. set (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))) = {p \<in> {..n + 1}. prime p \<and> p - 1 dvd n}
[PROOF STEP]
by (auto simp: set_primes_upto)
[PROOF STATE]
proof (state)
this:
set (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))) = {p \<in> {..n + 1}. prime p \<and> p - 1 dvd n}

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
set (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))) = {p \<in> {..n + 1}. prime p \<and> p - 1 dvd n}

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
have "\<dots> = {p. prime p \<and> (p - 1) dvd n}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {p \<in> {..n + 1}. prime p \<and> p - 1 dvd n} = {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
even n \<and> 0 < n

goal (1 subgoal):
 1. {p \<in> {..n + 1}. prime p \<and> p - 1 dvd n} = {p. prime p \<and> p - 1 dvd n}
[PROOF STEP]
by (auto dest: dvd_imp_le)
[PROOF STATE]
proof (state)
this:
{p \<in> {..n + 1}. prime p \<and> p - 1 dvd n} = {p. prime p \<and> p - 1 dvd n}

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
{p \<in> {..n + 1}. prime p \<and> p - 1 dvd n} = {p. prime p \<and> p - 1 dvd n}

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
have "\<Prod>\<dots> = bernoulli_denom n"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Prod>{p. prime p \<and> p - 1 dvd n} = bernoulli_denom n
[PROOF STEP]
using True
[PROOF STATE]
proof (prove)
using this:
even n \<and> 0 < n

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

goal (2 subgoals):
 1. even n \<and> 0 < n \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
 2. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))) = bernoulli_denom n
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1)))) = bernoulli_denom n

goal (1 subgoal):
 1. bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))

goal (1 subgoal):
 1. \<not> (even n \<and> 0 < n) \<Longrightarrow> bernoulli_denom n = (if n = 1 then 2 else if n = 0 \<or> odd n then 1 else prod_list (filter (\<lambda>p. p - 1 dvd n) (primes_upto (n + 1))))
[PROOF STEP]
qed auto


[STATEMENT]
lemma aHom_mem:"\<lbrakk>aGroup F; aGroup G; f \<in> aHom F G; a \<in> carrier F\<rbrakk> \<Longrightarrow>
                       f a \<in> carrier G"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup F; aGroup G; f \<in> aHom F G; a \<in> carrier F\<rbrakk> \<Longrightarrow> f a \<in> carrier G
[PROOF STEP]
apply (simp add:aHom_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup F; aGroup G; f \<in> carrier F \<rightarrow> carrier G \<and> f \<in> extensional (carrier F) \<and> (\<forall>a\<in>carrier F. \<forall>b\<in>carrier F. f (a \<plusminus>\<^bsub>F\<^esub> b) = f a \<plusminus>\<^bsub>G\<^esub> f b); a \<in> carrier F\<rbrakk> \<Longrightarrow> f a \<in> carrier G
[PROOF STEP]
apply (erule conjE)+
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>aGroup F; aGroup G; a \<in> carrier F; f \<in> carrier F \<rightarrow> carrier G; f \<in> extensional (carrier F); \<forall>a\<in>carrier F. \<forall>b\<in>carrier F. f (a \<plusminus>\<^bsub>F\<^esub> b) = f a \<plusminus>\<^bsub>G\<^esub> f b\<rbrakk> \<Longrightarrow> f a \<in> carrier G
[PROOF STEP]
apply (simp add:Pi_def)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma landau_symbol_at_top_imp_at_right_0:
  "(\<lambda>x. f (inverse x)) \<in> L' at_top (\<lambda>x. g (inverse x)) \<Longrightarrow> f \<in> L (at_right 0) g"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f (inverse x)) \<in> L' at_top (\<lambda>x. g (inverse x)) \<Longrightarrow> f \<in> L (at_right 0) g
[PROOF STEP]
by (simp add: in_filtermap_iff at_right_to_top')


[STATEMENT]
lemma convex_on_inverse:
  assumes "A \<subseteq> {0<..}"
  shows "convex_on A (inverse :: real \<Rightarrow> real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. convex_on A inverse
[PROOF STEP]
proof (rule convex_on_subset[OF _ assms], intro convex_on_realI[of _ _ "\<lambda>x. -inverse (x^2)"])
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. connected {0<..}
 2. \<And>x. x \<in> {0<..} \<Longrightarrow> (inverse has_real_derivative - inverse (x\<^sup>2)) (at x)
 3. \<And>x y. \<lbrakk>x \<in> {0<..}; y \<in> {0<..}; x \<le> y\<rbrakk> \<Longrightarrow> - inverse (x\<^sup>2) \<le> - inverse (y\<^sup>2)
[PROOF STEP]
fix u v :: real
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. connected {0<..}
 2. \<And>x. x \<in> {0<..} \<Longrightarrow> (inverse has_real_derivative - inverse (x\<^sup>2)) (at x)
 3. \<And>x y. \<lbrakk>x \<in> {0<..}; y \<in> {0<..}; x \<le> y\<rbrakk> \<Longrightarrow> - inverse (x\<^sup>2) \<le> - inverse (y\<^sup>2)
[PROOF STEP]
assume "u \<in> {0<..}" "v \<in> {0<..}" "u \<le> v"
[PROOF STATE]
proof (state)
this:
u \<in> {0<..}
v \<in> {0<..}
u \<le> v

goal (3 subgoals):
 1. connected {0<..}
 2. \<And>x. x \<in> {0<..} \<Longrightarrow> (inverse has_real_derivative - inverse (x\<^sup>2)) (at x)
 3. \<And>x y. \<lbrakk>x \<in> {0<..}; y \<in> {0<..}; x \<le> y\<rbrakk> \<Longrightarrow> - inverse (x\<^sup>2) \<le> - inverse (y\<^sup>2)
[PROOF STEP]
with assms
[PROOF STATE]
proof (chain)
picking this:
A \<subseteq> {0<..}
u \<in> {0<..}
v \<in> {0<..}
u \<le> v
[PROOF STEP]
show "-inverse (u^2) \<le> -inverse (v^2)"
[PROOF STATE]
proof (prove)
using this:
A \<subseteq> {0<..}
u \<in> {0<..}
v \<in> {0<..}
u \<le> v

goal (1 subgoal):
 1. - inverse (u\<^sup>2) \<le> - inverse (v\<^sup>2)
[PROOF STEP]
by (intro le_imp_neg_le le_imp_inverse_le power_mono) (simp_all)
[PROOF STATE]
proof (state)
this:
- inverse (u\<^sup>2) \<le> - inverse (v\<^sup>2)

goal (2 subgoals):
 1. connected {0<..}
 2. \<And>x. x \<in> {0<..} \<Longrightarrow> (inverse has_real_derivative - inverse (x\<^sup>2)) (at x)
[PROOF STEP]
qed (insert assms, auto intro!: derivative_eq_intros simp: field_split_simps power2_eq_square)


[STATEMENT]
lemma fps_nth_deriv_1[simp]: "fps_nth_deriv n 1 = (if n = 0 then 1 else 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. fps_nth_deriv n 1 = (if n = 0 then 1 else 0)
[PROOF STEP]
by (induct n) simp_all


[STATEMENT]
lemma tensor_mat_scale1:
  assumes "m1 \<in> carrier_mat d1 d1"
    and "m2 \<in> carrier_mat d2 d2"
  shows "tensor_mat (a \<cdot>\<^sub>m m1) m2 = a \<cdot>\<^sub>m tensor_mat m1 m2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. tensor_mat (a \<cdot>\<^sub>m m1) m2 = a \<cdot>\<^sub>m tensor_mat m1 m2
[PROOF STEP]
apply (rule eq_matI, auto)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> tensor_mat (a \<cdot>\<^sub>m m1) m2 $$ (i, j) = a * tensor_mat m1 m2 $$ (i, j)
[PROOF STEP]
unfolding tensor_mat_eval
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (a \<cdot>\<^sub>m m1) $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j) = a * (m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j))
[PROOF STEP]
using assms comm_semiring_class.distrib
[PROOF STATE]
proof (prove)
using this:
m1 \<in> carrier_mat d1 d1
m2 \<in> carrier_mat d2 d2
(?a + ?b) * ?c = ?a * ?c + ?b * ?c

goal (1 subgoal):
 1. \<And>i j. \<lbrakk>i < d; j < d\<rbrakk> \<Longrightarrow> (a \<cdot>\<^sub>m m1) $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j) = a * (m1 $$ (encode1 i, encode1 j) * m2 $$ (encode2 i, encode2 j))
[PROOF STEP]
by force


[STATEMENT]
lemma fls_inverse_X_intpow':
  assumes "inverse 1 = (1::'a::{semiring_1,uminus,inverse})"
  shows   "inverse (fls_X_intpow i :: 'a fls) = fls_X_intpow (-i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. inverse (fls_X_intpow i) = fls_X_intpow (- i)
[PROOF STEP]
using   fls_lr_inverse_X_intpow'(2)[of i 1]
[PROOF STATE]
proof (prove)
using this:
fls_right_inverse (fls_X_intpow i) (1::?'b1) = fls_const (1::?'b1) * fls_X_intpow (- i)

goal (1 subgoal):
 1. inverse (fls_X_intpow i) = fls_X_intpow (- i)
[PROOF STEP]
by      (simp add: fls_inverse_def' assms)


[STATEMENT]
lemma bitAND_sum_lt: "(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b)
                      \<le> (\<Sum>k\<le>length p - 1. Seq k t)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
have "(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b)
        = (\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) = (\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b)
[PROOF STEP]
using bitAND_nth_digit_commute b_def
[PROOF STATE]
proof (prove)
using this:
?b = 2 ^ Suc ?c \<Longrightarrow> nth_digit (?x && ?y) ?t ?b = nth_digit ?x ?t ?b && nth_digit ?y ?t ?b
b = 2 ^ Suc c

goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) = (\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) = (\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b)

goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) = (\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b)

goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
have "... \<le> (\<Sum>k\<le>length p - 1. nth_digit (s k) t b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b) \<le> (\<Sum>k\<le>length p - 1. nth_digit (s k) t b)
[PROOF STEP]
using bitAND_lt
[PROOF STATE]
proof (prove)
using this:
?m && ?n \<le> ?n
?m && ?n \<le> ?m

goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b) \<le> (\<Sum>k\<le>length p - 1. nth_digit (s k) t b)
[PROOF STEP]
by (simp add: sum_mono)
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>length p - 1. nth_digit (s k) t b && nth_digit (x k) t b) \<le> (\<Sum>k\<le>length p - 1. nth_digit (s k) t b)

goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. nth_digit (s k) t b)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. nth_digit (s k) t b)

goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
using Seq_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. nth_digit (s k) t b)
Seq = (\<lambda>k t. nth_digit (s k) t b)

goal (1 subgoal):
 1. (\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(\<Sum>k\<le>length p - 1. nth_digit (s k && x k) t b) \<le> (\<Sum>k\<le>length p - 1. Seq k t)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma independent_explicit_module:
  "independent s \<longleftrightarrow> (\<forall>t u v. finite t \<longrightarrow> t \<subseteq> s \<longrightarrow> (\<Sum>v\<in>t. u v *s v) = 0 \<longrightarrow> v \<in> t \<longrightarrow> u v = 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. independent s = (\<forall>t u v. finite t \<longrightarrow> t \<subseteq> s \<longrightarrow> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<longrightarrow> v \<in> t \<longrightarrow> u v = (0::'a))
[PROOF STEP]
unfolding dependent_explicit
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<nexists>t u. finite t \<and> t \<subseteq> s \<and> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<and> (\<exists>v\<in>t. u v \<noteq> (0::'a))) = (\<forall>t u v. finite t \<longrightarrow> t \<subseteq> s \<longrightarrow> (\<Sum>v\<in>t. u v *s v) = (0::'b) \<longrightarrow> v \<in> t \<longrightarrow> u v = (0::'a))
[PROOF STEP]
by auto


[STATEMENT]
lemma "(a::int) ^ 2 - b ^ 2 = (a - b) * (a + b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. a\<^sup>2 - b\<^sup>2 = (a - b) * (a + b)
[PROOF STEP]
by ring


[STATEMENT]
lemma finite_nonzero_summable: "finite {i. f i \<noteq> 0} \<Longrightarrow> summable f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. finite {i. f i \<noteq> (0::'a)} \<Longrightarrow> summable f
[PROOF STEP]
by (auto intro!: sums_summable sums_finite)


[STATEMENT]
lemma PiE_eq_singleton: "(\<Pi>\<^sub>E i\<in>I. S i) = {\<lambda>i\<in>I. f i} \<longleftrightarrow> (\<forall>i\<in>I. S i = {f i})"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (Pi\<^sub>E I S = {restrict f I}) = (\<forall>i\<in>I. S i = {f i})
[PROOF STEP]
by (metis (mono_tags, lifting) PiE_eq PiE_singleton insert_not_empty restrict_apply' restrict_extensional)


[STATEMENT]
lemma zero_le_float:
  "(0 <= float (a,b)) = (0 <= a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (0 \<le> float (a, b)) = (0 \<le> a)
[PROOF STEP]
by (simp add: float_def zero_le_mult_iff)


[STATEMENT]
lemma prv_imp_neg_imp_cnjR:
  assumes "\<phi> \<in> fmla" "\<phi>1 \<in> fmla" "\<phi>2 \<in> fmla"
    and "prv (imp \<phi> (neg \<phi>2))"
  shows "prv (imp \<phi> (neg (cnj \<phi>1 \<phi>2)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<phi> (neg (cnj \<phi>1 \<phi>2)))
[PROOF STEP]
unfolding neg_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. prv (imp \<phi> (imp (cnj \<phi>1 \<phi>2) fls))
[PROOF STEP]
by (metis assms cnj fls neg neg_def prv_imp_cnj3R prv_prv_imp_trans)


[STATEMENT]
lemma int_of_uint32_plus: "int_of_uint32 (x + y) = (int_of_uint32 x + int_of_uint32 y) mod 4294967296"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. int_of_uint32 (x + y) = (int_of_uint32 x + int_of_uint32 y) mod 4294967296
[PROOF STEP]
by (transfer, unfold uint_word_ariths two_32, rule refl)


[STATEMENT]
lemma "{P} R {> Q} = (\<forall>s t. s \<in> P \<longrightarrow> (s, t) \<in> R \<longrightarrow> t \<in> Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. {P} R {> Q} = (\<forall>s t. s \<in> P \<longrightarrow> (s, t) \<in> R \<longrightarrow> t \<in> Q)
[PROOF STEP]
by (auto simp add: PO_hoare_defs)


[STATEMENT]
lemma fps_compose_uminus':
  "fps_compose f (-fps_X :: 'a :: comm_ring_1 fps) = Abs_fps (\<lambda>n. (-1)^n * f $ n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f oo - fps_X = Abs_fps (\<lambda>n. (- (1::'a)) ^ n * f $ n)
[PROOF STEP]
using fps_compose_linear[of f "-1"]
[PROOF STATE]
proof (prove)
using this:
f oo fps_const (- (1::'a)) * fps_X = Abs_fps (\<lambda>n. (- (1::'a)) ^ n * f $ n)

goal (1 subgoal):
 1. f oo - fps_X = Abs_fps (\<lambda>n. (- (1::'a)) ^ n * f $ n)
[PROOF STEP]
by (simp only: fps_const_neg [symmetric] fps_const_1_eq_1) simp


[STATEMENT]
lemma nat_to_mset_inj:
  assumes "n \<noteq> m"
  shows "(nat_to_mset i n) \<noteq> (nat_to_mset i m)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. nat_to_mset i n \<noteq> nat_to_mset i m
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
n \<noteq> m

goal (1 subgoal):
 1. nat_to_mset i n \<noteq> nat_to_mset i m
[PROOF STEP]
by (metis nat_to_msetE)


[STATEMENT]
theorem th_pr_rec: "\<lbrakk> g \<in> PrimRec1; h \<in> PrimRec3; (\<forall> x. (f 0 x) = (g x)); (\<forall> x y. (f (Suc y) x) = h y (f y x) x) \<rbrakk> \<Longrightarrow> f \<in> PrimRec2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume g_is_pr: "g \<in> PrimRec1"
[PROOF STATE]
proof (state)
this:
g \<in> PrimRec1

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume h_is_pr: "h \<in> PrimRec3"
[PROOF STATE]
proof (state)
this:
h \<in> PrimRec3

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume f_0: "\<forall> x. f 0 x = g x"
[PROOF STATE]
proof (state)
this:
\<forall>x. f 0 x = g x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
assume f_1: "\<forall> x y. (f (Suc y) x) = h y (f y x) x"
[PROOF STATE]
proof (state)
this:
\<forall>x y. f (Suc y) x = h y (f y x) x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
let ?f = "PrimRecOp g h"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
from g_is_pr h_is_pr
[PROOF STATE]
proof (chain)
picking this:
g \<in> PrimRec1
h \<in> PrimRec3
[PROOF STEP]
have S1: "?f \<in> PrimRec2"
[PROOF STATE]
proof (prove)
using this:
g \<in> PrimRec1
h \<in> PrimRec3

goal (1 subgoal):
 1. PrimRecOp g h \<in> PrimRec2
[PROOF STEP]
by (rule pr_rec)
[PROOF STATE]
proof (state)
this:
PrimRecOp g h \<in> PrimRec2

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
have f_2:"\<forall> x. ?f 0 x = g x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x. PrimRecOp g h 0 x = g x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x. PrimRecOp g h 0 x = g x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
have f_3: "\<forall> x y. (?f (Suc y) x) = h y (?f y x) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x y. PrimRecOp g h (Suc y) x = h y (PrimRecOp g h y x) x
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
\<forall>x y. PrimRecOp g h (Suc y) x = h y (PrimRecOp g h y x) x

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
have S2: "f = ?f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f = PrimRecOp g h
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. f = PrimRecOp g h
[PROOF STEP]
have "\<And> x y. f y x = ?f y x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>x y. f y x = PrimRecOp g h y x
[PROOF STEP]
apply(induct_tac y)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. f 0 x = PrimRecOp g h 0 x
 2. \<And>x y n. f n x = PrimRecOp g h n x \<Longrightarrow> f (Suc n) x = PrimRecOp g h (Suc n) x
[PROOF STEP]
apply(insert f_0 f_1)
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. \<And>x y. \<lbrakk>\<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f 0 x = PrimRecOp g h 0 x
 2. \<And>x y n. \<lbrakk>f n x = PrimRecOp g h n x; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f (Suc n) x = PrimRecOp g h (Suc n) x
[PROOF STEP]
apply(auto)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done
[PROOF STATE]
proof (state)
this:
f ?y ?x = PrimRecOp g h ?y ?x

goal (1 subgoal):
 1. f = PrimRecOp g h
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
f ?y ?x = PrimRecOp g h ?y ?x
[PROOF STEP]
show "f = ?f"
[PROOF STATE]
proof (prove)
using this:
f ?y ?x = PrimRecOp g h ?y ?x

goal (1 subgoal):
 1. f = PrimRecOp g h
[PROOF STEP]
by (simp add: ext)
[PROOF STATE]
proof (state)
this:
f = PrimRecOp g h

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f = PrimRecOp g h

goal (1 subgoal):
 1. \<lbrakk>g \<in> PrimRec1; h \<in> PrimRec3; \<forall>x. f 0 x = g x; \<forall>x y. f (Suc y) x = h y (f y x) x\<rbrakk> \<Longrightarrow> f \<in> PrimRec2
[PROOF STEP]
from S1 S2
[PROOF STATE]
proof (chain)
picking this:
PrimRecOp g h \<in> PrimRec2
f = PrimRecOp g h
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
PrimRecOp g h \<in> PrimRec2
f = PrimRecOp g h

goal (1 subgoal):
 1. f \<in> PrimRec2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
f \<in> PrimRec2

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Sup_bind:
  "(\<Squnion>A \<bind> f) = \<Squnion>((\<lambda>x. x \<bind> f) ` A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<Squnion> A \<bind> f = (\<Squnion>x\<in>A. x \<bind> f)
[PROOF STEP]
by (rule pred_eqI) auto