[STATEMENT]
theorem (in encoding) fully_abstract_wrt_preorders_iff_source_target_relation_is_trans:
  fixes SRel :: "('procS \<times> 'procS) set"
    and TRel :: "('procT \<times> 'procT) set"
  shows "(fully_abstract SRel TRel \<and> refl SRel \<and> trans TRel) =
         (\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel
                      \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel)
                \<and> SRel = {(S1, S2). (SourceTerm S1, SourceTerm S2) \<in> Rel}
                \<and> TRel = {(T1, T2). (TargetTerm T1, TargetTerm T2) \<in> Rel}
                \<and> trans Rel)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel) = (\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel)
[PROOF STEP]
proof (rule iffI)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel \<Longrightarrow> \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel
 2. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
assume "fully_abstract SRel TRel \<and> refl SRel \<and> trans TRel"
[PROOF STATE]
proof (state)
this:
(\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel

goal (2 subgoals):
 1. (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel \<Longrightarrow> \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel
 2. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
thus "\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel)
                \<and> SRel = {(S1, S2). (SourceTerm S1, SourceTerm S2) \<in> Rel}
                \<and> TRel = {(T1, T2). (TargetTerm T1, TargetTerm T2) \<in> Rel}
                \<and> trans Rel"
[PROOF STATE]
proof (prove)
using this:
(\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel
[PROOF STEP]
using full_abstraction_wrt_preorders_impl_trans_source_target_relation[where SRel="SRel"
              and TRel="TRel"]
[PROOF STATE]
proof (prove)
using this:
(\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
(\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel \<Longrightarrow> \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
assume "\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel
                 \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel)
                \<and> SRel = {(S1, S2). (SourceTerm S1, SourceTerm S2) \<in> Rel}
                \<and> TRel = {(T1, T2). (TargetTerm T1, TargetTerm T2) \<in> Rel}
                \<and> trans Rel"
[PROOF STATE]
proof (state)
this:
\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
from this
[PROOF STATE]
proof (chain)
picking this:
\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel
[PROOF STEP]
obtain Rel
    where A1: "\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel"
      and A2: "SRel = {(S1, S2). (SourceTerm S1, SourceTerm S2) \<in> Rel}"
      and A3: "TRel = {(T1, T2). (TargetTerm T1, TargetTerm T2) \<in> Rel}" and A4: "trans Rel"
[PROOF STATE]
proof (prove)
using this:
\<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel

goal (1 subgoal):
 1. (\<And>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel)
TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel)
trans Rel

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
hence "fully_abstract SRel TRel"
[PROOF STATE]
proof (prove)
using this:
\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel)
TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel)
trans Rel

goal (1 subgoal):
 1. \<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)
[PROOF STEP]
using trans_source_target_relation_impl_full_abstraction[where Rel="Rel"]
[PROOF STATE]
proof (prove)
using this:
\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel)
TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel)
trans Rel
(\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> trans Rel \<Longrightarrow> \<forall>S1 S2. ((S1, S2) \<in> _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel)) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel))

goal (1 subgoal):
 1. \<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
have "refl SRel"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. refl SRel
[PROOF STEP]
unfolding refl_on_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. SRel \<subseteq> UNIV \<times> UNIV \<and> (\<forall>x\<in>UNIV. (x, x) \<in> SRel)
[PROOF STEP]
proof auto
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x, x) \<in> SRel
[PROOF STEP]
fix S
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. (x, x) \<in> SRel
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
[PROOF STEP]
have "(SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel"
[PROOF STATE]
proof (prove)
using this:
\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel

goal (1 subgoal):
 1. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel

