[STATEMENT]
theorem Maschke :
  assumes "GSubspace U"
  shows   "\<exists>W. GSubspace W \<and> V = W \<oplus> U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
proof (cases "V = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
case True
[PROOF STATE]
proof (state)
this:
V = 0

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
V = 0

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
from assms True
[PROOF STATE]
proof (chain)
picking this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
V = 0
[PROOF STEP]
have "U = 0"
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
V = 0

goal (1 subgoal):
 1. U = 0
[PROOF STEP]
using RModule.zero_closed
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
V = 0
RModule ?R ?smult ?M \<Longrightarrow> (0::?'m) \<in> ?M

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

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
V = 0
U = 0
[PROOF STEP]
have "V = 0 + U"
[PROOF STATE]
proof (prove)
using this:
V = 0
U = 0

goal (1 subgoal):
 1. V = 0 + U
[PROOF STEP]
using set_plus_def
[PROOF STATE]
proof (prove)
using this:
V = 0
U = 0
?A + ?B = {c. \<exists>a\<in>?A. \<exists>b\<in>?B. c = a + b}

goal (1 subgoal):
 1. V = 0 + U
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
V = 0 + U

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
V = 0 + U

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
have "add_independentS [0,U]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. add_independentS [0, U]
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
add_independentS [0, U]

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
V = 0 + U
add_independentS [0, U]
[PROOF STEP]
have "V = 0 \<oplus> U"
[PROOF STATE]
proof (prove)
using this:
V = 0 + U
add_independentS [0, U]

goal (1 subgoal):
 1. V = 0 \<oplus> U
[PROOF STEP]
using inner_dirsum_doubleI
[PROOF STATE]
proof (prove)
using this:
V = 0 + U
add_independentS [0, U]
\<lbrakk>?M = ?A + ?B; add_independentS [?A, ?B]\<rbrakk> \<Longrightarrow> ?M = ?A \<oplus> ?B

goal (1 subgoal):
 1. V = 0 \<oplus> U
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
V = 0 \<oplus> U

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
V = 0 \<oplus> U

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
have "GSubspace 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. RModule FG (\<cdot>) 0 \<and> 0 \<subseteq> V
[PROOF STEP]
using trivial_RSubmodule zero_closed
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) 0 \<and> 0 \<subseteq> V
(0::'v) \<in> V

goal (1 subgoal):
 1. RModule FG (\<cdot>) 0 \<and> 0 \<subseteq> V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
RModule FG (\<cdot>) 0 \<and> 0 \<subseteq> V

goal (2 subgoals):
 1. V = 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
 2. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
V = 0 \<oplus> U
RModule FG (\<cdot>) 0 \<and> 0 \<subseteq> V
[PROOF STEP]
show "\<exists>W. GSubspace W \<and> V = W \<oplus> U"
[PROOF STATE]
proof (prove)
using this:
V = 0 \<oplus> U
RModule FG (\<cdot>) 0 \<and> 0 \<subseteq> V

goal (1 subgoal):
 1. \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
case False
[PROOF STATE]
proof (state)
this:
V \<noteq> 0

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
from assms
[PROOF STATE]
proof (chain)
picking this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
[PROOF STEP]
obtain W'
    where W': "VectorSpace.Subspace fsmult V W' \<and> V = W' \<oplus> U"
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V

goal (1 subgoal):
 1. (\<And>W'. (RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using GSubspace_is_Subspace FinDimVectorSpace FinDimVectorSpace.semisimple
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
RModule FG (\<cdot>) ?U \<and> ?U \<subseteq> V \<Longrightarrow> RModule UNIV (\<sharp>\<cdot>) ?U \<and> ?U \<subseteq> V
FinDimVectorSpace (\<sharp>\<cdot>) V
\<lbrakk>FinDimVectorSpace ?smult ?V; RModule UNIV ?smult ?U \<and> ?U \<subseteq> ?V\<rbrakk> \<Longrightarrow> \<exists>W. (RModule UNIV ?smult W \<and> W \<subseteq> ?V) \<and> ?V = W \<oplus> ?U

goal (1 subgoal):
 1. (\<And>W'. (RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by    force
[PROOF STATE]
proof (state)
this:
(RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
hence vsp_W': "VectorSpace fsmult W'" and dirsum: "V = W' \<oplus> U"
[PROOF STATE]
proof (prove)
using this:
(RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U

goal (1 subgoal):
 1. VectorSpace (\<sharp>\<cdot>) W' &&& V = W' \<oplus> U
[PROOF STEP]
using VectorSpace.SubspaceD1[OF fVectorSpace]
[PROOF STATE]
proof (prove)
using this:
(RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U
RModule UNIV (\<sharp>\<cdot>) ?U \<and> ?U \<subseteq> V \<Longrightarrow> VectorSpace (\<sharp>\<cdot>) ?U

goal (1 subgoal):
 1. VectorSpace (\<sharp>\<cdot>) W' &&& V = W' \<oplus> U
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
VectorSpace (\<sharp>\<cdot>) W'
V = W' \<oplus> U

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
from False dirsum
[PROOF STATE]
proof (chain)
picking this:
V \<noteq> 0
V = W' \<oplus> U
[PROOF STEP]
have indS: "add_independentS [W',U]"
[PROOF STATE]
proof (prove)
using this:
V \<noteq> 0
V = W' \<oplus> U

goal (1 subgoal):
 1. add_independentS [W', U]
[PROOF STEP]
using inner_dirsumD2
[PROOF STATE]
proof (prove)
using this:
V \<noteq> 0
V = W' \<oplus> U
\<not> add_independentS ?Ms \<Longrightarrow> (\<Oplus>M\<leftarrow>?Ms. M) = 0

goal (1 subgoal):
 1. add_independentS [W', U]
[PROOF STEP]
by fastforce
[PROOF STATE]
proof (state)
this:
add_independentS [W', U]

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
define P where "P  = (\<Oplus>[W',U]\<down>1)"
[PROOF STATE]
proof (state)
this:
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
define CP where "CP = (\<lambda>g. Gmult (- g) \<circ> P \<circ> Gmult g)"
[PROOF STATE]
proof (state)
this:
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
define S where "S = fsmult (1/ordG) \<circ> (\<Sum>g\<in>G. CP g)"
[PROOF STATE]
proof (state)
this:
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
define W where "W = GroupHom.Ker V (S\<down>V)"
[PROOF STATE]
proof (state)
this:
W = ker (S \<down> V) \<inter> V

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
from assms W' indS S_def CP_def P_def
[PROOF STATE]
proof (chain)
picking this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
(RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U
add_independentS [W', U]
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))
[PROOF STEP]
have endo: "GRepEnd (S\<down>V)"
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
(RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U
add_independentS [W', U]
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))

goal (1 subgoal):
 1. GRepEnd (S \<down> V)
[PROOF STEP]
using FGModuleEnd_avg_proj_right
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
(RModule UNIV (\<sharp>\<cdot>) W' \<and> W' \<subseteq> V) \<and> V = W' \<oplus> U
add_independentS [W', U]
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))
\<lbrakk>RModule UNIV (\<sharp>\<cdot>) ?W \<and> ?W \<subseteq> V; RModule FG (\<cdot>) ?U \<and> ?U \<subseteq> V; add_independentS [?W, ?U]; V = ?W \<oplus> ?U\<rbrakk> \<Longrightarrow> GRepEnd (((\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> (\<Sum>g\<in>G. (*\<cdot>) (- g) \<circ> (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[?W, ?U]. G) then ?W\<oplus>?U\<leftarrow> a ! 1 else (0::'v)) \<circ> (*\<cdot>) g)) \<down> V)

goal (1 subgoal):
 1. GRepEnd (S \<down> V)
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
GRepEnd (S \<down> V)

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
GRepEnd (S \<down> V)

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
from S_def CP_def P_def
[PROOF STATE]
proof (chain)
picking this:
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))
[PROOF STEP]
have "\<And>v. v \<in> V \<Longrightarrow> (S\<down>V) ((S\<down>V) v) = (S\<down>V) v"
[PROOF STATE]
proof (prove)
using this:
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))

goal (1 subgoal):
 1. \<And>v. v \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) v) = (S \<down> V) v
[PROOF STEP]
using endo FGModuleEnd.endomorph
            avg_proj_is_proj_right[OF vsp_W' assms indS dirsum]
[PROOF STATE]
proof (prove)
using this:
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))
GRepEnd (S \<down> V)
FGModuleEnd ?G ?smult ?V ?T \<Longrightarrow> ?T ` ?V \<subseteq> ?V
?v \<in> V \<Longrightarrow> ((\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> (\<Sum>g\<in>G. (*\<cdot>) (- g) \<circ> (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v)) \<circ> (*\<cdot>) g)) (((\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> (\<Sum>g\<in>G. (*\<cdot>) (- g) \<circ> (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v)) \<circ> (*\<cdot>) g)) ?v) = ((\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> (\<Sum>g\<in>G. (*\<cdot>) (- g) \<circ> (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v)) \<circ> (*\<cdot>) g)) ?v

goal (1 subgoal):
 1. \<And>v. v \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) v) = (S \<down> V) v
[PROOF STEP]
by    fastforce
[PROOF STATE]
proof (state)
this:
?v6 \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) ?v6) = (S \<down> V) ?v6

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
?v6 \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) ?v6) = (S \<down> V) ?v6

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
have "(S\<down>V) ` V = U"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<down> V) ` V = U
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (S \<down> V) ` V = U
[PROOF STEP]
from assms indS P_def CP_def S_def dirsum vsp_W'
[PROOF STATE]
proof (chain)
picking this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
add_independentS [W', U]
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
V = W' \<oplus> U
VectorSpace (\<sharp>\<cdot>) W'
[PROOF STEP]
have "S ` V = U"
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
add_independentS [W', U]
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
V = W' \<oplus> U
VectorSpace (\<sharp>\<cdot>) W'

goal (1 subgoal):
 1. S ` V = U
[PROOF STEP]
using avg_proj_onto_right
[PROOF STATE]
proof (prove)
using this:
RModule FG (\<cdot>) U \<and> U \<subseteq> V
add_independentS [W', U]
P = (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[W', U]. G) then W'\<oplus>U\<leftarrow> a ! 1 else (0::'v))
CP = (\<lambda>g. (*\<cdot>) (- g) \<circ> P \<circ> (*\<cdot>) g)
S = (\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> sum CP G
V = W' \<oplus> U
VectorSpace (\<sharp>\<cdot>) W'
\<lbrakk>VectorSpace (\<sharp>\<cdot>) ?W; RModule FG (\<cdot>) ?U \<and> ?U \<subseteq> V; add_independentS [?W, ?U]; V = ?W \<oplus> ?U\<rbrakk> \<Longrightarrow> ((\<sharp>\<cdot>) ((1::'f) / ordG) \<circ> (\<Sum>g\<in>G. (*\<cdot>) (- g) \<circ> (\<lambda>a. if a \<in> (\<Oplus>G\<leftarrow>[?W, ?U]. G) then ?W\<oplus>?U\<leftarrow> a ! 1 else (0::'v)) \<circ> (*\<cdot>) g)) ` V = ?U

goal (1 subgoal):
 1. S ` V = U
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
S ` V = U

goal (1 subgoal):
 1. (S \<down> V) ` V = U
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
S ` V = U

goal (1 subgoal):
 1. (S \<down> V) ` V = U
[PROOF STEP]
have "(S\<down>V) ` V = S ` V"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (S \<down> V) ` V = S ` V
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
(S \<down> V) ` V = S ` V

goal (1 subgoal):
 1. (S \<down> V) ` V = U
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
S ` V = U
(S \<down> V) ` V = S ` V
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
S ` V = U
(S \<down> V) ` V = S ` V

goal (1 subgoal):
 1. (S \<down> V) ` V = U
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
(S \<down> V) ` V = U

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(S \<down> V) ` V = U

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
GRepEnd (S \<down> V)
?v6 \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) ?v6) = (S \<down> V) ?v6
(S \<down> V) ` V = U
[PROOF STEP]
have "V = W \<oplus> U" "GSubspace W"
[PROOF STATE]
proof (prove)
using this:
GRepEnd (S \<down> V)
?v6 \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) ?v6) = (S \<down> V) ?v6
(S \<down> V) ` V = U

goal (1 subgoal):
 1. V = W \<oplus> U &&& RModule FG (\<cdot>) W \<and> W \<subseteq> V
[PROOF STEP]
using W_def FGModuleEnd.proj_decomp[of G smult V "S\<down>V"]
          FGModuleEnd.GSubspace_Ker
[PROOF STATE]
proof (prove)
using this:
GRepEnd (S \<down> V)
?v6 \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) ?v6) = (S \<down> V) ?v6
(S \<down> V) ` V = U
W = ker (S \<down> V) \<inter> V
\<lbrakk>GRepEnd (S \<down> V); \<And>g. g \<in> V \<Longrightarrow> (S \<down> V) ((S \<down> V) g) = (S \<down> V) g\<rbrakk> \<Longrightarrow> V = (ker (S \<down> V) \<inter> V) \<oplus> (S \<down> V) ` V
FGModuleEnd ?G ?smult ?V ?T \<Longrightarrow> RModule (aezfun_setspan ?G) ?smult (ker ?T \<inter> ?V) \<and> ker ?T \<inter> ?V \<subseteq> ?V

goal (1 subgoal):
 1. V = W \<oplus> U &&& RModule FG (\<cdot>) W \<and> W \<subseteq> V
[PROOF STEP]
by    auto
[PROOF STATE]
proof (state)
this:
V = W \<oplus> U
RModule FG (\<cdot>) W \<and> W \<subseteq> V

goal (1 subgoal):
 1. V \<noteq> 0 \<Longrightarrow> \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
V = W \<oplus> U
RModule FG (\<cdot>) W \<and> W \<subseteq> V

goal (1 subgoal):
 1. \<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U
[PROOF STEP]
by fast
[PROOF STATE]
proof (state)
this:
\<exists>W. (RModule FG (\<cdot>) W \<and> W \<subseteq> V) \<and> V = W \<oplus> U

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma cos_eq_arccos_Ex:
  "cos x = y \<longleftrightarrow> -1\<le>y \<and> y\<le>1 \<and> (\<exists>k::int. x = arccos y + 2*k*pi \<or> x = - arccos y + 2*k*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (cos x = y) = (- 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi))
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
 2. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi) \<Longrightarrow> cos x = y
[PROOF STEP]
assume asm:"-1\<le>y \<and> y\<le>1 \<and> (\<exists>k::int. x = arccos y + 2*k*pi \<or> x = - arccos y + 2*k*pi)"
[PROOF STATE]
proof (state)
this:
- 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)

goal (2 subgoals):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
 2. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi) \<Longrightarrow> cos x = y
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
- 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
obtain k::int where "x = arccos y + 2*k*pi \<or> x = - arccos y + 2*k*pi"
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)

goal (1 subgoal):
 1. (\<And>k. x = arccos y + real_of_int (2 * k) * pi \<or> x = - arccos y + real_of_int (2 * k) * pi \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x = arccos y + real_of_int (2 * k) * pi \<or> x = - arccos y + real_of_int (2 * k) * pi

goal (2 subgoals):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
 2. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi) \<Longrightarrow> cos x = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = arccos y + real_of_int (2 * k) * pi \<or> x = - arccos y + real_of_int (2 * k) * pi

goal (2 subgoals):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
 2. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi) \<Longrightarrow> cos x = y
[PROOF STEP]
have "cos x = y" when "x = arccos y + 2*k*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
have "cos x = cos (arccos y + k*(2*pi))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = cos (arccos y + real_of_int k * (2 * pi))
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x = arccos y + real_of_int (2 * k) * pi

goal (1 subgoal):
 1. cos x = cos (arccos y + real_of_int k * (2 * pi))
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
cos x = cos (arccos y + real_of_int k * (2 * pi))

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos x = cos (arccos y + real_of_int k * (2 * pi))

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
have "... = cos (arccos y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arccos y + real_of_int k * (2 * pi)) = cos (arccos y)
[PROOF STEP]
using cos.periodic_simps(3)[of "arccos y" k]
[PROOF STATE]
proof (prove)
using this:
cos (arccos y + real_of_int k * (2 * of_real pi)) = cos (arccos y)

goal (1 subgoal):
 1. cos (arccos y + real_of_int k * (2 * pi)) = cos (arccos y)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (arccos y + real_of_int k * (2 * pi)) = cos (arccos y)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos (arccos y + real_of_int k * (2 * pi)) = cos (arccos y)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
have "... = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arccos y) = y
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)

goal (1 subgoal):
 1. cos (arccos y) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (arccos y) = y

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cos x = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos x = y

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos x = y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = arccos y + real_of_int (2 * k) * pi \<Longrightarrow> cos x = y

goal (2 subgoals):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
 2. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi) \<Longrightarrow> cos x = y
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x = arccos y + real_of_int (2 * k) * pi \<Longrightarrow> cos x = y

goal (2 subgoals):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
 2. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi) \<Longrightarrow> cos x = y
[PROOF STEP]
have "cos x = y" when "x = -arccos y + 2*k*pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
have "cos x = cos (- arccos y + k*2*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos x = cos (- arccos y + real_of_int (k * 2) * pi)
[PROOF STEP]
unfolding that
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (- arccos y + real_of_int (2 * k) * pi) = cos (- arccos y + real_of_int (k * 2) * pi)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
cos x = cos (- arccos y + real_of_int (k * 2) * pi)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos x = cos (- arccos y + real_of_int (k * 2) * pi)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
have "... = cos (arccos y - k*2*pi)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (- arccos y + real_of_int (k * 2) * pi) = cos (arccos y - real_of_int (k * 2) * pi)
[PROOF STEP]
by (metis cos_minus minus_diff_eq uminus_add_conv_diff)
[PROOF STATE]
proof (state)
this:
cos (- arccos y + real_of_int (k * 2) * pi) = cos (arccos y - real_of_int (k * 2) * pi)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos (- arccos y + real_of_int (k * 2) * pi) = cos (arccos y - real_of_int (k * 2) * pi)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
have "... = cos (arccos y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arccos y - real_of_int (k * 2) * pi) = cos (arccos y)
[PROOF STEP]
using cos.periodic_simps(3)[of "arccos y" "-k"]
[PROOF STATE]
proof (prove)
using this:
cos (arccos y + real_of_int (- k) * (2 * of_real pi)) = cos (arccos y)

goal (1 subgoal):
 1. cos (arccos y - real_of_int (k * 2) * pi) = cos (arccos y)
[PROOF STEP]
by (auto simp add:algebra_simps)
[PROOF STATE]
proof (state)
this:
cos (arccos y - real_of_int (k * 2) * pi) = cos (arccos y)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
cos (arccos y - real_of_int (k * 2) * pi) = cos (arccos y)

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
have "... = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (arccos y) = y
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
- 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)

goal (1 subgoal):
 1. cos (arccos y) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos (arccos y) = y

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
cos x = y
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
cos x = y

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
cos x = y

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
x = - arccos y + real_of_int (2 * k) * pi \<Longrightarrow> cos x = y

goal (2 subgoals):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
 2. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi) \<Longrightarrow> cos x = y
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x = arccos y + real_of_int (2 * k) * pi \<or> x = - arccos y + real_of_int (2 * k) * pi
x = arccos y + real_of_int (2 * k) * pi \<Longrightarrow> cos x = y
x = - arccos y + real_of_int (2 * k) * pi \<Longrightarrow> cos x = y
[PROOF STEP]
show "cos x = y"
[PROOF STATE]
proof (prove)
using this:
x = arccos y + real_of_int (2 * k) * pi \<or> x = - arccos y + real_of_int (2 * k) * pi
x = arccos y + real_of_int (2 * k) * pi \<Longrightarrow> cos x = y
x = - arccos y + real_of_int (2 * k) * pi \<Longrightarrow> cos x = y

goal (1 subgoal):
 1. cos x = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
cos x = y

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
assume asm:"cos x =y"
[PROOF STATE]
proof (state)
this:
cos x = y

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
let ?goal = "(\<exists>k::int. x = arccos y + 2*k*pi \<or> x = - arccos y + 2*k*pi)"
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
obtain k::int where k:"-pi < x-k*2*pi" "x-k*2*pi \<le> pi"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
define k where "k=ceiling (x/(2*pi) - 1/2)"
[PROOF STATE]
proof (state)
this:
k = \<lceil>x / (2 * pi) - 1 / 2\<rceil>

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "(x/(2*pi) - 1/2)\<le>k"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x / (2 * pi) - 1 / 2 \<le> real_of_int k
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x / (2 * pi) - 1 / 2 \<le> real_of_int \<lceil>x / (2 * pi) - 1 / 2\<rceil>
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
x / (2 * pi) - 1 / 2 \<le> real_of_int k

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
x / (2 * pi) - 1 / 2 \<le> real_of_int k
[PROOF STEP]
have "x-k*2*pi \<le> pi"
[PROOF STATE]
proof (prove)
using this:
x / (2 * pi) - 1 / 2 \<le> real_of_int k

goal (1 subgoal):
 1. x - real_of_int (k * 2) * pi \<le> pi
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
x - real_of_int (k * 2) * pi \<le> pi

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
x - real_of_int (k * 2) * pi \<le> pi

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
have "k-1 < x/(2*pi) - 1/2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (k - 1) < x / (2 * pi) - 1 / 2
[PROOF STEP]
unfolding k_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. real_of_int (\<lceil>x / (2 * pi) - 1 / 2\<rceil> - 1) < x / (2 * pi) - 1 / 2
[PROOF STEP]
by linarith
[PROOF STATE]
proof (state)
this:
real_of_int (k - 1) < x / (2 * pi) - 1 / 2

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
real_of_int (k - 1) < x / (2 * pi) - 1 / 2
[PROOF STEP]
have "-pi < x-k*2*pi"
[PROOF STATE]
proof (prove)
using this:
real_of_int (k - 1) < x / (2 * pi) - 1 / 2

goal (1 subgoal):
 1. - pi < x - real_of_int (k * 2) * pi
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
- pi < x - real_of_int (k * 2) * pi

goal (1 subgoal):
 1. (\<And>k. \<lbrakk>- pi < x - real_of_int (k * 2) * pi; x - real_of_int (k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
x - real_of_int (k * 2) * pi \<le> pi
- pi < x - real_of_int (k * 2) * pi
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
x - real_of_int (k * 2) * pi \<le> pi
- pi < x - real_of_int (k * 2) * pi

goal (1 subgoal):
 1. thesis
[PROOF STEP]
using that
[PROOF STATE]
proof (prove)
using this:
x - real_of_int (k * 2) * pi \<le> pi
- pi < x - real_of_int (k * 2) * pi
\<lbrakk>- pi < x - real_of_int (?k * 2) * pi; x - real_of_int (?k * 2) * pi \<le> pi\<rbrakk> \<Longrightarrow> thesis

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
- pi < x - real_of_int (k * 2) * pi
x - real_of_int (k * 2) * pi \<le> pi

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
have ?goal when "x-k*2*pi\<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
have "cos (x - k * 2*pi) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
using cos.periodic_simps(3)[of x "-k"] asm
[PROOF STATE]
proof (prove)
using this:
cos (x + real_of_int (- k) * (2 * of_real pi)) = cos x
cos x = y

goal (1 subgoal):
 1. cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
cos (x - real_of_int (k * 2) * pi) = y

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
have "arccos y = x - k * 2*pi"
[PROOF STATE]
proof (prove)
using this:
cos (x - real_of_int (k * 2) * pi) = y

goal (1 subgoal):
 1. arccos y = x - real_of_int (k * 2) * pi
[PROOF STEP]
apply (intro arccos_unique)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. cos (x - real_of_int (k * 2) * pi) = y \<Longrightarrow> 0 \<le> x - real_of_int (k * 2) * pi
 2. cos (x - real_of_int (k * 2) * pi) = y \<Longrightarrow> x - real_of_int (k * 2) * pi \<le> pi
 3. cos (x - real_of_int (k * 2) * pi) = y \<Longrightarrow> cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
using k that
[PROOF STATE]
proof (prove)
using this:
- pi < x - real_of_int (k * 2) * pi
x - real_of_int (k * 2) * pi \<le> pi
0 \<le> x - real_of_int (k * 2) * pi

goal (3 subgoals):
 1. cos (x - real_of_int (k * 2) * pi) = y \<Longrightarrow> 0 \<le> x - real_of_int (k * 2) * pi
 2. cos (x - real_of_int (k * 2) * pi) = y \<Longrightarrow> x - real_of_int (k * 2) * pi \<le> pi
 3. cos (x - real_of_int (k * 2) * pi) = y \<Longrightarrow> cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
arccos y = x - real_of_int (k * 2) * pi

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
arccos y = x - real_of_int (k * 2) * pi
[PROOF STEP]
show ?goal
[PROOF STATE]
proof (prove)
using this:
arccos y = x - real_of_int (k * 2) * pi

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
0 \<le> x - real_of_int (k * 2) * pi \<Longrightarrow> \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
0 \<le> x - real_of_int (k * 2) * pi \<Longrightarrow> \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
have ?goal when "\<not> x-k*2*pi \<ge>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
have "cos (x - k * 2*pi) = y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
using cos.periodic_simps(3)[of x "-k"] asm
[PROOF STATE]
proof (prove)
using this:
cos (x + real_of_int (- k) * (2 * of_real pi)) = cos x
cos x = y

goal (1 subgoal):
 1. cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
by (auto simp add:field_simps)
[PROOF STATE]
proof (state)
this:
cos (x - real_of_int (k * 2) * pi) = y

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cos (x - real_of_int (k * 2) * pi) = y
[PROOF STEP]
have "cos (k * 2*pi - x) = y"
[PROOF STATE]
proof (prove)
using this:
cos (x - real_of_int (k * 2) * pi) = y

goal (1 subgoal):
 1. cos (real_of_int (k * 2) * pi - x) = y
[PROOF STEP]
by (metis cos_minus minus_diff_eq)
[PROOF STATE]
proof (state)
this:
cos (real_of_int (k * 2) * pi - x) = y

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
cos (real_of_int (k * 2) * pi - x) = y
[PROOF STEP]
have "arccos y = k * 2*pi - x"
[PROOF STATE]
proof (prove)
using this:
cos (real_of_int (k * 2) * pi - x) = y

goal (1 subgoal):
 1. arccos y = real_of_int (k * 2) * pi - x
[PROOF STEP]
apply (intro arccos_unique)
[PROOF STATE]
proof (prove)
goal (3 subgoals):
 1. cos (real_of_int (k * 2) * pi - x) = y \<Longrightarrow> 0 \<le> real_of_int (k * 2) * pi - x
 2. cos (real_of_int (k * 2) * pi - x) = y \<Longrightarrow> real_of_int (k * 2) * pi - x \<le> pi
 3. cos (real_of_int (k * 2) * pi - x) = y \<Longrightarrow> cos (real_of_int (k * 2) * pi - x) = y
[PROOF STEP]
using k that
[PROOF STATE]
proof (prove)
using this:
- pi < x - real_of_int (k * 2) * pi
x - real_of_int (k * 2) * pi \<le> pi
\<not> 0 \<le> x - real_of_int (k * 2) * pi

goal (3 subgoals):
 1. cos (real_of_int (k * 2) * pi - x) = y \<Longrightarrow> 0 \<le> real_of_int (k * 2) * pi - x
 2. cos (real_of_int (k * 2) * pi - x) = y \<Longrightarrow> real_of_int (k * 2) * pi - x \<le> pi
 3. cos (real_of_int (k * 2) * pi - x) = y \<Longrightarrow> cos (real_of_int (k * 2) * pi - x) = y
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
arccos y = real_of_int (k * 2) * pi - x

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
arccos y = real_of_int (k * 2) * pi - x
[PROOF STEP]
show ?goal
[PROOF STATE]
proof (prove)
using this:
arccos y = real_of_int (k * 2) * pi - x

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<not> 0 \<le> x - real_of_int (k * 2) * pi \<Longrightarrow> \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
0 \<le> x - real_of_int (k * 2) * pi \<Longrightarrow> \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
\<not> 0 \<le> x - real_of_int (k * 2) * pi \<Longrightarrow> \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
have ?goal
[PROOF STATE]
proof (prove)
using this:
0 \<le> x - real_of_int (k * 2) * pi \<Longrightarrow> \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
\<not> 0 \<le> x - real_of_int (k * 2) * pi \<Longrightarrow> \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal (1 subgoal):
 1. \<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
have "-1\<le>y \<and> y\<le>1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - 1 \<le> y \<and> y \<le> 1
[PROOF STEP]
using asm
[PROOF STATE]
proof (prove)
using this:
cos x = y

goal (1 subgoal):
 1. - 1 \<le> y \<and> y \<le> 1
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- 1 \<le> y \<and> y \<le> 1

goal (1 subgoal):
 1. cos x = y \<Longrightarrow> - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
- 1 \<le> y \<and> y \<le> 1
[PROOF STEP]
show "-1\<le>y \<and> y\<le>1 \<and> ?goal"
[PROOF STATE]
proof (prove)
using this:
\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi
- 1 \<le> y \<and> y \<le> 1

goal (1 subgoal):
 1. - 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
- 1 \<le> y \<and> y \<le> 1 \<and> (\<exists>xa. x = arccos y + 2 * real_of_int xa * pi \<or> x = - arccos y + 2 * real_of_int xa * pi)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma "x + (y + z) = y + (z + (x::int))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. x + (y + z) = y + (z + x)
[PROOF STEP]
by (smt (verit))


[STATEMENT]
lemma "<emp> kruskal_checked L <\<lambda>
    Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L
       \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L)
           (uGraph_from_list_\<alpha>_edges F))
  | None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L)>\<^sub>t"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <emp> kruskal_checked L <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
unfolding kruskal_checked_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <emp> if uGraph_from_list_invar L then kruskal' L \<bind> (\<lambda>F. return (Some F)) else return None <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
apply(cases "uGraph_from_list_invar L")
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> if uGraph_from_list_invar L then kruskal' L \<bind> (\<lambda>F. return (Some F)) else return None <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
 2. \<not> uGraph_from_list_invar L \<Longrightarrow> <emp> if uGraph_from_list_invar L then kruskal' L \<bind> (\<lambda>F. return (Some F)) else return None <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
apply simp_all
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal' L \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
 2. \<not> uGraph_from_list_invar L \<Longrightarrow> <emp> return None <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal' L \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal' L \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
assume [simp]: "uGraph_from_list_invar L"
[PROOF STATE]
proof (state)
this:
uGraph_from_list_invar L

goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal' L \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
uGraph_from_list_invar L
[PROOF STEP]
interpret fromlist L
[PROOF STATE]
proof (prove)
using this:
uGraph_from_list_invar L

goal (1 subgoal):
 1. fromlist L
[PROOF STEP]
apply unfold_locales
[PROOF STATE]
proof (prove)
goal (2 subgoals):
 1. uGraph_from_list_invar L \<Longrightarrow> distinct (map \<alpha> L)
 2. uGraph_from_list_invar L \<Longrightarrow> \<forall>u w v. (u, w, v) \<in> set L \<longrightarrow> u \<noteq> v
[PROOF STEP]
by(auto simp: uGraph_from_list_invar_def)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. uGraph_from_list_invar L \<Longrightarrow> <emp> kruskal' L \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> minSpanningForest (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <emp> kruskal' L \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> minSpanningForest (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
unfolding kruskal'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. <emp> kruskal (return L) (\<lambda>(u, w, v). return (u, v)) () \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> minSpanningForest (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
by (sep_auto heap: kruskal_correct)
[PROOF STATE]
proof (state)
this:
<emp> kruskal' L \<bind> (\<lambda>F. return (Some F)) <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> minSpanningForest (uGraph_from_list_\<alpha>_edges F))>\<^sub>t

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> uGraph_from_list_invar L \<Longrightarrow> <emp> return None <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
subgoal
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> uGraph_from_list_invar L \<Longrightarrow> <emp> return None <\<lambda>r. case r of None \<Rightarrow> \<up> (\<not> uGraph_from_list_invar L) | Some F \<Rightarrow> \<up> (uGraph_from_list_invar L \<and> set F \<subseteq> set L \<and> uGraph.minSpanningForest (uGraph_from_list_\<alpha>_edges L) (uGraph_from_list_\<alpha>_weight L) (uGraph_from_list_\<alpha>_edges F))>\<^sub>t
[PROOF STEP]
by sep_auto
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma lproject_lfinite[simp]: "lfinite (lproject A w) \<longleftrightarrow> finite (liset A w)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. lfinite (lproject A w) = finite (liset A w)
[PROOF STEP]
using lproject_llength esize_iff_infinite llength_eq_infty_conv_lfinite
[PROOF STATE]
proof (prove)
using this:
llength (lproject ?A ?w) = esize (liset ?A ?w)
(esize ?A = \<infinity>) = infinite ?A
(llength ?xs = \<infinity>) = linfinite ?xs

goal (1 subgoal):
 1. lfinite (lproject A w) = finite (liset A w)
[PROOF STEP]
by metis


[STATEMENT]
lemma zip_fill2:
  assumes "length ts < length ss"
  shows "zip_fill ss ts = zip (map Some (take (length ts) ss)) (map Some ts) @
    map (\<lambda> x. (Some x, None)) (drop (length ts) ss)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. zip_fill ss ts = zip (map Some (take (length ts) ss)) (map Some ts) @ map (\<lambda>x. (Some x, None)) (drop (length ts) ss)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
length ts < length ss

goal (1 subgoal):
 1. zip_fill ss ts = zip (map Some (take (length ts) ss)) (map Some ts) @ map (\<lambda>x. (Some x, None)) (drop (length ts) ss)
[PROOF STEP]
by (auto simp: zip_fill_def list_eq_iff_nth_eq nth_append simp add: min.absorb2)


[STATEMENT]
lemma sigma_sets_eqI:
  assumes A: "\<And>a. a \<in> A \<Longrightarrow> a \<in> sigma_sets M B"
  assumes B: "\<And>b. b \<in> B \<Longrightarrow> b \<in> sigma_sets M A"
  shows "sigma_sets M A = sigma_sets M B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sigma_sets M A = sigma_sets M B
[PROOF STEP]
proof (intro set_eqI iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> sigma_sets M A \<Longrightarrow> x \<in> sigma_sets M B
 2. \<And>x. x \<in> sigma_sets M B \<Longrightarrow> x \<in> sigma_sets M A
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>x. x \<in> sigma_sets M A \<Longrightarrow> x \<in> sigma_sets M B
 2. \<And>x. x \<in> sigma_sets M B \<Longrightarrow> x \<in> sigma_sets M A
[PROOF STEP]
assume "a \<in> sigma_sets M A"
[PROOF STATE]
proof (state)
this:
a \<in> sigma_sets M A

goal (2 subgoals):
 1. \<And>x. x \<in> sigma_sets M A \<Longrightarrow> x \<in> sigma_sets M B
 2. \<And>x. x \<in> sigma_sets M B \<Longrightarrow> x \<in> sigma_sets M A
[PROOF STEP]
from this A
[PROOF STATE]
proof (chain)
picking this:
a \<in> sigma_sets M A
?a \<in> A \<Longrightarrow> ?a \<in> sigma_sets M B
[PROOF STEP]
show "a \<in> sigma_sets M B"
[PROOF STATE]
proof (prove)
using this:
a \<in> sigma_sets M A
?a \<in> A \<Longrightarrow> ?a \<in> sigma_sets M B

goal (1 subgoal):
 1. a \<in> sigma_sets M B
[PROOF STEP]
by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic)
[PROOF STATE]
proof (state)
this:
a \<in> sigma_sets M B

goal (1 subgoal):
 1. \<And>x. x \<in> sigma_sets M B \<Longrightarrow> x \<in> sigma_sets M A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sigma_sets M B \<Longrightarrow> x \<in> sigma_sets M A
[PROOF STEP]
fix b
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<in> sigma_sets M B \<Longrightarrow> x \<in> sigma_sets M A
[PROOF STEP]
assume "b \<in> sigma_sets M B"
[PROOF STATE]
proof (state)
this:
b \<in> sigma_sets M B

goal (1 subgoal):
 1. \<And>x. x \<in> sigma_sets M B \<Longrightarrow> x \<in> sigma_sets M A
[PROOF STEP]
from this B
[PROOF STATE]
proof (chain)
picking this:
b \<in> sigma_sets M B
?b \<in> B \<Longrightarrow> ?b \<in> sigma_sets M A
[PROOF STEP]
show "b \<in> sigma_sets M A"
[PROOF STATE]
proof (prove)
using this:
b \<in> sigma_sets M B
?b \<in> B \<Longrightarrow> ?b \<in> sigma_sets M A

goal (1 subgoal):
 1. b \<in> sigma_sets M A
[PROOF STEP]
by induct (auto intro!: sigma_sets.intros(2-) del: sigma_sets.Basic)
[PROOF STATE]
proof (state)
this:
b \<in> sigma_sets M A

goal:
No subgoals!
[PROOF STEP]
qed