goal (1 subgoal):
 1. \<And>x. (x, x) \<in> SRel
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
(SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel

goal (1 subgoal):
 1. \<And>x. (x, x) \<in> SRel
[PROOF STEP]
from A1
[PROOF STATE]
proof (chain)
picking this:
\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
[PROOF STEP]
have "(TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel"
[PROOF STATE]
proof (prove)
using this:
\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel

goal (1 subgoal):
 1. (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel

goal (1 subgoal):
 1. \<And>x. (x, x) \<in> SRel
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
(SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel
(TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
[PROOF STEP]
have "(SourceTerm S, SourceTerm S) \<in> Rel"
[PROOF STATE]
proof (prove)
using this:
(SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel
(TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel

goal (1 subgoal):
 1. (SourceTerm S, SourceTerm S) \<in> Rel
[PROOF STEP]
using A4
[PROOF STATE]
proof (prove)
using this:
(SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel
(TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
trans Rel

goal (1 subgoal):
 1. (SourceTerm S, SourceTerm S) \<in> Rel
[PROOF STEP]
unfolding trans_def
[PROOF STATE]
proof (prove)
using this:
(SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel
(TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel
\<forall>x y z. (x, y) \<in> Rel \<longrightarrow> (y, z) \<in> Rel \<longrightarrow> (x, z) \<in> Rel

goal (1 subgoal):
 1. (SourceTerm S, SourceTerm S) \<in> Rel
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(SourceTerm S, SourceTerm S) \<in> Rel

goal (1 subgoal):
 1. \<And>x. (x, x) \<in> SRel
[PROOF STEP]
with A2
[PROOF STATE]
proof (chain)
picking this:
SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel)
(SourceTerm S, SourceTerm S) \<in> Rel
[PROOF STEP]
show "(S, S) \<in> SRel"
[PROOF STATE]
proof (prove)
using this:
SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel)
(SourceTerm S, SourceTerm S) \<in> Rel

goal (1 subgoal):
 1. (S, S) \<in> SRel
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(S, S) \<in> SRel

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

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
refl SRel

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
from A3 A4
[PROOF STATE]
proof (chain)
picking this:
TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel)
trans Rel
[PROOF STEP]
have "trans TRel"
[PROOF STATE]
proof (prove)
using this:
TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel)
trans Rel

goal (1 subgoal):
 1. trans TRel
[PROOF STEP]
unfolding trans_def
[PROOF STATE]
proof (prove)
using this:
TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel)
\<forall>x y z. (x, y) \<in> Rel \<longrightarrow> (y, z) \<in> Rel \<longrightarrow> (x, z) \<in> Rel

goal (1 subgoal):
 1. \<forall>x y z. (x, y) \<in> TRel \<longrightarrow> (y, z) \<in> TRel \<longrightarrow> (x, z) \<in> TRel
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
trans TRel

goal (1 subgoal):
 1. \<exists>Rel. (\<forall>S. (SourceTerm S, TargetTerm (\<lbrakk>S\<rbrakk>)) \<in> Rel \<and> (TargetTerm (\<lbrakk>S\<rbrakk>), SourceTerm S) \<in> Rel) \<and> SRel = _Collect (S1, S2) ((SourceTerm S1, SourceTerm S2) \<in> Rel) \<and> TRel = _Collect (T1, T2) ((TargetTerm T1, TargetTerm T2) \<in> Rel) \<and> trans Rel \<Longrightarrow> (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)
refl SRel
trans TRel
[PROOF STEP]
show "fully_abstract SRel TRel \<and> refl SRel \<and> trans TRel"
[PROOF STATE]
proof (prove)
using this:
\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)
refl SRel
trans TRel

goal (1 subgoal):
 1. (\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
(\<forall>S1 S2. ((S1, S2) \<in> SRel) = ((\<lbrakk>S1\<rbrakk>, \<lbrakk>S2\<rbrakk>) \<in> TRel)) \<and> refl SRel \<and> trans TRel

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma Liminf_at:
  fixes f :: "'a::metric_space \<Rightarrow> 'b::complete_lattice"
  shows "Liminf (at x) f = (SUP e\<in>{0<..}. INF y\<in>(ball x e - {x}). f y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Liminf (at x) f = (SUP e\<in>{0<..}. Inf (f ` (ball x e - {x})))
[PROOF STEP]
using Liminf_within[of x UNIV f]
[PROOF STATE]
proof (prove)
using this:
Liminf (at x) f = (SUP e\<in>{0<..}. Inf (f ` (UNIV \<inter> ball x e - {x})))

goal (1 subgoal):
 1. Liminf (at x) f = (SUP e\<in>{0<..}. Inf (f ` (ball x e - {x})))
[PROOF STEP]
by simp


[STATEMENT]
lemma set_times_image: "S * T = (\<lambda>(x, y). x * y) ` (S \<times> T)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. S * T = (\<lambda>(x, y). x * y) ` (S \<times> T)
[PROOF STEP]
by (fastforce simp: set_times_def image_iff)


[STATEMENT]
lemma polyfun_linear_factor_root:  (*COMPLEX_POLYFUN_LINEAR_FACTOR_ROOT in HOL Light*)
  fixes a :: "'a::idom"
  assumes "(\<Sum>i\<le>n. c(i) * a^i) = 0"
  obtains b where "\<And>z. (\<Sum>i\<le>n. c i * z^i) = (z - a) * (\<Sum>i<n. b i * z^i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>b. (\<And>z. (\<Sum>i\<le>n. c i * z ^ i) = (z - a) * (\<Sum>i<n. b i * z ^ i)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using polyfun_linear_factor [of c n a] assms
[PROOF STATE]
proof (prove)
using this:
\<exists>b. \<forall>z. (\<Sum>i\<le>n. c i * z ^ i) = (z - a) * (\<Sum>i<n. b i * z ^ i) + (\<Sum>i\<le>n. c i * a ^ i)
(\<Sum>i\<le>n. c i * a ^ i) = (0::'a)

goal (1 subgoal):
 1. (\<And>b. (\<And>z. (\<Sum>i\<le>n. c i * z ^ i) = (z - a) * (\<Sum>i<n. b i * z ^ i)) \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto


[STATEMENT]
lemma DERIV_mult':
  "(f has_field_derivative D) (at x within s) \<Longrightarrow> (g has_field_derivative E) (at x within s) \<Longrightarrow>
    ((\<lambda>x. f x * g x) has_field_derivative f x * E + D * g x) (at x within s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>(f has_field_derivative D) (at x within s); (g has_field_derivative E) (at x within s)\<rbrakk> \<Longrightarrow> ((\<lambda>x. f x * g x) has_field_derivative f x * E + D * g x) (at x within s)
[PROOF STEP]
by (rule has_derivative_imp_has_field_derivative[OF has_derivative_mult])
     (auto simp: field_simps mult_commute_abs dest: has_field_derivative_imp_has_derivative)


[STATEMENT]
lemma gbinomial_absorption': "k > 0 \<Longrightarrow> a gchoose k = (a / of_nat k) * (a - 1 gchoose (k - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 < k \<Longrightarrow> a gchoose k = a / of_nat k * (a - (1::'a) gchoose (k - 1))
[PROOF STEP]
using gbinomial_rec[of "a - 1" "k - 1"]
[PROOF STATE]
proof (prove)
using this:
a - (1::'a) + (1::'a) gchoose Suc (k - 1) = (a - (1::'a) gchoose (k - 1)) * ((a - (1::'a) + (1::'a)) / of_nat (Suc (k - 1)))

goal (1 subgoal):
 1. 0 < k \<Longrightarrow> a gchoose k = a / of_nat k * (a - (1::'a) gchoose (k - 1))
[PROOF STEP]
by (simp_all add: gbinomial_rec field_simps del: of_nat_Suc)


[STATEMENT]
lemma mat_mod_count_col_eq: "j < dim_col M \<Longrightarrow> elements_mat M \<subseteq> {0..<m} \<Longrightarrow>
    count_vec (col (mat_mod M) j) x = count_vec (col M j) x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>j < dim_col M; elements_mat M \<subseteq> {0..<m}\<rbrakk> \<Longrightarrow> count_vec (col (local.mat_mod M) j) x = count_vec (col M j) x
[PROOF STEP]
using count_vec_mod_eq mat_mod_vec_mod_col elems_mat_setv_col_0m
[PROOF STATE]
proof (prove)
using this:
set\<^sub>v ?v \<subseteq> {0..<m} \<Longrightarrow> count_vec ?v ?x = count_vec (vec_mod ?v) ?x
?j < dim_col ?A \<Longrightarrow> col (local.mat_mod ?A) ?j = vec_mod (col ?A ?j)
\<lbrakk>?j < dim_col ?M; elements_mat ?M \<subseteq> {0..<m}\<rbrakk> \<Longrightarrow> set\<^sub>v (col ?M ?j) \<subseteq> {0..<m}

goal (1 subgoal):
 1. \<lbrakk>j < dim_col M; elements_mat M \<subseteq> {0..<m}\<rbrakk> \<Longrightarrow> count_vec (col (local.mat_mod M) j) x = count_vec (col M j) x
[PROOF STEP]
by simp


[STATEMENT]
lemma DERIV_powr:
  fixes r :: real
  assumes g: "DERIV g x :> m"
    and pos: "g x > 0"
    and f: "DERIV f x :> r"
  shows "DERIV (\<lambda>x. g x powr f x) x :> (g x powr f x) * (r * ln (g x) + m * f x / g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<lambda>x. g x powr f x) has_real_derivative g x powr f x * (r * ln (g x) + m * f x / g x)) (at x)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(g has_real_derivative m) (at x)
0 < g x
(f has_real_derivative r) (at x)

goal (1 subgoal):
 1. ((\<lambda>x. g x powr f x) has_real_derivative g x powr f x * (r * ln (g x) + m * f x / g x)) (at x)
[PROOF STEP]
by (auto intro!: derivative_eq_intros ext simp: has_field_derivative_def algebra_simps)


[STATEMENT]
lemma condition_4_part_3:
  fixes A::"'a::{field}^'columns::{mod_type}^'rows::{mod_type}" and k::nat
  defines ia:"ia\<equiv>(if \<forall>m. is_zero_row_upt_k m k A then 0 else to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1)"
  defines B:"B\<equiv>(snd (Gauss_Jordan_column_k (ia,A) k))"
  assumes rref: "reduced_row_echelon_form_upt_k A k"
  and not_zero_i_suc_k:  "\<not> is_zero_row_upt_k i (Suc k) B"
  and i_not_j: "i \<noteq> j"
  and not_zero_m: " \<not> is_zero_row_upt_k m k A"
  and zero_below_greatest: "\<forall>m\<ge>(GREATEST n. \<not> is_zero_row_upt_k n k A) + 1. A $ m $ from_nat k = 0"
  shows "A $ j $ (LEAST n. A $ i $ n \<noteq> 0) = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
have ia2: "ia=to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ia = mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
[PROOF STEP]
unfolding ia
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1) = mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
[PROOF STEP]
using not_zero_m
[PROOF STATE]
proof (prove)
using this:
\<not> is_zero_row_upt_k m k A

goal (1 subgoal):
 1. (if \<forall>m. is_zero_row_upt_k m k A then 0 else mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1) = mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1
[PROOF STEP]
by presburger
[PROOF STATE]
proof (state)
this:
ia = mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
have B_eq_A: "B=A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B = A
[PROOF STEP]
unfolding B Gauss_Jordan_column_k_def Let_def fst_conv snd_conv ia2
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. snd (if (\<forall>m\<ge>mod_type_class.from_nat (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1). A $ m $ mod_type_class.from_nat k = (0::'a)) \<or> mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1 = nrows A then (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1, A) else (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1 + 1, Gauss_Jordan_in_ij A (mod_type_class.from_nat (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A) + 1)) (mod_type_class.from_nat k))) = A
[PROOF STEP]
apply simp
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>m\<ge>mod_type_class.from_nat (Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A))). A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)) \<and> Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A)) \<noteq> nrows A \<longrightarrow> Gauss_Jordan_in_ij A (mod_type_class.from_nat (Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A)))) (mod_type_class.from_nat k) = A
[PROOF STEP]
unfolding from_nat_to_nat_greatest
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>m\<ge>(GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows). A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)) \<and> Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A)) \<noteq> nrows A \<longrightarrow> Gauss_Jordan_in_ij A ((GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows)) (mod_type_class.from_nat k) = A
[PROOF STEP]
using zero_below_greatest
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>(GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows). A $ m $ mod_type_class.from_nat k = (0::'a)

goal (1 subgoal):
 1. (\<exists>m\<ge>(GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows). A $ m $ mod_type_class.from_nat k \<noteq> (0::'a)) \<and> Suc (mod_type_class.to_nat (GREATEST n. \<not> is_zero_row_upt_k n k A)) \<noteq> nrows A \<longrightarrow> Gauss_Jordan_in_ij A ((GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows)) (mod_type_class.from_nat k) = A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
B = A

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
have rref_suc: "reduced_row_echelon_form_upt_k A (Suc k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. reduced_row_echelon_form_upt_k A (Suc k)
[PROOF STEP]
proof (rule rref_suc_if_zero_below_greatest[OF rref], auto intro!: not_zero_m)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. (GREATEST m. \<not> is_zero_row_upt_k m k A) < a \<Longrightarrow> is_zero_row_upt_k a (Suc k) A
[PROOF STEP]
fix a
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>a. (GREATEST m. \<not> is_zero_row_upt_k m k A) < a \<Longrightarrow> is_zero_row_upt_k a (Suc k) A
[PROOF STEP]
assume greatest_less_a: "(GREATEST m. \<not> is_zero_row_upt_k m k A) < a"
[PROOF STATE]
proof (state)
this:
(GREATEST m. \<not> is_zero_row_upt_k m k A) < a

goal (1 subgoal):
 1. \<And>a. (GREATEST m. \<not> is_zero_row_upt_k m k A) < a \<Longrightarrow> is_zero_row_upt_k a (Suc k) A
[PROOF STEP]
show "is_zero_row_upt_k a (Suc k) A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k a (Suc k) A
[PROOF STEP]
proof (rule is_zero_row_upt_k_suc)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. is_zero_row_upt_k a k A
 2. A $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
show "is_zero_row_upt_k a k A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. is_zero_row_upt_k a k A
[PROOF STEP]
using row_greater_greatest_is_zero[OF greatest_less_a]
[PROOF STATE]
proof (prove)
using this:
is_zero_row_upt_k a k A

goal (1 subgoal):
 1. is_zero_row_upt_k a k A
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k a k A

goal (1 subgoal):
 1. A $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
show "A $ a $ from_nat k = 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
using zero_below_greatest  le_Suc[OF greatest_less_a]
[PROOF STATE]
proof (prove)
using this:
\<forall>m\<ge>(GREATEST n. \<not> is_zero_row_upt_k n k A) + (1::'rows). A $ m $ mod_type_class.from_nat k = (0::'a)
(GREATEST m. \<not> is_zero_row_upt_k m k A) + (1::'rows) \<le> a

goal (1 subgoal):
 1. A $ a $ mod_type_class.from_nat k = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A $ a $ mod_type_class.from_nat k = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
is_zero_row_upt_k a (Suc k) A

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
reduced_row_echelon_form_upt_k A (Suc k)

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
using rref_upt_condition4[OF rref_suc] not_zero_i_suc_k i_not_j
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<not> is_zero_row_upt_k i (Suc k) A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a))
\<not> is_zero_row_upt_k i (Suc k) B
i \<noteq> j

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
unfolding B_eq_A
[PROOF STATE]
proof (prove)
using this:
\<forall>i. \<not> is_zero_row_upt_k i (Suc k) A \<longrightarrow> (\<forall>j. i \<noteq> j \<longrightarrow> A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a))
\<not> is_zero_row_upt_k i (Suc k) A
i \<noteq> j

goal (1 subgoal):
 1. A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
A $ j $ (LEAST n. A $ i $ n \<noteq> (0::'a)) = (0::'a)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nth_Cons': "(x # xs)!n = (if n = 0 then x else xs!(n - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (x # xs) ! n = (if n = 0 then x else xs ! (n - 1))
[PROOF STEP]
by (cases n) simp_all


[STATEMENT]
lemma open_cballE: "t\<^sub>0 \<in> T \<Longrightarrow> open T \<Longrightarrow> \<exists>e>0. cball t\<^sub>0 e \<subseteq> T"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>t\<^sub>0 \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>e>0. cball t\<^sub>0 e \<subseteq> T
[PROOF STEP]
using open_contains_cball
[PROOF STATE]
proof (prove)
using this:
open ?S = (\<forall>x\<in>?S. \<exists>e>0. cball x e \<subseteq> ?S)

goal (1 subgoal):
 1. \<lbrakk>t\<^sub>0 \<in> T; open T\<rbrakk> \<Longrightarrow> \<exists>e>0. cball t\<^sub>0 e \<subseteq> T
[PROOF STEP]
by blast


[STATEMENT]
theorem meet_fun: "f \<sqinter> g = (\<lambda>x. f x \<sqinter> g x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<sqinter> g = (\<lambda>x. f x \<sqinter> g x)
[PROOF STEP]
by (rule meet_equality) (rule is_inf_fun)


[STATEMENT]
lemma rel_star_contr: "X^* O Y = (\<Union>n. (rel_dioid.power X n) O Y)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. X\<^sup>* O Y = (\<Union>n. rel_dioid.power X n O Y)
[PROOF STEP]
by (metis rel_star_def relcomp_UNION_distrib2)


[STATEMENT]
lemma mat_geD[dest]: assumes "A \<ge>\<^sub>m B" and "i < dim_row A" "j < dim_col A"
  shows "A $$ (i,j) \<ge> B $$ (i,j)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. B $$ (i, j) \<le> A $$ (i, j)
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
A \<ge>\<^sub>m B
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. B $$ (i, j) \<le> A $$ (i, j)
[PROOF STEP]
unfolding mat_ge_def
[PROOF STATE]
proof (prove)
using this:
\<forall>i<dim_row A. \<forall>j<dim_col A. B $$ (i, j) \<le> A $$ (i, j)
i < dim_row A
j < dim_col A

goal (1 subgoal):
 1. B $$ (i, j) \<le> A $$ (i, j)
[PROOF STEP]
by auto


[STATEMENT]
lemma maximal_acyclic_path_deadlock :
  assumes "acyclic M"
  and     "path M (initial M) p"
shows "\<not>(\<exists> p' . p' \<noteq> [] \<and> path M (initial M) (p@p') \<and> distinct (visited_states (initial M) (p@p')))
        = deadlock_state M (target (initial M) p)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<exists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))) \<noteq> deadlock_state M (target (FSM.initial M) p)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<exists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))) \<noteq> deadlock_state M (target (FSM.initial M) p)
[PROOF STEP]
have "deadlock_state M (target (initial M) p) \<Longrightarrow> \<not>(\<exists> p' . p' \<noteq> [] \<and> path M (initial M) (p@p')
          \<and> distinct (visited_states (initial M) (p@p')))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. deadlock_state M (target (FSM.initial M) p) \<Longrightarrow> \<nexists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))
[PROOF STEP]
unfolding deadlock_state.simps
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> (\<exists>t\<in>FSM.transitions M. t_source t = target (FSM.initial M) p) \<Longrightarrow> \<nexists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))
[PROOF STEP]
using assms(2)
[PROOF STATE]
proof (prove)
using this:
path M (FSM.initial M) p

goal (1 subgoal):
 1. \<not> (\<exists>t\<in>FSM.transitions M. t_source t = target (FSM.initial M) p) \<Longrightarrow> \<nexists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))
[PROOF STEP]
by (metis path.cases path_suffix)
[PROOF STATE]
proof (state)
this:
deadlock_state M (target (FSM.initial M) p) \<Longrightarrow> \<nexists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))

goal (1 subgoal):
 1. (\<exists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))) \<noteq> deadlock_state M (target (FSM.initial M) p)
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
deadlock_state M (target (FSM.initial M) p) \<Longrightarrow> \<nexists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
deadlock_state M (target (FSM.initial M) p) \<Longrightarrow> \<nexists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))

goal (1 subgoal):
 1. (\<exists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))) \<noteq> deadlock_state M (target (FSM.initial M) p)
[PROOF STEP]
by (metis acyclic.elims(2) assms(1) assms(2) is_prefix_prefix maximal_path_target_deadlock
          self_append_conv)
[PROOF STATE]
proof (state)
this:
(\<exists>p'. p' \<noteq> [] \<and> path M (FSM.initial M) (p @ p') \<and> distinct (visited_states (FSM.initial M) (p @ p'))) \<noteq> deadlock_state M (target (FSM.initial M) p)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma calc_ideal_points_cvec_different [simp]:
  assumes "(cmod B)\<^sup>2 > (cmod A)\<^sup>2" "is_real A"
  shows "\<not> (calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
(cmod A)\<^sup>2 < (cmod B)\<^sup>2
is_real A

goal (1 subgoal):
 1. \<not> calc_ideal_point1_cvec A B \<approx>\<^sub>v calc_ideal_point2_cvec A B
[PROOF STEP]
by (auto) (auto simp add: cmod_def)


[STATEMENT]
lemma parts_UN_subset1: "(\<Union>x\<in>A. parts(H x)) \<subseteq> parts(\<Union>x\<in>A. H x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Union>x\<in>A. parts (H x)) \<subseteq> parts (\<Union> (H ` A))
[PROOF STEP]
by (intro UN_least parts_mono UN_upper)


[STATEMENT]
lemma " \<And>(a::nat) b.(times  a  b) =(times  b  a)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<And>a b. a * b = b * a
[PROOF STEP]
by auto


[STATEMENT]
lemma lower_bound2:
  fixes b::nat
    and v::int
      defines "x \<equiv> 2^(b - 1) - (-v+2^(b-1)-1) mod 2^b - 1"
    assumes "b>0"
    shows "x \<ge> - (2 ^ (b - 1))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. - (2 ^ (b - 1)) \<le> x
[PROOF STEP]
using upper_bound2 assms
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>0 < ?b; ?c < 2 ^ ?b; 0 \<le> ?c\<rbrakk> \<Longrightarrow> ?c - 2 ^ (?b - 1) < 2 ^ (?b - 1)
x \<equiv> 2 ^ (b - 1) - (- v + 2 ^ (b - 1) - 1) mod 2 ^ b - 1
0 < b

goal (1 subgoal):
 1. - (2 ^ (b - 1)) \<le> x
[PROOF STEP]
by auto


[STATEMENT]
lemma closed_list_all2:
  fixes f g :: "'b::t2_space \<Rightarrow> 'a llist"
  assumes f: "\<And>x. isCont f x" and g: "\<And>x. isCont g x"
  shows "closed {x. llist_all2 R (f x) (g x)}"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. closed {x. llist_all2 R (f x) (g x)}
[PROOF STEP]
using  continuous_closed_vimage[OF closed_llist_all2  isCont_Pair[OF f g]]
[PROOF STATE]
proof (prove)
using this:
closed ((\<lambda>x. (f x, g x)) -` {(x, y). llist_all2 ?R4 x y})

goal (1 subgoal):
 1. closed {x. llist_all2 R (f x) (g x)}
[PROOF STEP]
by simp


[STATEMENT]
lemma "((\<forall>x. P(x))\<longrightarrow>Q) \<longrightarrow> \<not> (\<forall>x. P(x) \<and> \<not>Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. ((\<forall>x. P x) \<longrightarrow> Q) \<longrightarrow> \<not> (\<forall>x. P x \<and> \<not> Q)
[PROOF STEP]
by iprover


[STATEMENT]
lemma (in group) lcosets_subset_PowG:
     "subgroup H G  \<Longrightarrow> lcosets H \<subseteq> Pow(carrier G)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup H G \<Longrightarrow> lcosets H \<subseteq> Pow (carrier G)
[PROOF STEP]
apply (simp add: LCOSETS_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. subgroup H G \<Longrightarrow> (\<Union>a\<in>carrier G. {a <# H}) \<subseteq> Pow (carrier G)
[PROOF STEP]
apply (blast dest: l_coset_subset_G subgroup.subset)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
done


[STATEMENT]
lemma eadd_partial_function_mono [partial_function_mono]:
  "\<lbrakk> monotone (fun_ord (\<le>)) (\<le>) f; monotone (fun_ord (\<le>)) (\<le>) g \<rbrakk>
  \<Longrightarrow> monotone (fun_ord (\<le>)) (\<le>) (\<lambda>x. f x + g x :: enat)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>monotone (fun_ord (\<le>)) (\<le>) f; monotone (fun_ord (\<le>)) (\<le>) g\<rbrakk> \<Longrightarrow> monotone (fun_ord (\<le>)) (\<le>) (\<lambda>x. f x + g x)
[PROOF STEP]
by(rule mono2mono_eadd)


[STATEMENT]
lemma bigtheta_divide:
  assumes "f1 \<in> \<Theta>(f2)" "g1 \<in> \<Theta>(g2)"
  shows   "(\<lambda>x. f1 x / g1 x) \<in> \<Theta>(\<lambda>x. f2 x / g2 x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>x. f1 x / g1 x) \<in> \<Theta>(\<lambda>x. f2 x / g2 x)
[PROOF STEP]
by (subst (1 2) divide_inverse, intro landau_theta.mult) (simp_all add: bigtheta_inverse assms)


[STATEMENT]
lemma LIM_less_bound:
  fixes f :: "real \<Rightarrow> real"
  assumes ev: "b < x" "\<forall> x' \<in> { b <..< x}. 0 \<le> f x'" and "isCont f x"
  shows "0 \<le> f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 0 \<le> f x
[PROOF STEP]
proof (rule tendsto_lowerbound)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. (?f \<longlongrightarrow> f x) ?F
 2. \<forall>\<^sub>F i in ?F. 0 \<le> ?f i
 3. ?F \<noteq> bot
[PROOF STEP]
show "(f \<longlongrightarrow> f x) (at_left x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (f \<longlongrightarrow> f x) (at_left x)
[PROOF STEP]
using \<open>isCont f x\<close>
[PROOF STATE]
proof (prove)
using this:
isCont f x

goal (1 subgoal):
 1. (f \<longlongrightarrow> f x) (at_left x)
[PROOF STEP]
by (simp add: filterlim_at_split isCont_def)
[PROOF STATE]
proof (state)
this:
(f \<longlongrightarrow> f x) (at_left x)

goal (2 subgoals):
 1. \<forall>\<^sub>F i in at_left x. 0 \<le> f i
 2. at_left x \<noteq> bot
[PROOF STEP]
show "eventually (\<lambda>x. 0 \<le> f x) (at_left x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_left x. 0 \<le> f x
[PROOF STEP]
using ev
[PROOF STATE]
proof (prove)
using this:
b < x
\<forall>x'\<in>{b<..<x}. 0 \<le> f x'

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at_left x. 0 \<le> f x
[PROOF STEP]
by (auto simp: eventually_at dist_real_def intro!: exI[of _ "x - b"])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at_left x. 0 \<le> f x

goal (1 subgoal):
 1. at_left x \<noteq> bot
[PROOF STEP]
qed simp


[STATEMENT]
lemma sorted_mergesort_by_rel:
  "sorted (mergesort_by_rel (\<le>) xs)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sorted (mergesort_by_rel (\<le>) xs)
[PROOF STEP]
by (rule sorted_wrt_mergesort_by_rel) auto


[STATEMENT]
lemma r_diff_distr:
  "x \<in> carrier R \<Longrightarrow> y \<in> carrier R \<Longrightarrow> z \<in> carrier R \<Longrightarrow>
    z \<otimes> (x \<ominus> y) = z \<otimes> x \<ominus> z \<otimes> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>x \<in> carrier R; y \<in> carrier R; z \<in> carrier R\<rbrakk> \<Longrightarrow> z \<otimes> (x \<ominus> y) = z \<otimes> x \<ominus> z \<otimes> y
[PROOF STEP]
by (simp add: minus_eq r_distr r_minus)


[STATEMENT]
lemma invertible_Hermite_of_upt_row_i:
  assumes a: "ass_function ass"
  shows "\<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A
[PROOF STEP]
proof (induct k arbitrary: A)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A 0 ass res = P ** A
 2. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
case 0
[PROOF STATE]
proof (state)
this:

goal (2 subgoals):
 1. \<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A 0 ass res = P ** A
 2. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A 0 ass res = P ** A
[PROOF STEP]
unfolding Hermite_of_upt_row_i_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<exists>P. invertible P \<and> foldl (Hermite_of_row_i ass res) A (map mod_type_class.from_nat [0..<0]) = P ** A
[PROOF STEP]
by (auto, metis invertible_def matrix_mul_lid)
[PROOF STATE]
proof (state)
this:
\<exists>P. invertible P \<and> Hermite_of_upt_row_i A 0 ass res = P ** A

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
case (Suc k)
[PROOF STATE]
proof (state)
this:
\<exists>P. invertible P \<and> Hermite_of_upt_row_i ?A k ass res = P ** ?A

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
obtain Q where inv_Q: "invertible Q" and H_QA: "Hermite_of_upt_row_i A k ass res = Q ** A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>invertible Q; Hermite_of_upt_row_i A k ass res = Q ** A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using Suc.hyps
[PROOF STATE]
proof (prove)
using this:
\<exists>P. invertible P \<and> Hermite_of_upt_row_i ?A k ass res = P ** ?A

goal (1 subgoal):
 1. (\<And>Q. \<lbrakk>invertible Q; Hermite_of_upt_row_i A k ass res = Q ** A\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
invertible Q
Hermite_of_upt_row_i A k ass res = Q ** A

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
obtain P where inv_P: "invertible P"
    and H_PH: "Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (from_nat k)
    = P ** (Hermite_of_upt_row_i A k ass res)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>P. \<lbrakk>invertible P; Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k) = P ** Hermite_of_upt_row_i A k ass res\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using invertible_Hermite_of_row_i[OF a]
[PROOF STATE]
proof (prove)
using this:
\<exists>P. invertible P \<and> Hermite_of_row_i ass ?res ?A ?i = P ** ?A

goal (1 subgoal):
 1. (\<And>P. \<lbrakk>invertible P; Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k) = P ** Hermite_of_upt_row_i A k ass res\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
invertible P
Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k) = P ** Hermite_of_upt_row_i A k ass res

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
have inv_PQ: "invertible (P**Q)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. invertible (P ** Q)
[PROOF STEP]
by (simp add: inv_P inv_Q invertible_mult)
[PROOF STATE]
proof (state)
this:
invertible (P ** Q)

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
have "Hermite_of_upt_row_i A (Suc k) ass res
    = Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (from_nat k)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_of_upt_row_i A (Suc k) ass res = Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k)
[PROOF STEP]
unfolding Hermite_of_upt_row_i_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. foldl (Hermite_of_row_i ass res) A (map mod_type_class.from_nat [0..<Suc k]) = Hermite_of_row_i ass res (foldl (Hermite_of_row_i ass res) A (map mod_type_class.from_nat [0..<k])) (mod_type_class.from_nat k)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Hermite_of_upt_row_i A (Suc k) ass res = Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k)

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hermite_of_upt_row_i A (Suc k) ass res = Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k)

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
have "... =  P ** (Hermite_of_upt_row_i A k ass res)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k) = P ** Hermite_of_upt_row_i A k ass res
[PROOF STEP]
unfolding H_PH
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P ** Hermite_of_upt_row_i A k ass res = P ** Hermite_of_upt_row_i A k ass res
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k) = P ** Hermite_of_upt_row_i A k ass res

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
Hermite_of_row_i ass res (Hermite_of_upt_row_i A k ass res) (mod_type_class.from_nat k) = P ** Hermite_of_upt_row_i A k ass res

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
have "... = P ** (Q ** A)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P ** Hermite_of_upt_row_i A k ass res = P ** (Q ** A)
[PROOF STEP]
unfolding H_QA
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P ** (Q ** A) = P ** (Q ** A)
[PROOF STEP]
..
[PROOF STATE]
proof (state)
this:
P ** Hermite_of_upt_row_i A k ass res = P ** (Q ** A)

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
P ** Hermite_of_upt_row_i A k ass res = P ** (Q ** A)

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
have "... = (P ** Q) ** A"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P ** (Q ** A) = P ** Q ** A
[PROOF STEP]
by (simp add: matrix_mul_assoc)
[PROOF STATE]
proof (state)
this:
P ** (Q ** A) = P ** Q ** A

goal (1 subgoal):
 1. \<And>k A. (\<And>A. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A k ass res = P ** A) \<Longrightarrow> \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
Hermite_of_upt_row_i A (Suc k) ass res = P ** Q ** A
[PROOF STEP]
show ?case
[PROOF STATE]
proof (prove)
using this:
Hermite_of_upt_row_i A (Suc k) ass res = P ** Q ** A

goal (1 subgoal):
 1. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
using inv_PQ
[PROOF STATE]
proof (prove)
using this:
Hermite_of_upt_row_i A (Suc k) ass res = P ** Q ** A
invertible (P ** Q)

goal (1 subgoal):
 1. \<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
\<exists>P. invertible P \<and> Hermite_of_upt_row_i A (Suc k) ass res = P ** A

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma project_at_indices_consecutive_ind_length:
  assumes "(i::nat) < j"
  assumes "j \<le> n"
  assumes "length a = n"
  shows "length (project_at_indices {i..<j} a) = j - i"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. length (nths a {i..<j}) = j - i
[PROOF STEP]
using assms proj_at_index_list_length[of "{i..<j}" a]
[PROOF STATE]
proof (prove)
using this:
i < j
j \<le> n
length a = n
{i..<j} \<subseteq> indices_of a \<Longrightarrow> length (nths a {i..<j}) = card {i..<j}

goal (1 subgoal):
 1. length (nths a {i..<j}) = j - i
[PROOF STEP]
unfolding indices_of_def
[PROOF STATE]
proof (prove)
using this:
i < j
j \<le> n
length a = n
{i..<j} \<subseteq> {..<length a} \<Longrightarrow> length (nths a {i..<j}) = card {i..<j}

goal (1 subgoal):
 1. length (nths a {i..<j}) = j - i
[PROOF STEP]
by (metis card_atLeastLessThan ivl_subset le_less_linear lessThan_atLeast0 not_less0)


[STATEMENT]
lemma H_on_ket_zero:
  shows "(H * |zero\<rangle>) = \<psi>\<^sub>0\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. H * |Deutsch.zero\<rangle> = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]])
[PROOF STEP]
proof
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]])); j < dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))\<rbrakk> \<Longrightarrow> (H * |Deutsch.zero\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]) $$ (i, j)
 2. dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
 3. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
fix i j:: nat
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]])); j < dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))\<rbrakk> \<Longrightarrow> (H * |Deutsch.zero\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]) $$ (i, j)
 2. dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
 3. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
assume "i < dim_row \<psi>\<^sub>0\<^sub>0" and "j < dim_col \<psi>\<^sub>0\<^sub>0"
[PROOF STATE]
proof (state)
this:
i < dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
j < dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]])); j < dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))\<rbrakk> \<Longrightarrow> (H * |Deutsch.zero\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]) $$ (i, j)
 2. dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
 3. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i < dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
j < dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
have "i \<in> {0,1} \<and> j = 0"
[PROOF STATE]
proof (prove)
using this:
i < dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
j < dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))

goal (1 subgoal):
 1. i \<in> {0, 1} \<and> j = 0
[PROOF STEP]
by (simp add: mat_of_cols_list_def less_2_cases)
[PROOF STATE]
proof (state)
this:
i \<in> {0, 1} \<and> j = 0

goal (3 subgoals):
 1. \<And>i j. \<lbrakk>i < dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]])); j < dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))\<rbrakk> \<Longrightarrow> (H * |Deutsch.zero\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]) $$ (i, j)
 2. dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
 3. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
i \<in> {0, 1} \<and> j = 0
[PROOF STEP]
show "(H * |zero\<rangle>) $$ (i,j) = \<psi>\<^sub>0\<^sub>0 $$ (i,j)"
[PROOF STATE]
proof (prove)
using this:
i \<in> {0, 1} \<and> j = 0

goal (1 subgoal):
 1. (H * |Deutsch.zero\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]) $$ (i, j)
[PROOF STEP]
by (auto simp add: mat_of_cols_list_def times_mat_def scalar_prod_def H_def)
[PROOF STATE]
proof (state)
this:
(H * |Deutsch.zero\<rangle>) $$ (i, j) = Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]) $$ (i, j)

goal (2 subgoals):
 1. dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
 2. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
 2. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
show "dim_row (H * |zero\<rangle>) = dim_row \<psi>\<^sub>0\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
by (simp add: H_def mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
dim_row (H * |Deutsch.zero\<rangle>) = dim_row (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))

goal (1 subgoal):
 1. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
show "dim_col (H * |zero\<rangle>) = dim_col \<psi>\<^sub>0\<^sub>0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))
[PROOF STEP]
by (simp add: H_def mat_of_cols_list_def)
[PROOF STATE]
proof (state)
this:
dim_col (H * |Deutsch.zero\<rangle>) = dim_col (Tensor.mat_of_cols_list 2 (map (map complex_of_real) [[1 / sqrt 2, 1 / sqrt 2]]))

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma min_product_set_finite:
  "(\<And>x. x \<in> X \<Longrightarrow> finite x) \<Longrightarrow> finite (\<Otimes>\<^sub>m X)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<And>x. x \<in> X \<Longrightarrow> finite x) \<Longrightarrow> finite (\<Otimes>\<^sub>m X)
[PROOF STEP]
by (cases "finite X", rotate_tac, induction X rule: finite_induct) (simp_all add: min_product_set_def, insert min_product_finite, blast)


[STATEMENT]
lemma sort_list_split :
  "\<forall> x \<in> set (take i (sort xs)) . \<forall> y \<in> set (drop i (sort xs)) . x \<le> y"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>x\<in>set (take i (sort xs)). \<forall>y\<in>set (drop i (sort xs)). x \<le> y
[PROOF STEP]
using sorted_append
[PROOF STATE]
proof (prove)
using this:
sorted (?xs @ ?ys) = (sorted ?xs \<and> sorted ?ys \<and> (\<forall>x\<in>set ?xs. \<forall>y\<in>set ?ys. x \<le> y))

goal (1 subgoal):
 1. \<forall>x\<in>set (take i (sort xs)). \<forall>y\<in>set (drop i (sort xs)). x \<le> y
[PROOF STEP]
by fastforce


[STATEMENT]
lemma triv_div_mult:
assumes vSF: "vSF \<noteq> (1::real)"
and L: "L = (K - vSF) / (1 - vSF)" and Ln: "L \<noteq> 1"
shows "(VS / (1 - vSF) * V) / (1 - L) = (VS * V) / (1 - K)"
(is "?A = ?B")
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
proof-
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
have vSF_0: "1 - vSF \<noteq> 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - vSF \<noteq> 0
[PROOF STEP]
using vSF
[PROOF STATE]
proof (prove)
using this:
vSF \<noteq> 1

goal (1 subgoal):
 1. 1 - vSF \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 - vSF \<noteq> 0

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
1 - vSF \<noteq> 0

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
assume "K = 1"
[PROOF STATE]
proof (state)
this:
K = 1

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
hence "L = 1"
[PROOF STATE]
proof (prove)
using this:
K = 1

goal (1 subgoal):
 1. L = 1
[PROOF STEP]
using L vSF
[PROOF STATE]
proof (prove)
using this:
K = 1
L = (K - vSF) / (1 - vSF)
vSF \<noteq> 1

goal (1 subgoal):
 1. L = 1
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
L = 1

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
L = 1

goal (1 subgoal):
 1. False
[PROOF STEP]
using Ln
[PROOF STATE]
proof (prove)
using this:
L = 1
L \<noteq> 1

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

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
K = 1 \<Longrightarrow> False

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
hence Kn: "K \<noteq> 1"
[PROOF STATE]
proof (prove)
using this:
K = 1 \<Longrightarrow> False

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

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
hence K_0: "1 - K \<noteq> 0"
[PROOF STATE]
proof (prove)
using this:
K \<noteq> 1

goal (1 subgoal):
 1. 1 - K \<noteq> 0
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 - K \<noteq> 0

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
have "1 - L = (1 - K) / (1 - vSF)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - L = (1 - K) / (1 - vSF)
[PROOF STEP]
unfolding L
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. 1 - (K - vSF) / (1 - vSF) = (1 - K) / (1 - vSF)
[PROOF STEP]
using vSF diff_frac_eq_2
[PROOF STATE]
proof (prove)
using this:
vSF \<noteq> 1
?b \<noteq> 1 \<Longrightarrow> 1 - (?a - ?b) / (1 - ?b) = (1 - ?a) / (1 - ?b)

goal (1 subgoal):
 1. 1 - (K - vSF) / (1 - vSF) = (1 - K) / (1 - vSF)
[PROOF STEP]
by blast
[PROOF STATE]
proof (state)
this:
1 - L = (1 - K) / (1 - vSF)

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
hence "?A = (VS / (1 - vSF) * V) / ((1 - K) / (1 - vSF))"
[PROOF STATE]
proof (prove)
using this:
1 - L = (1 - K) / (1 - vSF)

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS / (1 - vSF) * V / ((1 - K) / (1 - vSF))
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
VS / (1 - vSF) * V / (1 - L) = VS / (1 - vSF) * V / ((1 - K) / (1 - vSF))

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
VS / (1 - vSF) * V / (1 - L) = VS / (1 - vSF) * V / ((1 - K) / (1 - vSF))

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
have "... = ?B"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. VS / (1 - vSF) * V / ((1 - K) / (1 - vSF)) = VS * V / (1 - K)
[PROOF STEP]
using vSF_0 K_0
[PROOF STATE]
proof (prove)
using this:
1 - vSF \<noteq> 0
1 - K \<noteq> 0

goal (1 subgoal):
 1. VS / (1 - vSF) * V / ((1 - K) / (1 - vSF)) = VS * V / (1 - K)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
VS / (1 - vSF) * V / ((1 - K) / (1 - vSF)) = VS * V / (1 - K)

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)

goal (1 subgoal):
 1. VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
VS / (1 - vSF) * V / (1 - L) = VS * V / (1 - K)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma ereal_SUP_uminus:
  fixes f :: "'a \<Rightarrow> ereal"
  shows "(SUP i \<in> R. - f i) = - (INF i \<in> R. f i)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (SUP i\<in>R. - f i) = - Inf (f ` R)
[PROOF STEP]
using ereal_Sup_uminus_image_eq[of "f`R"]
[PROOF STATE]
proof (prove)
using this:
Sup (uminus ` f ` R) = - Inf (f ` R)

goal (1 subgoal):
 1. (SUP i\<in>R. - f i) = - Inf (f ` R)
[PROOF STEP]
by (simp add: image_image)


[STATEMENT]
theorem inverse_squares_sums: "(\<lambda>n. 1 / (n + 1)\<^sup>2) sums (pi\<^sup>2 / 6)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
define P where "P x n = (\<Prod>k=1..n. 1 - x^2 / of_nat k^2)" for x :: real and n
[PROOF STATE]
proof (state)
this:
P ?x ?n = (\<Prod>k = 1..?n. 1 - ?x\<^sup>2 / (real k)\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
define K where "K = (\<Sum>n. inverse (real_of_nat (Suc n))^2)"
[PROOF STATE]
proof (state)
this:
K = (\<Sum>n. (inverse (real (Suc n)))\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
define f where [abs_def]: "f x = (\<Sum>n. P x n / of_nat (Suc n)^2)" for x
[PROOF STATE]
proof (state)
this:
f \<equiv> \<lambda>x. \<Sum>n. P x n / (real (Suc n))\<^sup>2

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
define g where [abs_def]: "g x = (1 - sin (pi * x) / (pi * x))" for x
[PROOF STATE]
proof (state)
this:
g \<equiv> \<lambda>x. 1 - sin (pi * x) / (pi * x)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
have sums: "(\<lambda>n. P x n / of_nat (Suc n)^2) sums (if x = 0 then K else g x / x^2)" for x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
assume x: "x = 0"
[PROOF STATE]
proof (state)
this:
x = 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
have "summable (\<lambda>n. inverse ((real_of_nat (Suc n))\<^sup>2))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. inverse ((real (Suc n))\<^sup>2))
[PROOF STEP]
using inverse_power_summable[of 2]
[PROOF STATE]
proof (prove)
using this:
2 \<le> 2 \<Longrightarrow> summable (\<lambda>n. inverse ((of_nat n)\<^sup>2))

goal (1 subgoal):
 1. summable (\<lambda>n. inverse ((real (Suc n))\<^sup>2))
[PROOF STEP]
by (subst summable_Suc_iff) simp
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. inverse ((real (Suc n))\<^sup>2))

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
 2. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. inverse ((real (Suc n))\<^sup>2))

goal (1 subgoal):
 1. (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
by (simp add: x g_def P_def K_def inverse_eq_divide power_divide summable_sums)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
assume x: "x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
have "(\<lambda>n. P x n - P x (Suc n)) sums (P x 0 - sin (pi * x) / (pi * x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. P x n - P x (Suc n)) sums (P x 0 - sin (pi * x) / (pi * x))
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Prod>k = 1..n. 1 - x\<^sup>2 / (real k)\<^sup>2) - (\<Prod>k = 1..Suc n. 1 - x\<^sup>2 / (real k)\<^sup>2)) sums ((\<Prod>k = 1..0. 1 - x\<^sup>2 / (real k)\<^sup>2) - sin (pi * x) / (pi * x))
[PROOF STEP]
using x
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>n. (\<Prod>k = 1..n. 1 - x\<^sup>2 / (real k)\<^sup>2) - (\<Prod>k = 1..Suc n. 1 - x\<^sup>2 / (real k)\<^sup>2)) sums ((\<Prod>k = 1..0. 1 - x\<^sup>2 / (real k)\<^sup>2) - sin (pi * x) / (pi * x))
[PROOF STEP]
by (intro telescope_sums' sin_product_formula_real')
[PROOF STATE]
proof (state)
this:
(\<lambda>n. P x n - P x (Suc n)) sums (P x 0 - sin (pi * x) / (pi * x))

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. P x n - P x (Suc n)) sums (P x 0 - sin (pi * x) / (pi * x))

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
have "(\<lambda>n. P x n - P x (Suc n)) = (\<lambda>n. (x^2 / of_nat (Suc n)^2) * P x n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. P x n - P x (Suc n)) = (\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n)
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<lambda>n. (\<Prod>k = 1..n. 1 - x\<^sup>2 / (real k)\<^sup>2) - (\<Prod>k = 1..Suc n. 1 - x\<^sup>2 / (real k)\<^sup>2)) = (\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * (\<Prod>k = 1..n. 1 - x\<^sup>2 / (real k)\<^sup>2))
[PROOF STEP]
by (simp add: prod.nat_ivl_Suc' algebra_simps)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. P x n - P x (Suc n)) = (\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n)

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
(\<lambda>n. P x n - P x (Suc n)) = (\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n)

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
have "P x 0 = 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. P x 0 = 1
[PROOF STEP]
by (simp add: P_def)
[PROOF STATE]
proof (state)
this:
P x 0 = 1

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n) sums (1 - sin (pi * x) / (pi * x))
[PROOF STEP]
have "(\<lambda>n. x\<^sup>2 / (of_nat (Suc n))\<^sup>2 * P x n) sums (1 - sin (pi * x) / (pi * x))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n) sums (1 - sin (pi * x) / (pi * x))

goal (1 subgoal):
 1. (\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n) sums (1 - sin (pi * x) / (pi * x))
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
(\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n) sums (1 - sin (pi * x) / (pi * x))

goal (1 subgoal):
 1. x \<noteq> 0 \<Longrightarrow> (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
from sums_divide[OF this, of "x^2"] x
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n / x\<^sup>2) sums ((1 - sin (pi * x) / (pi * x)) / x\<^sup>2)
x \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n / x\<^sup>2) sums ((1 - sin (pi * x) / (pi * x)) / x\<^sup>2)
x \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
[PROOF STEP]
unfolding g_def
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. x\<^sup>2 / (real (Suc n))\<^sup>2 * P x n / x\<^sup>2) sums ((1 - sin (pi * x) / (pi * x)) / x\<^sup>2)
x \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else (1 - sin (pi * x) / (pi * x)) / x\<^sup>2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
(\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
(\<lambda>n. P ?x n / (real (Suc n))\<^sup>2) sums (if ?x = 0 then K else g ?x / ?x\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
have "continuous_on (ball 0 1) f"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. continuous_on (ball 0 1) f
[PROOF STEP]
proof (rule uniform_limit_theorem; (intro always_eventually allI)?)
[PROOF STATE]
proof (state)
goal (3 subgoals):
 1. \<And>x. continuous_on (ball 0 1) (?f1 x)
 2. uniform_limit (ball 0 1) ?f1 f ?F1
 3. ?F1 \<noteq> bot
[PROOF STEP]
show "uniform_limit (ball 0 1) (\<lambda>n x. \<Sum>k<n. P x k / of_nat (Suc k)^2) f sequentially"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. uniform_limit (ball 0 1) (\<lambda>n x. \<Sum>k<n. P x k / (real (Suc k))\<^sup>2) f sequentially
[PROOF STEP]
proof (unfold f_def, rule Weierstrass_m_test)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
fix n :: nat and x :: real
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
assume x: "x \<in> ball 0 1"
[PROOF STATE]
proof (state)
this:
x \<in> ball 0 1

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
x \<in> ball 0 1

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
fix k :: nat
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
assume k: "k \<ge> 1"
[PROOF STATE]
proof (state)
this:
1 \<le> k

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
from x
[PROOF STATE]
proof (chain)
picking this:
x \<in> ball 0 1
[PROOF STEP]
have "x^2 < 1"
[PROOF STATE]
proof (prove)
using this:
x \<in> ball 0 1

goal (1 subgoal):
 1. x\<^sup>2 < 1
[PROOF STEP]
by (auto simp: abs_square_less_1)
[PROOF STATE]
proof (state)
this:
x\<^sup>2 < 1

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
x\<^sup>2 < 1

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
from k
[PROOF STATE]
proof (chain)
picking this:
1 \<le> k
[PROOF STEP]
have "\<dots> \<le> of_nat k^2"
[PROOF STATE]
proof (prove)
using this:
1 \<le> k

goal (1 subgoal):
 1. 1 \<le> (real k)\<^sup>2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
1 \<le> (real k)\<^sup>2

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
x\<^sup>2 < (real k)\<^sup>2
[PROOF STEP]
have "(1 - x^2 / of_nat k^2) \<in> {0..1}"
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 < (real k)\<^sup>2

goal (1 subgoal):
 1. 1 - x\<^sup>2 / (real k)\<^sup>2 \<in> {0..1}
[PROOF STEP]
using k
[PROOF STATE]
proof (prove)
using this:
x\<^sup>2 < (real k)\<^sup>2
1 \<le> k

goal (1 subgoal):
 1. 1 - x\<^sup>2 / (real k)\<^sup>2 \<in> {0..1}
[PROOF STEP]
by (simp_all add: field_simps del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
1 - x\<^sup>2 / (real k)\<^sup>2 \<in> {0..1}

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
1 \<le> ?k2 \<Longrightarrow> 1 - x\<^sup>2 / (real ?k2)\<^sup>2 \<in> {0..1}

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
hence "(\<Prod>k=1..n. abs (1 - x^2 / of_nat k^2)) \<le> (\<Prod>k=1..n. 1)"
[PROOF STATE]
proof (prove)
using this:
1 \<le> ?k2 \<Longrightarrow> 1 - x\<^sup>2 / (real ?k2)\<^sup>2 \<in> {0..1}

goal (1 subgoal):
 1. (\<Prod>k = 1..n. \<bar>1 - x\<^sup>2 / (real k)\<^sup>2\<bar>) \<le> (\<Prod>k = 1..n. 1)
[PROOF STEP]
by (intro prod_mono) simp
[PROOF STATE]
proof (state)
this:
(\<Prod>k = 1..n. \<bar>1 - x\<^sup>2 / (real k)\<^sup>2\<bar>) \<le> (\<Prod>k = 1..n. 1)

goal (2 subgoals):
 1. \<And>n x. x \<in> ball 0 1 \<Longrightarrow> norm (P x n / (real (Suc n))\<^sup>2) \<le> ?M1 n
 2. summable ?M1
[PROOF STEP]
thus "norm (P x n / (of_nat (Suc n)^2)) \<le> 1 / of_nat (Suc n)^2"
[PROOF STATE]
proof (prove)
using this:
(\<Prod>k = 1..n. \<bar>1 - x\<^sup>2 / (real k)\<^sup>2\<bar>) \<le> (\<Prod>k = 1..n. 1)

goal (1 subgoal):
 1. norm (P x n / (real (Suc n))\<^sup>2) \<le> 1 / (real (Suc n))\<^sup>2
[PROOF STEP]
unfolding P_def
[PROOF STATE]
proof (prove)
using this:
(\<Prod>k = 1..n. \<bar>1 - x\<^sup>2 / (real k)\<^sup>2\<bar>) \<le> (\<Prod>k = 1..n. 1)

goal (1 subgoal):
 1. norm ((\<Prod>k = 1..n. 1 - x\<^sup>2 / (real k)\<^sup>2) / (real (Suc n))\<^sup>2) \<le> 1 / (real (Suc n))\<^sup>2
[PROOF STEP]
by (simp add: field_simps abs_prod del: of_nat_Suc)
[PROOF STATE]
proof (state)
this:
norm (P x n / (real (Suc n))\<^sup>2) \<le> 1 / (real (Suc n))\<^sup>2

goal (1 subgoal):
 1. summable (\<lambda>n. 1 / (real (Suc n))\<^sup>2)
[PROOF STEP]
qed (subst summable_Suc_iff, insert inverse_power_summable[of 2], simp add: inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
uniform_limit (ball 0 1) (\<lambda>n x. \<Sum>k<n. P x k / (real (Suc k))\<^sup>2) f sequentially

goal (2 subgoals):
 1. \<And>x. continuous_on (ball 0 1) (\<lambda>xa. \<Sum>k<x. P xa k / (real (Suc k))\<^sup>2)
 2. sequentially \<noteq> bot
[PROOF STEP]
qed (auto simp: P_def intro!: continuous_intros)
[PROOF STATE]
proof (state)
this:
continuous_on (ball 0 1) f

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
hence "isCont f 0"
[PROOF STATE]
proof (prove)
using this:
continuous_on (ball 0 1) f

goal (1 subgoal):
 1. isCont f 0
[PROOF STEP]
by (subst (asm) continuous_on_eq_continuous_at) simp_all
[PROOF STATE]
proof (state)
this:
isCont f 0

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
hence "(f \<midarrow> 0 \<rightarrow> f 0)"
[PROOF STATE]
proof (prove)
using this:
isCont f 0

goal (1 subgoal):
 1. f \<midarrow>0\<rightarrow> f 0
[PROOF STEP]
by (simp add: isCont_def)
[PROOF STATE]
proof (state)
this:
f \<midarrow>0\<rightarrow> f 0

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f \<midarrow>0\<rightarrow> f 0

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
have "f 0 = K"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f 0 = K
[PROOF STEP]
unfolding f_def P_def K_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. (\<Prod>k = 1..n. 1 - 0\<^sup>2 / (real k)\<^sup>2) / (real (Suc n))\<^sup>2) = (\<Sum>n. (inverse (real (Suc n)))\<^sup>2)
[PROOF STEP]
by (simp add: inverse_eq_divide power_divide)
[PROOF STATE]
proof (state)
this:
f 0 = K

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f \<midarrow>0\<rightarrow> K
[PROOF STEP]
have "f \<midarrow> 0 \<rightarrow> K"
[PROOF STATE]
proof (prove)
using this:
f \<midarrow>0\<rightarrow> K

goal (1 subgoal):
 1. f \<midarrow>0\<rightarrow> K
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
f \<midarrow>0\<rightarrow> K

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
f \<midarrow>0\<rightarrow> K

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
have "f \<midarrow> 0 \<rightarrow> pi^2 / 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
proof (rule Lim_transform_eventually)
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. ?f \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
 2. \<forall>\<^sub>F x in at 0. ?f x = f x
[PROOF STEP]
define f' where [abs_def]: "f' x = (\<Sum>n. - sin_coeff (n+3) * pi ^ (n+2) * x^n)" for x
[PROOF STATE]
proof (state)
this:
f' \<equiv> \<lambda>x. \<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n

goal (2 subgoals):
 1. ?f \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
 2. \<forall>\<^sub>F x in at 0. ?f x = f x
[PROOF STEP]
have "eventually (\<lambda>x. x \<noteq> (0::real)) (at 0)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<forall>\<^sub>F x in at 0. x \<noteq> 0
[PROOF STEP]
by (auto simp add: eventually_at intro!: exI[of _ 1])
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at 0. x \<noteq> 0

goal (2 subgoals):
 1. ?f \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
 2. \<forall>\<^sub>F x in at 0. ?f x = f x
[PROOF STEP]
thus "eventually (\<lambda>x. f' x = f x) (at 0)"
[PROOF STATE]
proof (prove)
using this:
\<forall>\<^sub>F x in at 0. x \<noteq> 0

goal (1 subgoal):
 1. \<forall>\<^sub>F x in at 0. f' x = f x
[PROOF STEP]
proof eventually_elim
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
assume x: "x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
have "sin_coeff 1 = (1 :: real)" "sin_coeff 2 = (0::real)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. sin_coeff 1 = 1 &&& sin_coeff 2 = 0
[PROOF STEP]
by (simp_all add: sin_coeff_def)
[PROOF STATE]
proof (state)
this:
sin_coeff 1 = 1
sin_coeff 2 = 0

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
with sums_split_initial_segment[OF sums_minus[OF sin_converges], of 3 "pi*x"]
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>i. - (sin_coeff (i + 3) *\<^sub>R (pi * x) ^ (i + 3))) sums (- sin (pi * x) - (\<Sum>i<3. - (sin_coeff i *\<^sub>R (pi * x) ^ i)))
sin_coeff 1 = 1
sin_coeff 2 = 0
[PROOF STEP]
have "(\<lambda>n. - (sin_coeff (n+3) * (pi*x)^(n+3))) sums (pi * x - sin (pi*x))"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>i. - (sin_coeff (i + 3) *\<^sub>R (pi * x) ^ (i + 3))) sums (- sin (pi * x) - (\<Sum>i<3. - (sin_coeff i *\<^sub>R (pi * x) ^ i)))
sin_coeff 1 = 1
sin_coeff 2 = 0

goal (1 subgoal):
 1. (\<lambda>n. - (sin_coeff (n + 3) * (pi * x) ^ (n + 3))) sums (pi * x - sin (pi * x))
[PROOF STEP]
by (simp add: eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - (sin_coeff (n + 3) * (pi * x) ^ (n + 3))) sums (pi * x - sin (pi * x))

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
from sums_divide[OF this, of "x^3 * pi"] x
[PROOF STATE]
proof (chain)
picking this:
(\<lambda>n. - (sin_coeff (n + 3) * (pi * x) ^ (n + 3)) / (x ^ 3 * pi)) sums ((pi * x - sin (pi * x)) / (x ^ 3 * pi))
x \<noteq> 0
[PROOF STEP]
have "(\<lambda>n. - (sin_coeff (n+3) * pi^(n+2) * x^n)) sums ((1 - sin (pi*x) / (pi*x)) / x^2)"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - (sin_coeff (n + 3) * (pi * x) ^ (n + 3)) / (x ^ 3 * pi)) sums ((pi * x - sin (pi * x)) / (x ^ 3 * pi))
x \<noteq> 0

goal (1 subgoal):
 1. (\<lambda>n. - (sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)) sums ((1 - sin (pi * x) / (pi * x)) / x\<^sup>2)
[PROOF STEP]
by (simp add: field_split_simps eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - (sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)) sums ((1 - sin (pi * x) / (pi * x)) / x\<^sup>2)

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
with x
[PROOF STATE]
proof (chain)
picking this:
x \<noteq> 0
(\<lambda>n. - (sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)) sums ((1 - sin (pi * x) / (pi * x)) / x\<^sup>2)
[PROOF STEP]
have "(\<lambda>n. - (sin_coeff (n+3) * pi^(n+2) * x^n)) sums (g x / x^2)"
[PROOF STATE]
proof (prove)
using this:
x \<noteq> 0
(\<lambda>n. - (sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)) sums ((1 - sin (pi * x) / (pi * x)) / x\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. - (sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)) sums (g x / x\<^sup>2)
[PROOF STEP]
by (simp add: g_def)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. - (sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)) sums (g x / x\<^sup>2)

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
hence "f' x = g x / x^2"
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. - (sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)) sums (g x / x\<^sup>2)

goal (1 subgoal):
 1. f' x = g x / x\<^sup>2
[PROOF STEP]
by (simp add: sums_iff f'_def)
[PROOF STATE]
proof (state)
this:
f' x = g x / x\<^sup>2

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f' x = g x / x\<^sup>2

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
have "\<dots> = f x"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. g x / x\<^sup>2 = f x
[PROOF STEP]
using sums[of x] x
[PROOF STATE]
proof (prove)
using this:
(\<lambda>n. P x n / (real (Suc n))\<^sup>2) sums (if x = 0 then K else g x / x\<^sup>2)
x \<noteq> 0

goal (1 subgoal):
 1. g x / x\<^sup>2 = f x
[PROOF STEP]
by (simp add: sums_iff g_def f_def)
[PROOF STATE]
proof (state)
this:
g x / x\<^sup>2 = f x

goal (1 subgoal):
 1. \<And>x. x \<noteq> 0 \<Longrightarrow> f' x = f x
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f' x = f x
[PROOF STEP]
show "f' x = f x"
[PROOF STATE]
proof (prove)
using this:
f' x = f x

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

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
\<forall>\<^sub>F x in at 0. f' x = f x

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n) \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
have "isCont f' 0"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont f' 0
[PROOF STEP]
unfolding f'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. isCont (\<lambda>x. \<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n) 0
[PROOF STEP]
proof (intro isCont_powser_converges_everywhere)
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * y ^ n)
[PROOF STEP]
fix x :: real
[PROOF STATE]
proof (state)
goal (1 subgoal):
 1. \<And>y. summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * y ^ n)
[PROOF STEP]
show "summable (\<lambda>n. -sin_coeff (n+3) * pi^(n+2) * x^n)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)
[PROOF STEP]
proof (cases "x = 0")
[PROOF STATE]
proof (state)
goal (2 subgoals):
 1. x = 0 \<Longrightarrow> summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)
 2. x \<noteq> 0 \<Longrightarrow> summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)
[PROOF STEP]
assume x: "x \<noteq> 0"
[PROOF STATE]
proof (state)
this:
x \<noteq> 0

goal (2 subgoals):
 1. x = 0 \<Longrightarrow> summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)
 2. x \<noteq> 0 \<Longrightarrow> summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)
[PROOF STEP]
from summable_divide[OF sums_summable[OF sums_split_initial_segment[OF
               sin_converges[of "pi*x"]], of 3], of "-pi*x^3"] x
[PROOF STATE]
proof (chain)
picking this:
summable (\<lambda>n. sin_coeff (n + 3) *\<^sub>R (pi * x) ^ (n + 3) / (- pi * x ^ 3))
x \<noteq> 0
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
summable (\<lambda>n. sin_coeff (n + 3) *\<^sub>R (pi * x) ^ (n + 3) / (- pi * x ^ 3))
x \<noteq> 0

goal (1 subgoal):
 1. summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)
[PROOF STEP]
by (simp add: field_split_simps eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)

goal (1 subgoal):
 1. x = 0 \<Longrightarrow> summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)
[PROOF STEP]
qed (simp only: summable_0_powser)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n)

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
isCont f' 0

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n) \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
hence "f' \<midarrow> 0 \<rightarrow> f' 0"
[PROOF STATE]
proof (prove)
using this:
isCont f' 0

goal (1 subgoal):
 1. f' \<midarrow>0\<rightarrow> f' 0
[PROOF STEP]
by (simp add: isCont_def)
[PROOF STATE]
proof (state)
this:
f' \<midarrow>0\<rightarrow> f' 0

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n) \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
also
[PROOF STATE]
proof (state)
this:
f' \<midarrow>0\<rightarrow> f' 0

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n) \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
have "f' 0 = pi * pi / fact 3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. f' 0 = pi * pi / fact 3
[PROOF STEP]
unfolding f'_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. (\<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * 0 ^ n) = pi * pi / fact 3
[PROOF STEP]
by (subst powser_zero) (simp add: sin_coeff_def)
[PROOF STATE]
proof (state)
this:
f' 0 = pi * pi / fact 3

goal (1 subgoal):
 1. (\<lambda>x. \<Sum>n. - sin_coeff (n + 3) * pi ^ (n + 2) * x ^ n) \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
finally
[PROOF STATE]
proof (chain)
picking this:
f' \<midarrow>0\<rightarrow> pi * pi / fact 3
[PROOF STEP]
show "f' \<midarrow> 0 \<rightarrow> pi^2 / 6"
[PROOF STATE]
proof (prove)
using this:
f' \<midarrow>0\<rightarrow> pi * pi / fact 3

goal (1 subgoal):
 1. f' \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
by (simp add: eval_nat_numeral)
[PROOF STATE]
proof (state)
this:
f' \<midarrow>0\<rightarrow> pi\<^sup>2 / 6

goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
f \<midarrow>0\<rightarrow> pi\<^sup>2 / 6

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
f \<midarrow>0\<rightarrow> K
f \<midarrow>0\<rightarrow> pi\<^sup>2 / 6
[PROOF STEP]
have "K = pi^2 / 6"
[PROOF STATE]
proof (prove)
using this:
f \<midarrow>0\<rightarrow> K
f \<midarrow>0\<rightarrow> pi\<^sup>2 / 6

goal (1 subgoal):
 1. K = pi\<^sup>2 / 6
[PROOF STEP]
by (rule LIM_unique)
[PROOF STATE]
proof (state)
this:
K = pi\<^sup>2 / 6

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
moreover
[PROOF STATE]
proof (state)
this:
K = pi\<^sup>2 / 6

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
from inverse_power_summable[of 2]
[PROOF STATE]
proof (chain)
picking this:
2 \<le> 2 \<Longrightarrow> summable (\<lambda>n. inverse ((of_nat n)\<^sup>2))
[PROOF STEP]
have "summable (\<lambda>n. (inverse (real_of_nat (Suc n)))\<^sup>2)"
[PROOF STATE]
proof (prove)
using this:
2 \<le> 2 \<Longrightarrow> summable (\<lambda>n. inverse ((of_nat n)\<^sup>2))

goal (1 subgoal):
 1. summable (\<lambda>n. (inverse (real (Suc n)))\<^sup>2)
[PROOF STEP]
by (subst summable_Suc_iff) (simp add: power_inverse)
[PROOF STATE]
proof (state)
this:
summable (\<lambda>n. (inverse (real (Suc n)))\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
ultimately
[PROOF STATE]
proof (chain)
picking this:
K = pi\<^sup>2 / 6
summable (\<lambda>n. (inverse (real (Suc n)))\<^sup>2)
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
K = pi\<^sup>2 / 6
summable (\<lambda>n. (inverse (real (Suc n)))\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
unfolding K_def
[PROOF STATE]
proof (prove)
using this:
(\<Sum>n. (inverse (real (Suc n)))\<^sup>2) = pi\<^sup>2 / 6
summable (\<lambda>n. (inverse (real (Suc n)))\<^sup>2)

goal (1 subgoal):
 1. (\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)
[PROOF STEP]
by (auto simp add: sums_iff power_divide inverse_eq_divide)
[PROOF STATE]
proof (state)
this:
(\<lambda>n. 1 / real ((n + 1)\<^sup>2)) sums (pi\<^sup>2 / 6)

goal:
No subgoals!
[PROOF STEP]
qed


[STATEMENT]
lemma nocross_events_neq:
  "\<lbrakk>Q \<in> \<P>; R \<in> \<P>; a \<in> Q; b \<in> R; R\<inter>Q = {}\<rbrakk> \<Longrightarrow> a \<noteq> b"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
 1. \<lbrakk>Q \<in> \<P>; R \<in> \<P>; a \<in> Q; b \<in> R; R \<inter> Q = {}\<rbrakk> \<Longrightarrow> a \<noteq> b
[PROOF STEP]
by auto